Minor tag reading improvements.
This commit is contained in:
parent
e958944466
commit
bc3aa29175
@ -5,8 +5,6 @@ namespace AaxDecrypter
|
||||
{
|
||||
public static string CreateContents(string ripper, AaxcTagLibFile aaxcTagLib, ChapterInfo chapters)
|
||||
{
|
||||
var tag = aaxcTagLib.AppleTags;
|
||||
|
||||
var _hours = (int)aaxcTagLib.Properties.Duration.TotalHours;
|
||||
var myDuration
|
||||
= (_hours > 0 ? _hours + " hours, " : string.Empty)
|
||||
@ -21,13 +19,12 @@ namespace AaxDecrypter
|
||||
+ $" 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";
|
||||
if (!string.IsNullOrEmpty(tag.FirstGenre))
|
||||
header += $" Genre: {aaxcTagLib.AppleTags.FirstGenre}\r\n";
|
||||
+ $" Recording Copyright: {aaxcTagLib.RecordingCopyright ?? "[unknown]"}\r\n"
|
||||
+ $" Genre: {aaxcTagLib.AppleTags.FirstGenre ?? "[unknown]"}\r\n";
|
||||
|
||||
var s
|
||||
= header
|
||||
+ $" Publisher: {aaxcTagLib.Publisher ?? string.Empty}\r\n"
|
||||
+ $" Publisher: {aaxcTagLib.Publisher ?? "[unknown]"}\r\n"
|
||||
+ $" Duration: {myDuration}\r\n"
|
||||
+ $" Chapters: {chapters.Count}\r\n"
|
||||
+ "\r\n"
|
||||
@ -50,7 +47,7 @@ namespace AaxDecrypter
|
||||
+ "\r\n"
|
||||
+ "Book Description\r\n"
|
||||
+ "================\r\n"
|
||||
+ (!string.IsNullOrWhiteSpace(aaxcTagLib.LongDescription) ? aaxcTagLib.LongDescription : aaxcTagLib.Tag.Comment);
|
||||
+ (!string.IsNullOrWhiteSpace(aaxcTagLib.LongDescription) ? aaxcTagLib.LongDescription : aaxcTagLib.Comment);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -17,11 +17,11 @@ namespace AaxDecrypter
|
||||
private static ReadOnlyByteVector descriptionType = new ReadOnlyByteVector(0xa9, (byte)'d', (byte)'e', (byte)'s');
|
||||
private static ReadOnlyByteVector publisherType = new ReadOnlyByteVector(0xa9, (byte)'p', (byte)'u', (byte)'b');
|
||||
public string Narrator { get; }
|
||||
public string Comment { get; }
|
||||
public string LongDescription { get; }
|
||||
public string ReleaseDate { get; }
|
||||
public string Publisher { get; }
|
||||
//TagLib uses @ART, which is the Artist tag
|
||||
public string[] Authors => AppleTags.Performers;
|
||||
public string[] Authors { get; }
|
||||
public string FirstAuthor { get; }
|
||||
public string TitleSansUnabridged { get; }
|
||||
public string BookCopyright { get; }
|
||||
@ -39,7 +39,12 @@ namespace AaxDecrypter
|
||||
|
||||
TitleSansUnabridged = AppleTags.Title?.Replace(" (Unabridged)", "");
|
||||
|
||||
FirstAuthor = Authors?.Length > 0 ? unicodeToAscii(Authors[0]) : default;
|
||||
Comment = AppleTags.Comment is not null ? unicodeToAscii(AppleTags.Comment) : default;
|
||||
|
||||
//TagLib uses @ART, 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];
|
||||
@ -55,9 +60,11 @@ namespace AaxDecrypter
|
||||
|
||||
}
|
||||
|
||||
public AaxcTagLibFile(string path) : this(new LocalFileAbstraction(path))
|
||||
public AaxcTagLibFile(string path)
|
||||
: this(new LocalFileAbstraction(path))
|
||||
{
|
||||
}
|
||||
|
||||
public void CopyTagsFrom(AaxcTagLibFile sourceFile)
|
||||
{
|
||||
AppleTags.Clear();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user