Change back.
This commit is contained in:
parent
673451dc11
commit
4ceb4f9c03
@ -47,10 +47,12 @@ namespace FileLiberator
|
|||||||
return new StatusHandler { "Decrypt failed" };
|
return new StatusHandler { "Decrypt failed" };
|
||||||
|
|
||||||
// moves files and returns dest dir
|
// moves files and returns dest dir
|
||||||
_ = moveFilesToBooksDir(libraryBook.Book, outputAudioFilename);
|
var moveResults = MoveFilesToBooksDir(libraryBook.Book, outputAudioFilename);
|
||||||
|
|
||||||
// only need to update if success. if failure, it will remain at 0 == NotLiberated
|
if (!moveResults.movedAudioFile)
|
||||||
ApplicationServices.LibraryCommands.UpdateBook(libraryBook, LiberatedStatus.Liberated);
|
return new StatusHandler { "Cannot find final audio file after decryption" };
|
||||||
|
|
||||||
|
libraryBook.Book.UserDefinedItem.BookStatus = LiberatedStatus.Liberated;
|
||||||
|
|
||||||
return new StatusHandler();
|
return new StatusHandler();
|
||||||
}
|
}
|
||||||
@ -143,7 +145,7 @@ namespace FileLiberator
|
|||||||
NarratorsDiscovered?.Invoke(this, e.Narrator ?? "[unknown]");
|
NarratorsDiscovered?.Invoke(this, e.Narrator ?? "[unknown]");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string moveFilesToBooksDir(Book product, string outputAudioFilename)
|
private static (string destinationDir, bool movedAudioFile) MoveFilesToBooksDir(Book product, string outputAudioFilename)
|
||||||
{
|
{
|
||||||
// create final directory. move each file into it. MOVE AUDIO FILE LAST
|
// create final directory. move each file into it. MOVE AUDIO FILE LAST
|
||||||
// new dir: safetitle_limit50char + " [" + productId + "]"
|
// new dir: safetitle_limit50char + " [" + productId + "]"
|
||||||
@ -158,6 +160,7 @@ namespace FileLiberator
|
|||||||
// audio filename: safetitle_limit50char + " [" + productId + "]." + audio_ext
|
// audio filename: safetitle_limit50char + " [" + productId + "]." + audio_ext
|
||||||
var audioFileName = FileUtility.GetValidFilename(destinationDir, product.Title, musicFileExt, product.AudibleProductId);
|
var audioFileName = FileUtility.GetValidFilename(destinationDir, product.Title, musicFileExt, product.AudibleProductId);
|
||||||
|
|
||||||
|
bool movedAudioFile = false;
|
||||||
foreach (var f in sortedFiles)
|
foreach (var f in sortedFiles)
|
||||||
{
|
{
|
||||||
var dest
|
var dest
|
||||||
@ -170,11 +173,14 @@ namespace FileLiberator
|
|||||||
Cue.UpdateFileName(f, audioFileName);
|
Cue.UpdateFileName(f, audioFileName);
|
||||||
|
|
||||||
File.Move(f.FullName, dest);
|
File.Move(f.FullName, dest);
|
||||||
|
|
||||||
|
movedAudioFile |= AudibleFileStorage.Audio.IsFileTypeMatch(f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AudibleFileStorage.Audio.Refresh();
|
AudibleFileStorage.Audio.Refresh();
|
||||||
|
|
||||||
return destinationDir;
|
return (destinationDir, movedAudioFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<FileInfo> getProductFilesSorted(Book product, string outputAudioFilename)
|
private static List<FileInfo> getProductFilesSorted(Book product, string outputAudioFilename)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user