Typos and minor corrections.

This commit is contained in:
Michael Bucari-Tovo 2021-06-24 21:49:52 -06:00
parent 1b80f2ed28
commit 0475bd48b1
3 changed files with 10 additions and 15 deletions

View File

@ -14,9 +14,7 @@ namespace FileLiberator.AaxcDownloadDecrypt
public interface ISimpleAaxToM4bConverter2 public interface ISimpleAaxToM4bConverter2
{ {
event EventHandler<int> DecryptProgressUpdate; event EventHandler<int> DecryptProgressUpdate;
bool Run(); bool Run();
string AppName { get; set; } string AppName { get; set; }
string outDir { get; } string outDir { get; }
string outputFileName { get; } string outputFileName { get; }
@ -162,7 +160,7 @@ namespace FileLiberator.AaxcDownloadDecrypt
private void AaxcProcesser_ProgressUpdate(object sender, TimeSpan e) private void AaxcProcesser_ProgressUpdate(object sender, TimeSpan e)
{ {
double progressPercent = Math.Max(100 * e.TotalSeconds / tags.duration.TotalSeconds, 1); double progressPercent = 100 * e.TotalSeconds / tags.duration.TotalSeconds;
DecryptProgressUpdate?.Invoke(this, (int)progressPercent); DecryptProgressUpdate?.Invoke(this, (int)progressPercent);
} }
@ -185,7 +183,6 @@ namespace FileLiberator.AaxcDownloadDecrypt
public bool Step3_InsertCoverArt() public bool Step3_InsertCoverArt()
{ {
File.WriteAllBytes(coverArtPath, tags.coverArt); File.WriteAllBytes(coverArtPath, tags.coverArt);
var insertCoverArtInfo = new System.Diagnostics.ProcessStartInfo var insertCoverArtInfo = new System.Diagnostics.ProcessStartInfo

View File

@ -8,13 +8,13 @@ namespace FileLiberator.AaxcDownloadDecrypt
{ {
/// <summary> /// <summary>
/// Download audible aaxc, decrypt, remux, add metadata, and insert cover art. /// Download audible aaxc, decrypt, remux,and add metadata.
/// </summary> /// </summary>
class FFMpegAaxcProcesser class FFMpegAaxcProcesser
{ {
public event EventHandler<TimeSpan> ProgressUpdate; public event EventHandler<TimeSpan> ProgressUpdate;
public string FFMpegPath { get; } public string FFMpegPath { get; }
public bool IsRunning { get; set; } = false; public bool IsRunning { get; private set; }
public bool Succeeded { get; private set; } public bool Succeeded { get; private set; }
@ -57,16 +57,14 @@ namespace FileLiberator.AaxcDownloadDecrypt
byte[] buffer = new byte[16 * 1024]; byte[] buffer = new byte[16 * 1024];
//All the work done here. Copy download standard output into //All the work done here. Copy download standard output into
//remuxer standard input //remuxer standard input
await Task.Run(() => do
{ {
do lastRead = await pipedOutput.ReadAsync(buffer, 0, buffer.Length);
{ await pipedInput.WriteAsync(buffer, 0, lastRead);
lastRead = pipedOutput.Read(buffer, 0, buffer.Length); } while (lastRead > 0 && !remuxer.HasExited);
pipedInput.Write(buffer, 0, lastRead);
} while (lastRead > 0 && !remuxer.HasExited);
});
pipedInput.Close(); pipedInput.Close();

View File

@ -85,7 +85,7 @@ namespace FileLiberator.AaxcDownloadDecrypt
} }
public override int Read(byte[] buffer, int offset, int count) public override int Read(byte[] buffer, int offset, int count)
{ {
long requiredLength = Position + offset + count; long requiredLength = Position + count;
if (requiredLength > networkBytesRead) if (requiredLength > networkBytesRead)
readWebFileToPosition(requiredLength); readWebFileToPosition(requiredLength);
@ -112,7 +112,7 @@ namespace FileLiberator.AaxcDownloadDecrypt
/// <summary> /// <summary>
/// Read more data from <see cref="_networkStream"/> into <see cref="_fileBacker"/> as needed. /// Read more data from <see cref="_networkStream"/> into <see cref="_fileBacker"/> as needed.
/// </summary> /// </summary>
/// <param name="requiredLength"></param> /// <param name="requiredLength">Length of strem required for the operation.</param>
private void readWebFileToPosition(long requiredLength) private void readWebFileToPosition(long requiredLength)
{ {
byte[] buff = new byte[BUFF_SZ]; byte[] buff = new byte[BUFF_SZ];