Removed obsolete assembly reference and minor refactoring.
This commit is contained in:
parent
bc3aa29175
commit
d6b62c0521
@ -8,12 +8,6 @@
|
|||||||
<PackageReference Include="TagLibSharp" Version="2.2.0" />
|
<PackageReference Include="TagLibSharp" Version="2.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="taglib-sharp">
|
|
||||||
<HintPath>lib\taglib-sharp.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Dinah.Core\Dinah.Core\Dinah.Core.csproj" />
|
<ProjectReference Include="..\..\Dinah.Core\Dinah.Core\Dinah.Core.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@ -11,26 +11,23 @@ namespace AaxDecrypter
|
|||||||
+ aaxcTagLib.Properties.Duration.Minutes + " minutes, "
|
+ aaxcTagLib.Properties.Duration.Minutes + " minutes, "
|
||||||
+ aaxcTagLib.Properties.Duration.Seconds + " seconds";
|
+ aaxcTagLib.Properties.Duration.Seconds + " seconds";
|
||||||
|
|
||||||
var header
|
var nfoString
|
||||||
= "General Information\r\n"
|
= "General Information\r\n"
|
||||||
+ "===================\r\n"
|
+ "======================\r\n"
|
||||||
+ $" Title: {aaxcTagLib.TitleSansUnabridged ?? "[unknown]"}\r\n"
|
+ $" Title: {aaxcTagLib.TitleSansUnabridged ?? "[unknown]"}\r\n"
|
||||||
+ $" Author: {aaxcTagLib.FirstAuthor ?? "[unknown]"}\r\n"
|
+ $" Author: {aaxcTagLib.FirstAuthor ?? "[unknown]"}\r\n"
|
||||||
+ $" Read By: {aaxcTagLib.Narrator ?? "[unknown]"}\r\n"
|
+ $" Read By: {aaxcTagLib.Narrator ?? "[unknown]"}\r\n"
|
||||||
+ $" Release Date: {aaxcTagLib.ReleaseDate ?? "[unknown]"}\r\n"
|
+ $" Release Date: {aaxcTagLib.ReleaseDate ?? "[unknown]"}\r\n"
|
||||||
+ $" Book Copyright: {aaxcTagLib.BookCopyright ?? "[unknown]"}\r\n"
|
+ $" Book Copyright: {aaxcTagLib.BookCopyright ?? "[unknown]"}\r\n"
|
||||||
+ $" Recording Copyright: {aaxcTagLib.RecordingCopyright ?? "[unknown]"}\r\n"
|
+ $" Recording Copyright: {aaxcTagLib.RecordingCopyright ?? "[unknown]"}\r\n"
|
||||||
+ $" Genre: {aaxcTagLib.AppleTags.FirstGenre ?? "[unknown]"}\r\n";
|
+ $" Genre: {aaxcTagLib.AppleTags.FirstGenre ?? "[unknown]"}\r\n"
|
||||||
|
|
||||||
var s
|
|
||||||
= header
|
|
||||||
+ $" Publisher: {aaxcTagLib.Publisher ?? "[unknown]"}\r\n"
|
+ $" Publisher: {aaxcTagLib.Publisher ?? "[unknown]"}\r\n"
|
||||||
+ $" Duration: {myDuration}\r\n"
|
+ $" Duration: {myDuration}\r\n"
|
||||||
+ $" Chapters: {chapters.Count}\r\n"
|
+ $" Chapters: {chapters.Count}\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
+ "Media Information\r\n"
|
+ "Media Information\r\n"
|
||||||
+ "=================\r\n"
|
+ "======================\r\n"
|
||||||
+ " Source Format: Audible AAX\r\n"
|
+ " Source Format: Audible AAX\r\n"
|
||||||
+ $" Source Sample Rate: {aaxcTagLib.Properties.AudioSampleRate} Hz\r\n"
|
+ $" Source Sample Rate: {aaxcTagLib.Properties.AudioSampleRate} Hz\r\n"
|
||||||
+ $" Source Channels: {aaxcTagLib.Properties.AudioChannels}\r\n"
|
+ $" Source Channels: {aaxcTagLib.Properties.AudioChannels}\r\n"
|
||||||
@ -49,7 +46,7 @@ namespace AaxDecrypter
|
|||||||
+ "================\r\n"
|
+ "================\r\n"
|
||||||
+ (!string.IsNullOrWhiteSpace(aaxcTagLib.LongDescription) ? aaxcTagLib.LongDescription : aaxcTagLib.Comment);
|
+ (!string.IsNullOrWhiteSpace(aaxcTagLib.LongDescription) ? aaxcTagLib.LongDescription : aaxcTagLib.Comment);
|
||||||
|
|
||||||
return s;
|
return nfoString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using TagLib;
|
using TagLib;
|
||||||
using TagLib.Mpeg4;
|
using TagLib.Mpeg4;
|
||||||
|
|
||||||
@ -41,38 +37,39 @@ namespace AaxDecrypter
|
|||||||
|
|
||||||
Comment = AppleTags.Comment is not null ? unicodeToAscii(AppleTags.Comment) : default;
|
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();
|
Authors = AppleTags.Performers.Select(author => unicodeToAscii(author)).ToArray();
|
||||||
|
|
||||||
FirstAuthor = Authors?.Length > 0 ? Authors[0] : default;
|
FirstAuthor = Authors?.Length > 0 ? Authors[0] : default;
|
||||||
|
|
||||||
string[] text = AppleTags.GetText(publisherType);
|
string[] text = AppleTags.GetText(publisherType);
|
||||||
Publisher = text.Length == 0 ? null : text[0];
|
Publisher = text.Length == 0 ? default : text[0];
|
||||||
|
|
||||||
text = AppleTags.GetText("rldt");
|
text = AppleTags.GetText("rldt");
|
||||||
ReleaseDate = text.Length == 0 ? null : text[0];
|
ReleaseDate = text.Length == 0 ? default : text[0];
|
||||||
|
|
||||||
text = AppleTags.GetText(descriptionType);
|
text = AppleTags.GetText(descriptionType);
|
||||||
LongDescription = text.Length == 0 ? null : unicodeToAscii(text[0]);
|
LongDescription = text.Length == 0 ? default : unicodeToAscii(text[0]);
|
||||||
|
|
||||||
text = AppleTags.GetText(naratorType);
|
text = AppleTags.GetText(naratorType);
|
||||||
Narrator = text.Length == 0 ? null : unicodeToAscii(text[0]);
|
Narrator = text.Length == 0 ? default : unicodeToAscii(text[0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AaxcTagLibFile(string path)
|
public AaxcTagLibFile(string path)
|
||||||
: this(new LocalFileAbstraction(path))
|
: this(new LocalFileAbstraction(path))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sourceFile">File from which tags will be coppied.</param>
|
||||||
public void CopyTagsFrom(AaxcTagLibFile sourceFile)
|
public void CopyTagsFrom(AaxcTagLibFile sourceFile)
|
||||||
{
|
{
|
||||||
AppleTags.Clear();
|
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)
|
foreach (var stag in sourceFile.AppleTags)
|
||||||
{
|
{
|
||||||
AppleTags.SetData(stag.BoxType, stag.Children.Cast<AppleDataBox>().ToArray());
|
AppleTags.SetData(stag.BoxType, stag.Children.Cast<AppleDataBox>().ToArray());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user