Added m4b & mp3 methods for multiple files.
This commit is contained in:
parent
8a74a29700
commit
13294d3414
@ -102,8 +102,33 @@ namespace AaxDecrypter
|
|||||||
aaxFile.SetDecryptionKey(downloadLicense.AudibleKey, downloadLicense.AudibleIV);
|
aaxFile.SetDecryptionKey(downloadLicense.AudibleKey, downloadLicense.AudibleIV);
|
||||||
|
|
||||||
aaxFile.ConversionProgressUpdate += AaxFile_ConversionProgressUpdate;
|
aaxFile.ConversionProgressUpdate += AaxFile_ConversionProgressUpdate;
|
||||||
|
if(OutputFormat == OutputFormat.M4b)
|
||||||
|
ConvertToMultiMp4b();
|
||||||
|
else
|
||||||
|
ConvertToMultiMp3();
|
||||||
|
aaxFile.ConversionProgressUpdate -= AaxFile_ConversionProgressUpdate;
|
||||||
|
|
||||||
|
aaxFile.Close();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConvertToMultiMp4b()
|
||||||
|
{
|
||||||
|
var chapterCount = 0;
|
||||||
|
aaxFile.ConvertToMultiMp4a(downloadLicense.ChapterInfo, newSplitCallback =>
|
||||||
|
{
|
||||||
|
chapterCount++;
|
||||||
|
var fileName = Path.ChangeExtension(outputFileName, $"{chapterCount}.m4b");
|
||||||
|
if (File.Exists(fileName))
|
||||||
|
FileExt.SafeDelete(fileName);
|
||||||
|
newSplitCallback.OutputFile = File.Open(fileName, FileMode.OpenOrCreate);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConvertToMultiMp3()
|
||||||
|
{
|
||||||
var chapterCount = 0;
|
var chapterCount = 0;
|
||||||
//TODO make this work with m4b files
|
|
||||||
aaxFile.ConvertToMultiMp3(downloadLicense.ChapterInfo, newSplitCallback =>
|
aaxFile.ConvertToMultiMp3(downloadLicense.ChapterInfo, newSplitCallback =>
|
||||||
{
|
{
|
||||||
chapterCount++;
|
chapterCount++;
|
||||||
@ -111,24 +136,8 @@ namespace AaxDecrypter
|
|||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
FileExt.SafeDelete(fileName);
|
FileExt.SafeDelete(fileName);
|
||||||
newSplitCallback.OutputFile = File.Open(fileName, FileMode.OpenOrCreate);
|
newSplitCallback.OutputFile = File.Open(fileName, FileMode.OpenOrCreate);
|
||||||
//TODO clean up all this junk
|
newSplitCallback.LameConfig.ID3.Track = chapterCount.ToString();
|
||||||
newSplitCallback.LameConfig = new NAudio.Lame.LameConfig
|
|
||||||
{
|
|
||||||
ID3 = new NAudio.Lame.ID3TagData()
|
|
||||||
{
|
|
||||||
Track = chapterCount.ToString(),
|
|
||||||
Artist = aaxFile.AppleTags.AlbumArtists,
|
|
||||||
Album = aaxFile.AppleTags.Album,
|
|
||||||
Title = aaxFile.AppleTags.Title,
|
|
||||||
Genre = aaxFile.AppleTags.Generes
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
aaxFile.ConversionProgressUpdate -= AaxFile_ConversionProgressUpdate;
|
|
||||||
|
|
||||||
aaxFile.Close();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AaxFile_ConversionProgressUpdate(object sender, ConversionProgressEventArgs e)
|
private void AaxFile_ConversionProgressUpdate(object sender, ConversionProgressEventArgs e)
|
||||||
|
|||||||
@ -140,7 +140,7 @@ namespace FileLiberator
|
|||||||
{
|
{
|
||||||
// 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 + "]"
|
||||||
|
// TODO make this method handle multiple audio files or a single audio file.
|
||||||
var destinationDir = AudibleFileStorage.Audio.GetDestDir(product.Title, product.AudibleProductId);
|
var destinationDir = AudibleFileStorage.Audio.GetDestDir(product.Title, product.AudibleProductId);
|
||||||
Directory.CreateDirectory(destinationDir);
|
Directory.CreateDirectory(destinationDir);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user