Better method for downloading only 1 book at a time.
This commit is contained in:
parent
2afcaebb78
commit
f68bf2d6b3
3 changed files with 16 additions and 12 deletions
|
|
@ -10,6 +10,7 @@ using Dinah.Core.DataBinding;
|
|||
using Dinah.Core;
|
||||
using Dinah.Core.Drawing;
|
||||
using LibationFileManager;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LibationWinForms
|
||||
{
|
||||
|
|
@ -39,6 +40,7 @@ namespace LibationWinForms
|
|||
}
|
||||
}
|
||||
|
||||
public bool DownloadInProgress { get; private set; }
|
||||
public string ProductRating { get; private set; }
|
||||
public string PurchaseDate { get; private set; }
|
||||
public string MyRating { get; private set; }
|
||||
|
|
@ -77,6 +79,16 @@ namespace LibationWinForms
|
|||
|
||||
public GridEntry(LibraryBook libraryBook) => setLibraryBook(libraryBook);
|
||||
|
||||
public async Task DownloadBook()
|
||||
{
|
||||
if (!DownloadInProgress)
|
||||
{
|
||||
DownloadInProgress = true;
|
||||
await BookLiberation.ProcessorAutomationController.BackupSingleBookAsync(LibraryBook);
|
||||
DownloadInProgress = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateLibraryBook(LibraryBook libraryBook)
|
||||
{
|
||||
if (AudibleProductId != libraryBook.Book.AudibleProductId)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ namespace LibationWinForms
|
|||
|
||||
public partial class ProductsGrid : UserControl
|
||||
{
|
||||
private static List<string> bookConversionInProgress = new();
|
||||
public event EventHandler<int> VisibleCountChanged;
|
||||
|
||||
// alias
|
||||
|
|
@ -89,14 +88,8 @@ namespace LibationWinForms
|
|||
return;
|
||||
}
|
||||
|
||||
//don't try to decrypt the same book at the same time.
|
||||
if (bookConversionInProgress.Contains(libraryBook.Book.AudibleProductId))
|
||||
return;
|
||||
|
||||
bookConversionInProgress.Add(libraryBook.Book.AudibleProductId);
|
||||
|
||||
// else: liberate
|
||||
await BookLiberation.ProcessorAutomationController.BackupSingleBookAsync(libraryBook, b => bookConversionInProgress.Remove(b.Book.AudibleProductId));
|
||||
await liveGridEntry.DownloadBook();
|
||||
}
|
||||
|
||||
private static void Details_Click(GridEntry liveGridEntry)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue