diff --git a/FileLiberator/UNTESTED/DownloadPdf.cs b/FileLiberator/UNTESTED/DownloadPdf.cs index 2a41f793..917d1de6 100644 --- a/FileLiberator/UNTESTED/DownloadPdf.cs +++ b/FileLiberator/UNTESTED/DownloadPdf.cs @@ -31,12 +31,18 @@ namespace FileLiberator private static string getProposedDownloadFilePath(LibraryBook libraryBook) { // if audio file exists, get it's dir. else return base Book dir - var destinationDir = - // this is safe b/c GetDirectoryName(null) == null - Path.GetDirectoryName(AudibleFileStorage.Audio.GetPath(libraryBook.Book.AudibleProductId)) - ?? AudibleFileStorage.PDF.StorageDirectory; + var existingPath = Path.GetDirectoryName(AudibleFileStorage.Audio.GetPath(libraryBook.Book.AudibleProductId)); + var file = getdownloadUrl(libraryBook); - return Path.Combine(destinationDir, Path.GetFileName(getdownloadUrl(libraryBook))); + if (existingPath != null) + return Path.Combine(existingPath, Path.GetFileName(file)); + + var full = FileUtility.GetValidFilename( + AudibleFileStorage.PDF.StorageDirectory, + libraryBook.Book.Title, + Path.GetExtension(file), + libraryBook.Book.AudibleProductId); + return full; } private async Task downloadPdfAsync(LibraryBook libraryBook, string proposedDownloadFilePath) diff --git a/LibationLauncher/LibationLauncher.csproj b/LibationLauncher/LibationLauncher.csproj index 9702bd61..7c3cb9f0 100644 --- a/LibationLauncher/LibationLauncher.csproj +++ b/LibationLauncher/LibationLauncher.csproj @@ -13,7 +13,7 @@ win-x64 - 4.0.7.2 + 4.0.8.1 diff --git a/LibationWinForms/UNTESTED/BookLiberation/ProcessorAutomationController.cs b/LibationWinForms/UNTESTED/BookLiberation/ProcessorAutomationController.cs index eabc5623..b6ec10cc 100644 --- a/LibationWinForms/UNTESTED/BookLiberation/ProcessorAutomationController.cs +++ b/LibationWinForms/UNTESTED/BookLiberation/ProcessorAutomationController.cs @@ -10,6 +10,8 @@ namespace LibationWinForms.BookLiberation { public static async Task BackupSingleBookAsync(string productId, EventHandler completedAction = null) { + Serilog.Log.Information("Begin " + nameof(BackupSingleBookAsync) + " {@DebugInfo}", new { productId }); + var backupBook = getWiredUpBackupBook(completedAction); var automatedBackupsForm = attachToBackupsForm(backupBook); @@ -20,6 +22,8 @@ namespace LibationWinForms.BookLiberation public static async Task BackupAllBooksAsync(EventHandler completedAction = null) { + Serilog.Log.Information("Begin " + nameof(BackupAllBooksAsync)); + var backupBook = getWiredUpBackupBook(completedAction); var automatedBackupsForm = attachToBackupsForm(backupBook); @@ -96,6 +100,8 @@ namespace LibationWinForms.BookLiberation public static async Task BackupAllPdfsAsync(EventHandler completedAction = null) { + Serilog.Log.Information("Begin " + nameof(BackupAllPdfsAsync)); + var downloadPdf = getWiredUpDownloadPdf(completedAction); var automatedBackupsForm = attachToBackupsForm(downloadPdf);