Re-add books to queue that failed or were cancelled.

This commit is contained in:
Michael Bucari-Tovo committed 2025-02-28 10:47:26 -07:00
1 parent a9375f1520
commit 3b7d5a354f
3 files changed
+28 -2

No files matched your search

@@ -82,7 +82,15 @@ namespace LibationWinForms.ProcessQueue
}
private bool isBookInQueue(DataLayer.LibraryBook libraryBook)
=> Queue.Any(b => b?.LibraryBook?.Book?.AudibleProductId == libraryBook.Book.AudibleProductId);
{
var entry = Queue.FirstOrDefault(b => b?.LibraryBook?.Book?.AudibleProductId == libraryBook.Book.AudibleProductId);
if (entry == null)
return false;
else if (entry.Status is ProcessBookStatus.Cancelled or ProcessBookStatus.Failed)
return !Queue.RemoveCompleted(entry);
else
return true;
}
public void AddDownloadPdf(DataLayer.LibraryBook libraryBook)
=> AddDownloadPdf(new List<DataLayer.LibraryBook>() { libraryBook });