Skip to content

Commit

Permalink
New Track.SupportedMetadataFormats field
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeugma440 committed Nov 2, 2024
1 parent 638922d commit f819f0b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions ATL.unit-test/IO/HighLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void TagIO_R_MetaFormat()
{
Track theTrack = new Track(TestUtils.GetResourceLocationRoot() + "AA/aa.aa");
Assert.AreEqual(1, theTrack.MetadataFormats.Count);
Assert.AreEqual("Native / AA", theTrack.MetadataFormats[0].Name);
Assert.AreEqual("Native tagging / AA", theTrack.MetadataFormats[0].Name);
theTrack = new Track(TestUtils.GetResourceLocationRoot() + "MP3/APE.mp3");
Assert.AreEqual(1, theTrack.MetadataFormats.Count);
Assert.AreEqual("APEtag v2", theTrack.MetadataFormats[0].Name);
Expand All @@ -98,10 +98,10 @@ public void TagIO_R_MetaFormat()
Assert.AreEqual("ID3v1.1", theTrack.MetadataFormats[1].Name);
theTrack = new Track(TestUtils.GetResourceLocationRoot() + "OGG/ogg.ogg");
Assert.AreEqual(1, theTrack.MetadataFormats.Count);
Assert.AreEqual("Native / Vorbis (OGG)", theTrack.MetadataFormats[0].Name);
Assert.AreEqual("Native tagging / Vorbis (OGG)", theTrack.MetadataFormats[0].Name);
theTrack = new Track(TestUtils.GetResourceLocationRoot() + "FLAC/flac.flac");
Assert.AreEqual(1, theTrack.MetadataFormats.Count);
Assert.AreEqual("Native / Vorbis (FLAC)", theTrack.MetadataFormats[0].Name);
Assert.AreEqual("Native tagging / Vorbis (FLAC)", theTrack.MetadataFormats[0].Name);
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion ATL/AudioData/IO/Helpers/VorbisTagHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override IList<Format> MetadataFormats
{
Format nativeFormat = new Format(MetaDataIOFactory.GetInstance().getFormatsFromPath("native")[0])
{
Name = "Native / Vorbis"
Name = "Native tagging / Vorbis"
};
return new List<Format>(new[] { nativeFormat });
}
Expand Down
8 changes: 4 additions & 4 deletions ATL/AudioData/MetaDataIOFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ public static MetaDataIOFactory GetInstance()
theFactory.formatListByExt = new Dictionary<string, IList<Format>>();
theFactory.formatListByMime = new Dictionary<string, IList<Format>>();

Format tempFmt = new Format((int)TagType.ID3V1 * 1000, "ID3v1");
Format tempFmt = new Format((int)TagType.ID3V1, "ID3v1");
tempFmt.AddExtension("id3v1");
theFactory.addFormat(tempFmt);

tempFmt = new Format((int)TagType.ID3V2 * 1000, "ID3v2");
tempFmt = new Format((int)TagType.ID3V2, "ID3v2");
tempFmt.AddExtension("id3v2");
theFactory.addFormat(tempFmt);

tempFmt = new Format((int)TagType.APE * 1000, "APEtag");
tempFmt = new Format((int)TagType.APE, "APEtag");
tempFmt.AddExtension("ape");
theFactory.addFormat(tempFmt);

tempFmt = new Format((int)TagType.NATIVE * 1000, "Native");
tempFmt = new Format((int)TagType.NATIVE, "Native tagging", "Native");
tempFmt.AddExtension("native");
theFactory.addFormat(tempFmt);
}
Expand Down
8 changes: 7 additions & 1 deletion ATL/Entities/Track.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,15 @@ public int? OriginalReleaseYear
private bool isORYearExplicit;

/// <summary>
/// Format of the tagging systems
/// Format of the tagging systems present on the file
/// </summary>
public IList<Format> MetadataFormats { get; internal set; }

/// <summary>
/// Format of the supported tagging systems supported by the file
/// </summary>
public IList<Format> SupportedMetadataFormats { get; internal set; }


//=== PHYSICAL PROPERTIES

Expand Down Expand Up @@ -417,6 +422,7 @@ protected void Update(bool onlyReadEmbeddedPictures = false)

IMetaDataIO metadata = fileIO.Metadata;
MetadataFormats = new List<Format>(metadata.MetadataFormats);
SupportedMetadataFormats = new List<Format>(fileIO.GetSupportedMetas().Select(f => MetaDataIOFactory.GetInstance().getFormat((int)f)));

mimeType = fileIO.AudioFormat.MimeList.FirstOrDefault();

Expand Down
1 change: 1 addition & 0 deletions ATL/Factory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;

namespace ATL
{
Expand Down

0 comments on commit f819f0b

Please sign in to comment.