Skip to content

Commit

Permalink
Update AAXClean
Browse files Browse the repository at this point in the history
  • Loading branch information
Mbucari committed Aug 28, 2023
1 parent f86c77a commit 42a93bf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Source/AaxDecrypter/AaxDecrypter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AAXClean.Codecs" Version="1.1.0" />
<PackageReference Include="AAXClean.Codecs" Version="1.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions Source/FileLiberator/ConvertToMp3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public override async Task<StatusHandler> ProcessAsync(LibraryBook libraryBook)
config.LameMatchSourceBR,
chapters);

if (m4bBook.AppleTags.Tracks is (int trackNum, int trackCount))
{
lameConfig.ID3.Track = trackCount > 0 ? $"{trackNum}/{trackCount}" : trackNum.ToString();
}

using var mp3File = File.Open(Path.GetTempFileName(), FileMode.OpenOrCreate, FileAccess.ReadWrite);
try
{
Expand Down
14 changes: 6 additions & 8 deletions Source/LibationFileManager/AudibleFileStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,19 @@ public void Refresh()

try
{
using var fileStream = File.OpenRead(path);

if (format is OutputFormat.M4b)
{
var mp4File = await Task.Run(() => new AAXClean.Mp4File(fileStream), cancellationToken);
var tags = await Task.Run(() => AAXClean.AppleTags.FromFile(path));

if (mp4File?.AppleTags?.Asin is not null)
audioFile = new FilePathCache.CacheEntry(mp4File.AppleTags.Asin, FileType.Audio, path);
if (tags?.Asin is not null)
audioFile = new FilePathCache.CacheEntry(tags.Asin, FileType.Audio, path);
}
else
{
var id3 = NAudio.Lame.ID3.Id3Tag.Create(fileStream);
using var fileStream = File.OpenRead(path);
var id3 = await Task.Run(() => NAudio.Lame.ID3.Id3Tag.Create(fileStream));

var asin
= id3?.Children
var asin = id3?.Children
.OfType<NAudio.Lame.ID3.TXXXFrame>()
.FirstOrDefault(f => f.FieldName == "AUDIBLE_ASIN")
?.FieldValue;
Expand Down
16 changes: 0 additions & 16 deletions Source/LibationUiBase/GridView/GridContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,4 @@ public ITemplateEditor CreateTemplateEditor<T>(LibraryBook libraryBook, string e

return TemplateEditor<T>.CreateFilenameEditor(Configuration.Instance.Books, existingTemplate, folderDto, fileDto);
}


}
class Command : ICommand
{
public event EventHandler CanExecuteChanged;

public bool CanExecute(object parameter)
{
throw new NotImplementedException();
}

public void Execute(object parameter)
{
throw new NotImplementedException();
}
}

0 comments on commit 42a93bf

Please sign in to comment.