From 9f8075041bea23a2685298cfaa7665d18a4b1dd3 Mon Sep 17 00:00:00 2001 From: MBucari Date: Mon, 14 Jul 2025 12:38:29 -0600 Subject: [PATCH] Only remove a LibraryBook from queue if we are trying to re-download. --- .../ViewModels/MainVM.ProcessQueue.cs | 16 ++++++++++------ Source/LibationWinForms/Form1.ProcessQueue.cs | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Source/LibationAvalonia/ViewModels/MainVM.ProcessQueue.cs b/Source/LibationAvalonia/ViewModels/MainVM.ProcessQueue.cs index b964e6b9..0b53df4f 100644 --- a/Source/LibationAvalonia/ViewModels/MainVM.ProcessQueue.cs +++ b/Source/LibationAvalonia/ViewModels/MainVM.ProcessQueue.cs @@ -41,21 +41,25 @@ namespace LibationAvalonia.ViewModels { var item = libraryBooks[0]; - //Remove this item from the queue if it's already present and completed. - //Only do this when adding a single book at a time to prevent accidental - //extra downloads when queueing in batches. - ProcessQueue.RemoveCompleted(item); + void initiateSingleDownload() + { + //Remove this item from the queue if it's already present and completed. + //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) { + initiateSingleDownload(); Serilog.Log.Logger.Information("Begin single book backup of {libraryBook}", item); - setQueueCollapseState(false); ProcessQueue.AddDownloadDecrypt(item); } else if (item.Book.UserDefinedItem.PdfStatus is LiberatedStatus.NotLiberated) { + initiateSingleDownload(); Serilog.Log.Logger.Information("Begin single pdf backup of {libraryBook}", item); - setQueueCollapseState(false); ProcessQueue.AddDownloadPdf(item); } else if (item.Book.Audio_Exists()) diff --git a/Source/LibationWinForms/Form1.ProcessQueue.cs b/Source/LibationWinForms/Form1.ProcessQueue.cs index f9c7ccc4..a19ce0b6 100644 --- a/Source/LibationWinForms/Form1.ProcessQueue.cs +++ b/Source/LibationWinForms/Form1.ProcessQueue.cs @@ -31,21 +31,25 @@ namespace LibationWinForms { var item = libraryBooks[0]; - //Remove this item from the queue if it's already present and completed. - //Only do this when adding a single book at a time to prevent accidental - //extra downloads when queueing in batches. - processBookQueue1.RemoveCompleted(item); + void initiateSingleDownload() + { + //Remove this item from the queue if it's already present and completed. + //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) { + initiateSingleDownload(); Serilog.Log.Logger.Information("Begin single book backup of {libraryBook}", item); - SetQueueCollapseState(false); processBookQueue1.AddDownloadDecrypt(item); } else if (item.Book.UserDefinedItem.PdfStatus is LiberatedStatus.NotLiberated) { + initiateSingleDownload(); Serilog.Log.Logger.Information("Begin single pdf backup of {libraryBook}", item); - SetQueueCollapseState(false); processBookQueue1.AddDownloadPdf(item); } else if (item.Book.Audio_Exists())