diff --git a/ApplicationServices/LibraryCommands.cs b/ApplicationServices/LibraryCommands.cs index ed36595e..efafb3e2 100644 --- a/ApplicationServices/LibraryCommands.cs +++ b/ApplicationServices/LibraryCommands.cs @@ -186,7 +186,7 @@ namespace ApplicationServices : LiberatedStatus.NotLiberated; public static LiberatedStatus? Pdf_Status(Book book) - => !book.Supplements.Any() ? null + => !book.HasPdf ? null : book.PDF_Exists ? LiberatedStatus.Liberated : LiberatedStatus.NotLiberated; @@ -207,7 +207,7 @@ namespace ApplicationServices var boolResults = libraryBooks .AsParallel() - .Where(lb => lb.Book.Supplements.Any()) + .Where(lb => lb.Book.HasPdf) .Select(lb => Pdf_Status(lb.Book)) .ToList(); var pdfsDownloaded = boolResults.Count(r => r == LiberatedStatus.Liberated); diff --git a/ApplicationServices/LibraryExporter.cs b/ApplicationServices/LibraryExporter.cs index 22434d92..28c99cd7 100644 --- a/ApplicationServices/LibraryExporter.cs +++ b/ApplicationServices/LibraryExporter.cs @@ -47,8 +47,8 @@ namespace ApplicationServices [Name("Publisher")] public string Publisher { get; set; } - [Name("Pdf url")] - public string PdfUrl { get; set; } + [Name("Has PDF")] + public bool HasPdf { get; set; } [Name("Series Names")] public string SeriesNames { get; set; } @@ -109,7 +109,7 @@ namespace ApplicationServices NarratorNames = a.Book.NarratorNames, LengthInMinutes = a.Book.LengthInMinutes, Publisher = a.Book.Publisher, - PdfUrl = a.Book.Supplements?.FirstOrDefault()?.Url, + HasPdf = a.Book.HasPdf, SeriesNames = a.Book.SeriesNames, SeriesOrder = a.Book.SeriesLink.Any() ? a.Book.SeriesLink?.Select(sl => $"{sl.Index} : {sl.Series.Name}").Aggregate((a, b) => $"{a}, {b}") : "", CommunityRatingOverall = a.Book.Rating?.OverallRating, @@ -182,7 +182,7 @@ namespace ApplicationServices nameof (ExportDto.NarratorNames), nameof (ExportDto.LengthInMinutes), nameof (ExportDto.Publisher), - nameof (ExportDto.PdfUrl), + nameof (ExportDto.HasPdf), nameof (ExportDto.SeriesNames), nameof (ExportDto.SeriesOrder), nameof (ExportDto.CommunityRatingOverall), @@ -234,7 +234,7 @@ namespace ApplicationServices row.CreateCell(col++).SetCellValue(dto.NarratorNames); row.CreateCell(col++).SetCellValue(dto.LengthInMinutes); row.CreateCell(col++).SetCellValue(dto.Publisher); - row.CreateCell(col++).SetCellValue(dto.PdfUrl); + row.CreateCell(col++).SetCellValue(dto.HasPdf); row.CreateCell(col++).SetCellValue(dto.SeriesNames); row.CreateCell(col++).SetCellValue(dto.SeriesOrder); diff --git a/LibationSearchEngine/SearchEngine.cs b/LibationSearchEngine/SearchEngine.cs index 550ef809..83bdd480 100644 --- a/LibationSearchEngine/SearchEngine.cs +++ b/LibationSearchEngine/SearchEngine.cs @@ -107,14 +107,14 @@ namespace LibationSearchEngine = new ReadOnlyDictionary>( new Dictionary> { - ["HasDownloads"] = lb => lb.Book.Supplements.Any(), - ["HasDownload"] = lb => lb.Book.Supplements.Any(), - ["Downloads"] = lb => lb.Book.Supplements.Any(), - ["Download"] = lb => lb.Book.Supplements.Any(), - ["HasPDFs"] = lb => lb.Book.Supplements.Any(), - ["HasPDF"] = lb => lb.Book.Supplements.Any(), - ["PDFs"] = lb => lb.Book.Supplements.Any(), - ["PDF"] = lb => lb.Book.Supplements.Any(), + ["HasDownloads"] = lb => lb.Book.HasPdf, + ["HasDownload"] = lb => lb.Book.HasPdf, + ["Downloads"] = lb => lb.Book.HasPdf, + ["Download"] = lb => lb.Book.HasPdf, + ["HasPDFs"] = lb => lb.Book.HasPdf, + ["HasPDF"] = lb => lb.Book.HasPdf, + ["PDFs"] = lb => lb.Book.HasPdf, + ["PDF"] = lb => lb.Book.HasPdf, ["IsRated"] = lb => lb.Book.UserDefinedItem.Rating.OverallRating > 0f, ["Rated"] = lb => lb.Book.UserDefinedItem.Rating.OverallRating > 0f,