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

This commit is contained in:
Michael Bucari-Tovo
2025-02-28 10:42:14 -07:00
parent a9375f1520
commit 3b7d5a354f
3 changed files with 28 additions and 2 deletions

View File

@@ -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 });