diff --git a/AaxDecrypter/AaxDecrypter.csproj b/AaxDecrypter/AaxDecrypter.csproj index a7bf3b44..04be65c8 100644 --- a/AaxDecrypter/AaxDecrypter.csproj +++ b/AaxDecrypter/AaxDecrypter.csproj @@ -8,12 +8,6 @@ - - - lib\taglib-sharp.dll - - - diff --git a/AaxDecrypter/NFO.cs b/AaxDecrypter/NFO.cs index 65d3d5b4..9cb3dbb2 100644 --- a/AaxDecrypter/NFO.cs +++ b/AaxDecrypter/NFO.cs @@ -11,26 +11,23 @@ namespace AaxDecrypter + aaxcTagLib.Properties.Duration.Minutes + " minutes, " + aaxcTagLib.Properties.Duration.Seconds + " seconds"; - var header + var nfoString = "General Information\r\n" - + "===================\r\n" + + "======================\r\n" + $" Title: {aaxcTagLib.TitleSansUnabridged ?? "[unknown]"}\r\n" + $" Author: {aaxcTagLib.FirstAuthor ?? "[unknown]"}\r\n" + $" Read By: {aaxcTagLib.Narrator ?? "[unknown]"}\r\n" + $" Release Date: {aaxcTagLib.ReleaseDate ?? "[unknown]"}\r\n" + $" Book Copyright: {aaxcTagLib.BookCopyright ?? "[unknown]"}\r\n" + $" Recording Copyright: {aaxcTagLib.RecordingCopyright ?? "[unknown]"}\r\n" - + $" Genre: {aaxcTagLib.AppleTags.FirstGenre ?? "[unknown]"}\r\n"; - - var s - = header + + $" Genre: {aaxcTagLib.AppleTags.FirstGenre ?? "[unknown]"}\r\n" + $" Publisher: {aaxcTagLib.Publisher ?? "[unknown]"}\r\n" + $" Duration: {myDuration}\r\n" + $" Chapters: {chapters.Count}\r\n" + "\r\n" + "\r\n" + "Media Information\r\n" - + "=================\r\n" + + "======================\r\n" + " Source Format: Audible AAX\r\n" + $" Source Sample Rate: {aaxcTagLib.Properties.AudioSampleRate} Hz\r\n" + $" Source Channels: {aaxcTagLib.Properties.AudioChannels}\r\n" @@ -49,7 +46,7 @@ namespace AaxDecrypter + "================\r\n" + (!string.IsNullOrWhiteSpace(aaxcTagLib.LongDescription) ? aaxcTagLib.LongDescription : aaxcTagLib.Comment); - return s; + return nfoString; } } } diff --git a/AaxDecrypter/TagLibMpeg4Ex.cs b/AaxDecrypter/TagLibMpeg4Ex.cs index 70c18e88..8194ecce 100644 --- a/AaxDecrypter/TagLibMpeg4Ex.cs +++ b/AaxDecrypter/TagLibMpeg4Ex.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Linq; using System.Text.RegularExpressions; -using System.Threading.Tasks; using TagLib; using TagLib.Mpeg4; @@ -41,38 +37,39 @@ namespace AaxDecrypter Comment = AppleTags.Comment is not null ? unicodeToAscii(AppleTags.Comment) : default; - //TagLib uses @ART, which is the Artist tag + //TagLib uses @ART ID for Performers, which is the Artist tag Authors = AppleTags.Performers.Select(author => unicodeToAscii(author)).ToArray(); FirstAuthor = Authors?.Length > 0 ? Authors[0] : default; string[] text = AppleTags.GetText(publisherType); - Publisher = text.Length == 0 ? null : text[0]; + Publisher = text.Length == 0 ? default : text[0]; text = AppleTags.GetText("rldt"); - ReleaseDate = text.Length == 0 ? null : text[0]; + ReleaseDate = text.Length == 0 ? default : text[0]; text = AppleTags.GetText(descriptionType); - LongDescription = text.Length == 0 ? null : unicodeToAscii(text[0]); + LongDescription = text.Length == 0 ? default : unicodeToAscii(text[0]); text = AppleTags.GetText(naratorType); - Narrator = text.Length == 0 ? null : unicodeToAscii(text[0]); - + Narrator = text.Length == 0 ? default : unicodeToAscii(text[0]); } public AaxcTagLibFile(string path) : this(new LocalFileAbstraction(path)) { } - + /// + /// Copy all metadata fields in the source file, even those that TagLib doesn't + /// recognize, to the output file. + /// NOTE: Chapters aren't stored in MPEG-4 metadata. They are encoded as a Timed + /// Text Stream (MPEG-4 Part 17), so taglib doesn't read or write them. + /// + /// File from which tags will be coppied. public void CopyTagsFrom(AaxcTagLibFile sourceFile) { AppleTags.Clear(); - //copy all metadata fields in the source file, even those that TagLib doesn't - //recognize, to the output file. - //NOTE: Chapters aren't stored in MPEG-4 metadata. They are encoded as a Timed - //Text Stream (MPEG-4 Part 17), so taglib doesn't read or write them. foreach (var stag in sourceFile.AppleTags) { AppleTags.SetData(stag.BoxType, stag.Children.Cast().ToArray());