Only remove a LibraryBook from queue if we are trying to re-download.

This commit is contained in:
MBucari 2025-07-14 12:38:29 -06:00
parent 944645379e
commit 9f8075041b
2 changed files with 20 additions and 12 deletions

View File

@ -41,21 +41,25 @@ namespace LibationAvalonia.ViewModels
{ {
var item = libraryBooks[0]; var item = libraryBooks[0];
//Remove this item from the queue if it's already present and completed. void initiateSingleDownload()
//Only do this when adding a single book at a time to prevent accidental {
//extra downloads when queueing in batches. //Remove this item from the queue if it's already present and completed.
ProcessQueue.RemoveCompleted(item); //Only do this when adding a single book at a time to prevent accidental
//extra downloads when queueing in batches.
ProcessQueue.RemoveCompleted(item);
setQueueCollapseState(false);
}
if (item.Book.UserDefinedItem.BookStatus is LiberatedStatus.NotLiberated or LiberatedStatus.PartialDownload) if (item.Book.UserDefinedItem.BookStatus is LiberatedStatus.NotLiberated or LiberatedStatus.PartialDownload)
{ {
initiateSingleDownload();
Serilog.Log.Logger.Information("Begin single book backup of {libraryBook}", item); Serilog.Log.Logger.Information("Begin single book backup of {libraryBook}", item);
setQueueCollapseState(false);
ProcessQueue.AddDownloadDecrypt(item); ProcessQueue.AddDownloadDecrypt(item);
} }
else if (item.Book.UserDefinedItem.PdfStatus is LiberatedStatus.NotLiberated) else if (item.Book.UserDefinedItem.PdfStatus is LiberatedStatus.NotLiberated)
{ {
initiateSingleDownload();
Serilog.Log.Logger.Information("Begin single pdf backup of {libraryBook}", item); Serilog.Log.Logger.Information("Begin single pdf backup of {libraryBook}", item);
setQueueCollapseState(false);
ProcessQueue.AddDownloadPdf(item); ProcessQueue.AddDownloadPdf(item);
} }
else if (item.Book.Audio_Exists()) else if (item.Book.Audio_Exists())

View File

@ -31,21 +31,25 @@ namespace LibationWinForms
{ {
var item = libraryBooks[0]; var item = libraryBooks[0];
//Remove this item from the queue if it's already present and completed. void initiateSingleDownload()
//Only do this when adding a single book at a time to prevent accidental {
//extra downloads when queueing in batches. //Remove this item from the queue if it's already present and completed.
processBookQueue1.RemoveCompleted(item); //Only do this when adding a single book at a time to prevent accidental
//extra downloads when queueing in batches.
processBookQueue1.RemoveCompleted(item);
SetQueueCollapseState(false);
}
if (item.Book.UserDefinedItem.BookStatus is LiberatedStatus.NotLiberated or LiberatedStatus.PartialDownload) if (item.Book.UserDefinedItem.BookStatus is LiberatedStatus.NotLiberated or LiberatedStatus.PartialDownload)
{ {
initiateSingleDownload();
Serilog.Log.Logger.Information("Begin single book backup of {libraryBook}", item); Serilog.Log.Logger.Information("Begin single book backup of {libraryBook}", item);
SetQueueCollapseState(false);
processBookQueue1.AddDownloadDecrypt(item); processBookQueue1.AddDownloadDecrypt(item);
} }
else if (item.Book.UserDefinedItem.PdfStatus is LiberatedStatus.NotLiberated) else if (item.Book.UserDefinedItem.PdfStatus is LiberatedStatus.NotLiberated)
{ {
initiateSingleDownload();
Serilog.Log.Logger.Information("Begin single pdf backup of {libraryBook}", item); Serilog.Log.Logger.Information("Begin single pdf backup of {libraryBook}", item);
SetQueueCollapseState(false);
processBookQueue1.AddDownloadPdf(item); processBookQueue1.AddDownloadPdf(item);
} }
else if (item.Book.Audio_Exists()) else if (item.Book.Audio_Exists())