Merge pull request #53 from Mbucari/master
Removed Ffmpeg and taglib. Updated AAXClean.
This commit is contained in:
commit
fdcaf5e534
@ -4,43 +4,9 @@
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TagLibSharp" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\AAXClean\AAXClean.csproj" />
|
||||
<ProjectReference Include="..\..\Dinah.Core\Dinah.Core\Dinah.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="DecryptLib\avcodec-58.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="DecryptLib\avdevice-58.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="DecryptLib\avfilter-7.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="DecryptLib\avformat-58.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="DecryptLib\avutil-56.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="DecryptLib\ffmpeg.exe">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="DecryptLib\ffprobe.exe">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="DecryptLib\swresample-3.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="DecryptLib\swscale-5.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -19,7 +19,7 @@ namespace AaxDecrypter
|
||||
string outDir { get; }
|
||||
string outputFileName { get; }
|
||||
DownloadLicense downloadLicense { get; }
|
||||
Mp4File aaxFile { get; }
|
||||
AaxFile aaxFile { get; }
|
||||
byte[] coverArt { get; }
|
||||
void SetCoverArt(byte[] coverArt);
|
||||
void SetOutputFilename(string outFileName);
|
||||
@ -45,7 +45,7 @@ namespace AaxDecrypter
|
||||
public string cacheDir { get; private set; }
|
||||
public string outputFileName { get; private set; }
|
||||
public DownloadLicense downloadLicense { get; private set; }
|
||||
public Mp4File aaxFile { get; private set; }
|
||||
public AaxFile aaxFile { get; private set; }
|
||||
public byte[] coverArt { get; private set; }
|
||||
|
||||
private StepSequence steps { get; }
|
||||
@ -135,23 +135,28 @@ namespace AaxDecrypter
|
||||
//Get metadata from the file over http
|
||||
|
||||
if (File.Exists(jsonDownloadState))
|
||||
{
|
||||
try
|
||||
{
|
||||
nfsPersister = new NetworkFileStreamPersister(jsonDownloadState);
|
||||
//If More thaan ~1 hour has elapsed since getting the download url, it will expire.
|
||||
//The new url will be to the same file.
|
||||
nfsPersister.NetworkFileStream.SetUriForSameFile(new Uri(downloadLicense.DownloadUrl));
|
||||
}
|
||||
catch
|
||||
{
|
||||
FileExt.SafeDelete(jsonDownloadState);
|
||||
FileExt.SafeDelete(tempFile);
|
||||
nfsPersister = NewNetworkFilePersister();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var headers = new System.Net.WebHeaderCollection();
|
||||
headers.Add("User-Agent", downloadLicense.UserAgent);
|
||||
|
||||
NetworkFileStream networkFileStream = new NetworkFileStream(tempFile, new Uri(downloadLicense.DownloadUrl), 0, headers);
|
||||
nfsPersister = new NetworkFileStreamPersister(networkFileStream, jsonDownloadState);
|
||||
nfsPersister = NewNetworkFilePersister();
|
||||
}
|
||||
nfsPersister.NetworkFileStream.BeginDownloading();
|
||||
|
||||
aaxFile = new Mp4File(nfsPersister.NetworkFileStream);
|
||||
aaxFile = new AaxFile(nfsPersister.NetworkFileStream);
|
||||
coverArt = aaxFile.AppleTags.Cover;
|
||||
|
||||
RetrievedTags?.Invoke(this, aaxFile.AppleTags);
|
||||
@ -159,6 +164,14 @@ namespace AaxDecrypter
|
||||
|
||||
return !isCanceled;
|
||||
}
|
||||
private NetworkFileStreamPersister NewNetworkFilePersister()
|
||||
{
|
||||
var headers = new System.Net.WebHeaderCollection();
|
||||
headers.Add("User-Agent", downloadLicense.UserAgent);
|
||||
|
||||
NetworkFileStream networkFileStream = new NetworkFileStream(tempFile, new Uri(downloadLicense.DownloadUrl), 0, headers);
|
||||
return new NetworkFileStreamPersister(networkFileStream, jsonDownloadState);
|
||||
}
|
||||
|
||||
public bool Step3_DownloadAndCombine()
|
||||
{
|
||||
@ -170,7 +183,7 @@ namespace AaxDecrypter
|
||||
FileStream outFile = File.OpenWrite(outputFileName);
|
||||
|
||||
aaxFile.DecryptionProgressUpdate += AaxFile_DecryptionProgressUpdate;
|
||||
var decryptedBook = aaxFile.DecryptAaxc(outFile, downloadLicense.AudibleKey, downloadLicense.AudibleIV, downloadLicense.ChapterInfo);
|
||||
using var decryptedBook = aaxFile.DecryptAaxc(outFile, downloadLicense.AudibleKey, downloadLicense.AudibleIV, downloadLicense.ChapterInfo);
|
||||
aaxFile.DecryptionProgressUpdate -= AaxFile_DecryptionProgressUpdate;
|
||||
|
||||
downloadLicense.ChapterInfo = aaxFile.Chapters;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,16 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace AaxDecrypter
|
||||
{
|
||||
public static class DecryptSupportLibraries
|
||||
{
|
||||
// OTHER EXTERNAL DEPENDENCIES
|
||||
// ffprobe has these pre-req.s as I'm using it:
|
||||
// avcodec-58.dll, avdevice-58.dll, avfilter-7.dll, avformat-58.dll, avutil-56.dll, swresample-3.dll, swscale-5.dll, taglib-sharp.dll
|
||||
|
||||
private static string appPath_ { get; } = Path.GetDirectoryName(Dinah.Core.Exe.FileLocationOnDisk);
|
||||
private static string decryptLib_ { get; } = Path.Combine(appPath_, "DecryptLib");
|
||||
public static string ffmpegPath { get; } = Path.Combine(decryptLib_, "ffmpeg.exe");
|
||||
public static string ffprobePath { get; } = Path.Combine(decryptLib_, "ffprobe.exe");
|
||||
}
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AaxDecrypter
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a <see cref="TagLib.File.IFileAbstraction"/> for a file over Http.
|
||||
/// </summary>
|
||||
class NetworkFileAbstraction : TagLib.File.IFileAbstraction
|
||||
{
|
||||
private NetworkFileStream aaxNetworkStream;
|
||||
|
||||
public NetworkFileAbstraction( NetworkFileStream networkFileStream)
|
||||
{
|
||||
Name = networkFileStream.SaveFilePath;
|
||||
aaxNetworkStream = networkFileStream;
|
||||
}
|
||||
public string Name { get; private set; }
|
||||
|
||||
public Stream ReadStream => aaxNetworkStream;
|
||||
|
||||
public Stream WriteStream => throw new NotImplementedException();
|
||||
|
||||
public void CloseStream(Stream stream)
|
||||
{
|
||||
aaxNetworkStream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user