Better naming.

This commit is contained in:
Michael Bucari-Tovo 2021-09-23 18:05:45 -06:00
parent 9f09a62a1e
commit df42ba584e
4 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@ using System.IO;
namespace AaxDecrypter
{
public class AaxcDownloadConverter : AudioDownloadBase
public class AaxcDownloadConverter : AudiobookDownloadBase
{
protected override StepSequence steps { get; }

View File

@ -13,7 +13,7 @@ namespace AaxDecrypter
{
public enum OutputFormat { M4b, Mp3 }
public abstract class AudioDownloadBase
public abstract class AudiobookDownloadBase
{
public event EventHandler<string> RetrievedTitle;
public event EventHandler<string> RetrievedAuthors;
@ -37,7 +37,7 @@ namespace AaxDecrypter
private string jsonDownloadState => Path.Combine(cacheDir, Path.GetFileNameWithoutExtension(outputFileName) + ".json");
private string tempFile => PathLib.ReplaceExtension(jsonDownloadState, ".tmp");
public AudioDownloadBase(string outFileName, string cacheDirectory, DownloadLicense dlLic)
public AudiobookDownloadBase(string outFileName, string cacheDirectory, DownloadLicense dlLic)
{
AppName = GetType().Name;

View File

@ -8,11 +8,11 @@ using System.Threading;
namespace AaxDecrypter
{
public class Mp3Downloader : AudioDownloadBase
public class Mp3AudiobookDownloader : AudiobookDownloadBase
{
protected override StepSequence steps { get; }
public Mp3Downloader(string outFileName, string cacheDirectory, DownloadLicense dlLic)
public Mp3AudiobookDownloader(string outFileName, string cacheDirectory, DownloadLicense dlLic)
: base(outFileName, cacheDirectory, dlLic)
{

View File

@ -15,7 +15,7 @@ namespace FileLiberator
{
public class DownloadDecryptBook : IAudioDecodable
{
private AudioDownloadBase aaxcDownloader;
private AudiobookDownloadBase aaxcDownloader;
public event EventHandler<TimeSpan> StreamingTimeRemaining;
public event EventHandler<Action<byte[]>> RequestCoverArt;
@ -54,7 +54,7 @@ namespace FileLiberator
if (libraryBook.Book.Audio_Exists)
return new StatusHandler { "Cannot find decrypt. Final audio file already exists" };
var outputAudioFilename = await aaxToM4bConverterDecryptAsync(AudibleFileStorage.DownloadsInProgress, AudibleFileStorage.DecryptInProgress, libraryBook);
var outputAudioFilename = await downloadAudiobookAsync(AudibleFileStorage.DownloadsInProgress, AudibleFileStorage.DecryptInProgress, libraryBook);
// decrypt failed
if (outputAudioFilename is null)
@ -76,7 +76,7 @@ namespace FileLiberator
}
}
private async Task<string> aaxToM4bConverterDecryptAsync(string cacheDir, string destinationDir, LibraryBook libraryBook)
private async Task<string> downloadAudiobookAsync(string cacheDir, string destinationDir, LibraryBook libraryBook)
{
StreamingBegin?.Invoke(this, $"Begin decrypting {libraryBook}");
@ -112,7 +112,7 @@ namespace FileLiberator
var outFileName = Path.Combine(destinationDir, $"{PathLib.ToPathSafeString(libraryBook.Book.Title)} [{libraryBook.Book.AudibleProductId}].{outputFormat.ToString().ToLower()}");
aaxcDownloader = contentLic.DrmType == AudibleApi.Common.DrmType.Adrm ? new AaxcDownloadConverter(outFileName, cacheDir, aaxcDecryptDlLic, outputFormat) { AppName = "Libation" } : new Mp3Downloader(outFileName, cacheDir, aaxcDecryptDlLic);
aaxcDownloader = contentLic.DrmType == AudibleApi.Common.DrmType.Adrm ? new AaxcDownloadConverter(outFileName, cacheDir, aaxcDecryptDlLic, outputFormat) { AppName = "Libation" } : new Mp3AudiobookDownloader(outFileName, cacheDir, aaxcDecryptDlLic);
aaxcDownloader.DecryptProgressUpdate += (s, progress) => StreamingProgressChanged?.Invoke(this, progress);
aaxcDownloader.DecryptTimeRemaining += (s, remaining) => StreamingTimeRemaining?.Invoke(this, remaining);
aaxcDownloader.RetrievedTitle += (s, title) => TitleDiscovered?.Invoke(this, title);