diff --git a/FileLiberator/DownloadDecryptBook.cs b/FileLiberator/DownloadDecryptBook.cs index db7fc144..e43ab458 100644 --- a/FileLiberator/DownloadDecryptBook.cs +++ b/FileLiberator/DownloadDecryptBook.cs @@ -175,7 +175,6 @@ namespace FileLiberator File.Move(f.FullName, dest); movedAudioFile |= AudibleFileStorage.Audio.IsFileTypeMatch(f); - } AudibleFileStorage.Audio.Refresh(); diff --git a/FileLiberator/DownloadPdf.cs b/FileLiberator/DownloadPdf.cs index a9b8815c..7be8f43a 100644 --- a/FileLiberator/DownloadPdf.cs +++ b/FileLiberator/DownloadPdf.cs @@ -20,8 +20,8 @@ namespace FileLiberator public override async Task ProcessItemAsync(LibraryBook libraryBook) { var proposedDownloadFilePath = getProposedDownloadFilePath(libraryBook); - await downloadPdfAsync(libraryBook, proposedDownloadFilePath); - var result = verifyDownload(libraryBook); + var actualDownloadedFilePath = await downloadPdfAsync(libraryBook, proposedDownloadFilePath); + var result = verifyDownload(actualDownloadedFilePath); libraryBook.Book.UserDefinedItem.PdfStatus = result.IsSuccess ? LiberatedStatus.Liberated : LiberatedStatus.NotLiberated; @@ -48,7 +48,7 @@ namespace FileLiberator private static string getdownloadUrl(LibraryBook libraryBook) => libraryBook?.Book?.Supplements?.FirstOrDefault()?.Url; - private async Task downloadPdfAsync(LibraryBook libraryBook, string proposedDownloadFilePath) + private async Task downloadPdfAsync(LibraryBook libraryBook, string proposedDownloadFilePath) { var api = await GetApiAsync(libraryBook); var downloadUrl = await api.GetPdfDownloadLinkAsync(libraryBook.Book.AudibleProductId); @@ -57,10 +57,12 @@ namespace FileLiberator var actualDownloadedFilePath = await PerformDownloadAsync( proposedDownloadFilePath, (p) => client.DownloadFileAsync(downloadUrl, proposedDownloadFilePath, p)); + + return actualDownloadedFilePath; } - private static StatusHandler verifyDownload(LibraryBook libraryBook) - => !libraryBook.Book.PDF_Exists + private static StatusHandler verifyDownload(string actualDownloadedFilePath) + => !File.Exists(actualDownloadedFilePath) ? new StatusHandler { "Downloaded PDF cannot be found" } : new StatusHandler(); } diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj index de0c6769..0b668d52 100644 --- a/LibationLauncher/LibationLauncher.csproj +++ b/LibationLauncher/LibationLauncher.csproj @@ -13,7 +13,7 @@ win-x64 - 5.5.7.2 + 5.5.7.4 diff --git a/LibationWinForms/GridEntry.cs b/LibationWinForms/GridEntry.cs index fb716e31..ef451cfd 100644 --- a/LibationWinForms/GridEntry.cs +++ b/LibationWinForms/GridEntry.cs @@ -132,14 +132,15 @@ namespace LibationWinForms private void Commit() { - //We don't want LiberatedStatus.PartialDownload to be a persistent status. - var bookStatus = Book.UserDefinedItem.BookStatus; - var saveStatus = bookStatus == LiberatedStatus.PartialDownload ? LiberatedStatus.NotLiberated : bookStatus; + // We don't want LiberatedStatus.PartialDownload to be a persistent status. + // If display/icon status is PartialDownload then save NotLiberated to db then restore PartialDownload for display + var displayStatus = Book.UserDefinedItem.BookStatus; + var saveStatus = displayStatus == LiberatedStatus.PartialDownload ? LiberatedStatus.NotLiberated : displayStatus; Book.UserDefinedItem.BookStatus = saveStatus; LibraryCommands.UpdateUserDefinedItem(Book); - Book.UserDefinedItem.BookStatus = bookStatus; + Book.UserDefinedItem.BookStatus = displayStatus; Refilter?.Invoke(); }