Add logging and error handling to Process Queue. and Processables

This commit is contained in:
Michael Bucari-Tovo 2022-06-23 15:38:39 -06:00
parent 9ff2a83ba3
commit 314f4850bc
7 changed files with 264 additions and 137 deletions

View file

@ -43,7 +43,7 @@ namespace FileLiberator
var proposedMp3Path = Mp3FileName(m4bPath);
if (File.Exists(proposedMp3Path) || !File.Exists(m4bPath)) continue;
m4bBook = new Mp4File(m4bPath, FileAccess.Read);
m4bBook = await Task.Run(() => new Mp4File(m4bPath, FileAccess.Read));
m4bBook.ConversionProgressUpdate += M4bBook_ConversionProgressUpdate;
fileSize = m4bBook.InputStream.Length;
@ -55,7 +55,7 @@ namespace FileLiberator
using var mp3File = File.OpenWrite(Path.GetTempFileName());
var lameConfig = GetLameOptions(Configuration.Instance);
var result = await Task.Run(() => m4bBook.ConvertToMp3(mp3File, lameConfig));
var result = await m4bBook.ConvertToMp3Async(mp3File, lameConfig);
m4bBook.InputStream.Close();
mp3File.Close();

View file

@ -130,7 +130,7 @@ namespace FileLiberator
abDownloader.FileCreated += (_, path) => OnFileCreated(libraryBook, path);
// REAL WORK DONE HERE
var success = await Task.Run(abDownloader.Run);
var success = await abDownloader.RunAsync();
return success;
}