Re-add completed audiobooks to queue (#1219)
This commit is contained in:
parent
5ab6c1fe70
commit
8aa157f2f6
@ -40,6 +40,12 @@ namespace LibationAvalonia.ViewModels
|
|||||||
if (libraryBooks.Length == 1)
|
if (libraryBooks.Length == 1)
|
||||||
{
|
{
|
||||||
var item = libraryBooks[0];
|
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);
|
||||||
|
|
||||||
if (item.Book.UserDefinedItem.BookStatus is LiberatedStatus.NotLiberated or LiberatedStatus.PartialDownload)
|
if (item.Book.UserDefinedItem.BookStatus is LiberatedStatus.NotLiberated or LiberatedStatus.PartialDownload)
|
||||||
{
|
{
|
||||||
Serilog.Log.Logger.Information("Begin single book backup of {libraryBook}", item);
|
Serilog.Log.Logger.Information("Begin single book backup of {libraryBook}", item);
|
||||||
|
|||||||
@ -130,6 +130,11 @@ namespace LibationAvalonia.ViewModels
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool RemoveCompleted(LibraryBook libraryBook)
|
||||||
|
=> Queue.FirstOrDefault(b => b?.LibraryBook?.Book?.AudibleProductId == libraryBook.Book.AudibleProductId) is ProcessBookViewModel entry
|
||||||
|
&& entry.Status is ProcessBookStatus.Completed
|
||||||
|
&& Queue.RemoveCompleted(entry);
|
||||||
|
|
||||||
public void AddDownloadPdf(LibraryBook libraryBook)
|
public void AddDownloadPdf(LibraryBook libraryBook)
|
||||||
=> AddDownloadPdf(new List<LibraryBook>() { libraryBook });
|
=> AddDownloadPdf(new List<LibraryBook>() { libraryBook });
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,12 @@ namespace LibationWinForms
|
|||||||
if (libraryBooks.Length == 1)
|
if (libraryBooks.Length == 1)
|
||||||
{
|
{
|
||||||
var item = libraryBooks[0];
|
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);
|
||||||
|
|
||||||
if (item.Book.UserDefinedItem.BookStatus is LiberatedStatus.NotLiberated or LiberatedStatus.PartialDownload)
|
if (item.Book.UserDefinedItem.BookStatus is LiberatedStatus.NotLiberated or LiberatedStatus.PartialDownload)
|
||||||
{
|
{
|
||||||
Serilog.Log.Logger.Information("Begin single book backup of {libraryBook}", item);
|
Serilog.Log.Logger.Information("Begin single book backup of {libraryBook}", item);
|
||||||
|
|||||||
@ -92,6 +92,11 @@ namespace LibationWinForms.ProcessQueue
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool RemoveCompleted(DataLayer.LibraryBook libraryBook)
|
||||||
|
=> Queue.FirstOrDefault(b => b?.LibraryBook?.Book?.AudibleProductId == libraryBook.Book.AudibleProductId) is ProcessBook entry
|
||||||
|
&& entry.Status is ProcessBookStatus.Completed
|
||||||
|
&& Queue.RemoveCompleted(entry);
|
||||||
|
|
||||||
public void AddDownloadPdf(DataLayer.LibraryBook libraryBook)
|
public void AddDownloadPdf(DataLayer.LibraryBook libraryBook)
|
||||||
=> AddDownloadPdf(new List<DataLayer.LibraryBook>() { libraryBook });
|
=> AddDownloadPdf(new List<DataLayer.LibraryBook>() { libraryBook });
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user