Added AtomicParsley back in because ffmpeg cover art wasn't working.

This commit is contained in:
Michael Bucari-Tovo 2021-06-24 17:53:09 -06:00
parent 81d0f87b8a
commit 06549e5b4e
4 changed files with 36 additions and 26 deletions

View File

@ -29,9 +29,10 @@ namespace FileLiberator.AaxcDownloadDecrypt
{
bool Step1_CreateDir();
bool Step2_DownloadAndCombine();
bool Step3_CreateCue();
bool Step4_CreateNfo();
bool Step5_Cleanup();
bool Step3_InsertCoverArt();
bool Step4_CreateCue();
bool Step5_CreateNfo();
bool Step6_Cleanup();
}
class AaxcDownloadConverter : IAdvancedAaxcToM4bConverter
{
@ -71,9 +72,10 @@ namespace FileLiberator.AaxcDownloadDecrypt
["Step 1: Create Dir"] = Step1_CreateDir,
["Step 2: Download and Combine Audiobook"] = Step2_DownloadAndCombine,
["Step 3 Create Cue"] = Step3_CreateCue,
["Step 4 Create Nfo"] = Step4_CreateNfo,
["Step 5: Cleanup"] = Step5_Cleanup,
["Step 3 Insert Cover Art"] = Step3_InsertCoverArt,
["Step 4 Create Cue"] = Step4_CreateCue,
["Step 5 Create Nfo"] = Step5_CreateNfo,
["Step 6: Cleanup"] = Step6_Cleanup,
};
downloadLicense = dlLic;
@ -135,8 +137,6 @@ namespace FileLiberator.AaxcDownloadDecrypt
public bool Step2_DownloadAndCombine()
{
File.WriteAllBytes(coverArtPath, tags.coverArt);
var ffmpegTags = tags.GenerateFfmpegTags();
var ffmpegChapters = GenerateFfmpegChapters(chapters);
@ -152,7 +152,6 @@ namespace FileLiberator.AaxcDownloadDecrypt
Resources.UserAgent,
downloadLicense.AudibleKey,
downloadLicense.AudibleIV,
coverArtPath,
metadataPath,
outputFileName)
.GetAwaiter()
@ -177,21 +176,37 @@ namespace FileLiberator.AaxcDownloadDecrypt
return stringBuilder.ToString();
}
public bool Step3_CreateCue()
public bool Step3_InsertCoverArt()
{
File.WriteAllBytes(coverArtPath, tags.coverArt);
var insertCoverArtInfo = new System.Diagnostics.ProcessStartInfo
{
FileName = DecryptSupportLibraries.atomicParsleyPath,
Arguments = "\"" + outputFileName + "\" --encodingTool \"" + AppName + "\" --artwork \"" + coverArtPath + "\" --overWrite"
};
insertCoverArtInfo.RunHidden();
// delete temp file
FileExt.SafeDelete(coverArtPath);
return true;
}
public bool Step4_CreateCue()
{
File.WriteAllText(PathLib.ReplaceExtension(outputFileName, ".cue"), Cue.CreateContents(Path.GetFileName(outputFileName), chapters));
return true;
}
public bool Step4_CreateNfo()
public bool Step5_CreateNfo()
{
File.WriteAllText(PathLib.ReplaceExtension(outputFileName, ".nfo"), NFO.CreateContents(AppName, tags, chapters));
return true;
}
public bool Step5_Cleanup()
public bool Step6_Cleanup()
{
FileExt.SafeDelete(coverArtPath);
FileExt.SafeDelete(metadataPath);
return true;
}

View File

@ -32,7 +32,7 @@ namespace FileLiberator.AaxcDownloadDecrypt
FFMpegPath = ffmpegPath;
}
public async Task ProcessBook(string aaxcUrl, string userAgent, string audibleKey, string audibleIV, string artworkPath, string metadataPath, string outputFile)
public async Task ProcessBook(string aaxcUrl, string userAgent, string audibleKey, string audibleIV, string metadataPath, string outputFile)
{
//This process gets the aaxc from the url and streams the decrypted
//aac stream to standard output
@ -45,7 +45,7 @@ namespace FileLiberator.AaxcDownloadDecrypt
// it into an m4b along with the cover art and metadata.
var remuxer = new Process
{
StartInfo = getRemuxerStartInfo(artworkPath, metadataPath, outputFile)
StartInfo = getRemuxerStartInfo(metadataPath, outputFile)
};
IsRunning = true;
@ -156,7 +156,7 @@ namespace FileLiberator.AaxcDownloadDecrypt
}
};
private ProcessStartInfo getRemuxerStartInfo(string artworkPath, string metadataPath, string outputFile) =>
private ProcessStartInfo getRemuxerStartInfo(string metadataPath, string outputFile) =>
new ProcessStartInfo
{
FileName = FFMpegPath,
@ -176,21 +176,13 @@ namespace FileLiberator.AaxcDownloadDecrypt
"-i",
"pipe:", //input from standard input
"-i",
artworkPath,
"-i",
metadataPath,
"-map",
"0",
"-map",
"1",
"-map_metadata",
"2",
"1",
"-c", //codec copy
"copy",
"-c:v:1", //video codec from file [1] (artwork)
"png", //video codec
"-disposition:v:1",
"attached_pic",
"copy",
"-f", //force output format: mp4
"mp4",
outputFile,

Binary file not shown.

View File

@ -20,6 +20,9 @@
</ItemGroup>
<ItemGroup>
<None Update="DecryptLib\AtomicParsley.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="DecryptLib\avcodec-58.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>