Skip to content

Commit

Permalink
New search field: Finished/IsFinished.
Browse files Browse the repository at this point in the history
All work complete except db migration
  • Loading branch information
rmcrackan committed Sep 11, 2024
1 parent 92ee0b2 commit 2fd8ea9
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Source/ApplicationServices/LibraryCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public static async Task<List<LibraryBook>> FindInactiveBooks(Func<Account, Task
| LibraryOptions.ResponseGroupOptions.Contributors | LibraryOptions.ResponseGroupOptions.ProvidedReview
| LibraryOptions.ResponseGroupOptions.ProductPlans | LibraryOptions.ResponseGroupOptions.Series
| LibraryOptions.ResponseGroupOptions.CategoryLadders | LibraryOptions.ResponseGroupOptions.ProductExtendedAttrs
| LibraryOptions.ResponseGroupOptions.PdfUrl | LibraryOptions.ResponseGroupOptions.OriginAsin,
| LibraryOptions.ResponseGroupOptions.PdfUrl | LibraryOptions.ResponseGroupOptions.OriginAsin
| LibraryOptions.ResponseGroupOptions.IsFinished,
ImageSizes = LibraryOptions.ImageSizeOptions._500 | LibraryOptions.ImageSizeOptions._1215
};
var importItems = await scanAccountsAsync(apiExtendedfunc, accounts, libraryOptions);
Expand Down
9 changes: 7 additions & 2 deletions Source/ApplicationServices/LibraryExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public static string GetName(string fieldName)

[Name("LastDownloadedVersion")]
public string LastDownloadedVersion { get; set; }

[Name("IsFinished")]
public bool IsFinished { get; set; }
}
public static class LibToDtos
{
Expand Down Expand Up @@ -153,8 +156,8 @@ public static List<ExportDto> ToDtos(this IEnumerable<LibraryBook> library)
Language = a.Book.Language,
LastDownloaded = a.Book.UserDefinedItem.LastDownloaded,
LastDownloadedVersion = a.Book.UserDefinedItem.LastDownloadedVersion?.ToString() ?? "",
}).ToList();
IsFinished = a.Book.UserDefinedItem.IsFinished
}).ToList();
}
public static class LibraryExporter
{
Expand Down Expand Up @@ -229,6 +232,7 @@ public static void ToXlsx(string saveFilePath)
nameof(ExportDto.Language),
nameof(ExportDto.LastDownloaded),
nameof(ExportDto.LastDownloadedVersion),
nameof(ExportDto.IsFinished)
};
var col = 0;
foreach (var c in columns)
Expand Down Expand Up @@ -306,6 +310,7 @@ public static void ToXlsx(string saveFilePath)
}

row.CreateCell(++col).SetCellValue(dto.LastDownloadedVersion);
row.CreateCell(++col).SetCellValue(dto.IsFinished);

rowIndex++;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/AudibleUtilities/AudibleUtilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AudibleApi" Version="9.1.2.1" />
<PackageReference Include="AudibleApi" Version="9.2.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 17 additions & 1 deletion Source/DataLayer/EfClasses/UserDefinedItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,23 @@ internal set
}
}
}
#endregion
#endregion

#region IsFinished
private bool _isFinished;
public bool IsFinished
{
get => _isFinished;
set
{
if (value != _isFinished)
{
_isFinished = value;
OnItemChanged(nameof(IsFinished));
}
}
}
#endregion

public override string ToString() => $"{Book} {Rating} {Tags}";
}
Expand Down
3 changes: 3 additions & 0 deletions Source/DtoImporterService/BookImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ private void updateBook(ImportItem importItem, Book book)
if (item.PictureLarge is not null)
book.PictureLarge = item.PictureLarge;

if (item.IsFinished is not null)
book.UserDefinedItem.IsFinished = item.IsFinished.Value;

// 2023-02-01
// updateBook must update language on books which were imported before the migration which added language.
// Can eventually delete this
Expand Down
1 change: 1 addition & 0 deletions Source/LibationSearchEngine/SearchEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ private static bool isAuthorNarrated(Book book)
{ FieldType.Bool, lb => lb.Book.IsEpisodeChild().ToString(), "Podcast", "Podcasts", "IsPodcast", "Episode", "Episodes", "IsEpisode" },
{ FieldType.Bool, lb => lb.AbsentFromLastScan.ToString(), "AbsentFromLastScan", "Absent" },
{ FieldType.Bool, lb => (!string.IsNullOrWhiteSpace(lb.Book.SeriesNames())).ToString(), "IsInSeries", "InSeries" },
{ FieldType.Bool, lb => lb.Book.UserDefinedItem.IsFinished.ToString(), nameof(UserDefinedItem.IsFinished), "Finished", "IsFinished" },
// all numbers are padded to 8 char.s
// This will allow a single method to auto-pad numbers. The method will match these as well as date: yyyymmdd
{ FieldType.Number, lb => lb.Book.LengthInMinutes.ToLuceneString(), nameof(Book.LengthInMinutes), "Length", "Minutes" },
Expand Down

0 comments on commit 2fd8ea9

Please sign in to comment.