From d4274786020b14486959df01102bac712fc97fd4 Mon Sep 17 00:00:00 2001
From: Ma <101021254+CodeWithMa@users.noreply.github.com>
Date: Fri, 28 Jul 2023 21:01:19 +0200
Subject: [PATCH 01/10] - Fix Wrong Frame used for MusicBrainz Track Id - See
#304 - Add MusicBrainzRecordingId - Add MusicBrainzWorkId
---
.github/workflows/ubuntu.yml | 4 ++--
src/TaglibSharp/Id3v2/Tag.cs | 36 +++++++++++++++++++++++++++++++++++-
src/TaglibSharp/Tag.cs | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 73 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index bb0cde49..cb9cd696 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
- name: Setup .NET Core
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.302
- name: Build with dotnet
diff --git a/src/TaglibSharp/Id3v2/Tag.cs b/src/TaglibSharp/Id3v2/Tag.cs
index 1c3676ff..cd669dc0 100644
--- a/src/TaglibSharp/Id3v2/Tag.cs
+++ b/src/TaglibSharp/Id3v2/Tag.cs
@@ -1973,14 +1973,48 @@ public override string MusicBrainzReleaseArtistId {
/// instance, or null if no value is present.
///
///
- /// This property is implemented using the "UFID:http://musicbrainz.org" frame.
+ /// This property is implemented using the "TXXX:MusicBrainz Release Track Id" frame.
/// http://musicbrainz.org/doc/PicardTagMapping
///
public override string MusicBrainzTrackId {
+ get { return GetUfidText ("MusicBrainz Release Track Id"); }
+ set { SetUfidText ("MusicBrainz Release Track Id", value); }
+ }
+
+ ///
+ /// Gets and sets the MusicBrainz RecordingID
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// RecordingID for the media described by the current
+ /// instance, or null if no value is present.
+ ///
+ ///
+ /// This property is implemented using the "UFID:http://musicbrainz.org" frame.
+ /// http://musicbrainz.org/doc/PicardTagMapping
+ ///
+ public override string MusicBrainzRecordingId {
get { return GetUfidText ("http://musicbrainz.org"); }
set { SetUfidText ("http://musicbrainz.org", value); }
}
+ ///
+ /// Gets and sets the MusicBrainz WorkID
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// WorkID for the media described by the current
+ /// instance, or null if no value is present.
+ ///
+ ///
+ /// This property is implemented using the "TXXX:MusicBrainz Work Id" frame.
+ /// http://musicbrainz.org/doc/PicardTagMapping
+ ///
+ public override string MusicBrainzWorkId {
+ get { return GetUfidText ("MusicBrainz Work Id"); }
+ set { SetUfidText ("MusicBrainz Work Id", value); }
+ }
+
///
/// Gets and sets the MusicBrainz DiscID
///
diff --git a/src/TaglibSharp/Tag.cs b/src/TaglibSharp/Tag.cs
index 9e5c00b8..953a216a 100644
--- a/src/TaglibSharp/Tag.cs
+++ b/src/TaglibSharp/Tag.cs
@@ -848,6 +848,42 @@ public virtual string MusicBrainzTrackId {
set { }
}
+ ///
+ /// Gets and sets the MusicBrainz Recording ID of the media represented by
+ /// the current instance.
+ ///
+ ///
+ /// A containing the MusicBrainz RecordingID of the
+ /// media represented by the current instance or an empty
+ /// array if no value is present.
+ ///
+ ///
+ /// This field represents the MusicBrainz RecordingID, and is used
+ /// to uniquely identify a particular recording.
+ ///
+ public virtual string MusicBrainzRecordingId {
+ get { return null; }
+ set { }
+ }
+
+ ///
+ /// Gets and sets the MusicBrainz Work ID of the media represented by
+ /// the current instance.
+ ///
+ ///
+ /// A containing the MusicBrainz WorkID of the
+ /// media represented by the current instance or an empty
+ /// array if no value is present.
+ ///
+ ///
+ /// This field represents the MusicBrainz WorkID, and is used
+ /// to uniquely identify a particular work.
+ ///
+ public virtual string MusicBrainzWorkId {
+ get { return null; }
+ set { }
+ }
+
///
/// Gets and sets the MusicBrainz Disc ID of the media represented by
/// the current instance.
From e9cae174caca1b7577aa82ae309835e71262e4fe Mon Sep 17 00:00:00 2001
From: Ma <101021254+CodeWithMa@users.noreply.github.com>
Date: Sat, 29 Jul 2023 16:56:50 +0200
Subject: [PATCH 02/10] fix Ape Tags: MusicBrainzTrackId + Add
MusicBrainzRecordingId, MusicBrainzWorkId
---
src/TaglibSharp/Ape/Tag.cs | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/src/TaglibSharp/Ape/Tag.cs b/src/TaglibSharp/Ape/Tag.cs
index c3b631b6..4ad703c2 100644
--- a/src/TaglibSharp/Ape/Tag.cs
+++ b/src/TaglibSharp/Ape/Tag.cs
@@ -1420,14 +1420,48 @@ public override string MusicBrainzReleaseArtistId {
/// or if no value is present.
///
///
- /// This property is implemented using the "MUSICBRAINZ_TRACKID" item.
+ /// This property is implemented using the "MUSICBRAINZ_RELEASETRACKID" item.
/// http://musicbrainz.org/doc/PicardTagMapping
///
public override string MusicBrainzTrackId {
+ get { return GetItemAsString ("MUSICBRAINZ_RELEASETRACKID"); }
+ set { SetValue ("MUSICBRAINZ_RELEASETRACKID", value); }
+ }
+
+ ///
+ /// Gets and sets the MusicBrainz RecordingID
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// RecordingID for the media described by the current
+ /// instance, or null if no value is present.
+ ///
+ ///
+ /// This property is implemented using the "MUSICBRAINZ_TRACKID" frame.
+ /// http://musicbrainz.org/doc/PicardTagMapping
+ ///
+ public override string MusicBrainzRecordingId {
get { return GetItemAsString ("MUSICBRAINZ_TRACKID"); }
set { SetValue ("MUSICBRAINZ_TRACKID", value); }
}
+ ///
+ /// Gets and sets the MusicBrainz WorkID
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// WorkID for the media described by the current
+ /// instance, or null if no value is present.
+ ///
+ ///
+ /// This property is implemented using the "MUSICBRAINZ_WORKID" frame.
+ /// http://musicbrainz.org/doc/PicardTagMapping
+ ///
+ public override string MusicBrainzWorkId {
+ get { return GetItemAsString ("MUSICBRAINZ_WORKID"); }
+ set { SetValue ("MUSICBRAINZ_WORKID", value); }
+ }
+
///
/// Gets and sets the MusicBrainz Disc ID of the media
/// represented by the current instance.
From 861002c618c5643356390ef0845f9833ff3c9171 Mon Sep 17 00:00:00 2001
From: Ma <101021254+CodeWithMa@users.noreply.github.com>
Date: Sat, 29 Jul 2023 17:10:50 +0200
Subject: [PATCH 03/10] fix Asf Tags: MusicBrainzTrackId + Add
MusicBrainzRecordingId, MusicBrainzWorkId
---
src/TaglibSharp/Asf/Tag.cs | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/src/TaglibSharp/Asf/Tag.cs b/src/TaglibSharp/Asf/Tag.cs
index 84717ba2..72872b32 100644
--- a/src/TaglibSharp/Asf/Tag.cs
+++ b/src/TaglibSharp/Asf/Tag.cs
@@ -1176,15 +1176,49 @@ public override string MusicBrainzReleaseArtistId {
/// instance or null if no value is present.
///
///
- /// This property is implemented using the "MusicBrainz/Track Id"
+ /// This property is implemented using the "MusicBrainz/Release Track Id"
/// field.
/// http://musicbrainz.org/doc/PicardTagMapping
///
public override string MusicBrainzTrackId {
+ get { return GetDescriptorString ("MusicBrainz/Release Track Id"); }
+ set { SetDescriptorString (value, "MusicBrainz/Release Track Id"); }
+ }
+
+ ///
+ /// Gets and sets the MusicBrainz RecordingID
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// RecordingID for the media described by the current
+ /// instance, or null if no value is present.
+ ///
+ ///
+ /// This property is implemented using the "MusicBrainz/Track Id" field.
+ /// http://musicbrainz.org/doc/PicardTagMapping
+ ///
+ public override string MusicBrainzRecordingId {
get { return GetDescriptorString ("MusicBrainz/Track Id"); }
set { SetDescriptorString (value, "MusicBrainz/Track Id"); }
}
+ ///
+ /// Gets and sets the MusicBrainz WorkID
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// WorkID for the media described by the current
+ /// instance, or null if no value is present.
+ ///
+ ///
+ /// This property is implemented using the "MusicBrainz/Work Id" field.
+ /// http://musicbrainz.org/doc/PicardTagMapping
+ ///
+ public override string MusicBrainzWorkId {
+ get { return GetDescriptorString ("MusicBrainz/Work Id"); }
+ set { SetDescriptorString (value, "MusicBrainz/Work Id"); }
+ }
+
///
/// Gets and sets the MusicBrainz Disc ID of
/// the media described by the current instance.
From b017ae92a29f83720738365b27e21fc53ebd6247 Mon Sep 17 00:00:00 2001
From: Ma <101021254+CodeWithMa@users.noreply.github.com>
Date: Sat, 29 Jul 2023 17:16:41 +0200
Subject: [PATCH 04/10] CombinedTag: Add MusicBrainzRecordingId,
MusicBrainzWorkId
---
src/TaglibSharp/CombinedTag.cs | 76 ++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/src/TaglibSharp/CombinedTag.cs b/src/TaglibSharp/CombinedTag.cs
index 009eb8fa..5d5b57fc 100644
--- a/src/TaglibSharp/CombinedTag.cs
+++ b/src/TaglibSharp/CombinedTag.cs
@@ -1408,6 +1408,82 @@ public override string MusicBrainzTrackId {
tag.MusicBrainzTrackId = value;
}
}
+
+ ///
+ /// Gets and sets the MusicBrainz Recording ID.
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// RecordingID for the media described by the
+ /// current instance or null if no value is present.
+ ///
+ ///
+ /// When getting the value, the child tags are looped
+ /// through in order and the first non-
+ /// and non-empty value is returned.
+ /// When setting the value, it is stored in each child
+ /// tag.
+ ///
+ ///
+ public override string MusicBrainzRecordingId {
+ get {
+ foreach (Tag tag in tags) {
+ if (tag == null)
+ continue;
+
+ string value = tag.MusicBrainzRecordingId;
+
+ if (value != null)
+ return value;
+ }
+
+ return null;
+ }
+
+ set {
+ foreach (Tag tag in tags)
+ if (tag != null)
+ tag.MusicBrainzRecordingId = value;
+ }
+ }
+
+ ///
+ /// Gets and sets the MusicBrainz Work ID.
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// WorkID for the media described by the
+ /// current instance or null if no value is present.
+ ///
+ ///
+ /// When getting the value, the child tags are looped
+ /// through in order and the first non-
+ /// and non-empty value is returned.
+ /// When setting the value, it is stored in each child
+ /// tag.
+ ///
+ ///
+ public override string MusicBrainzWorkId {
+ get {
+ foreach (Tag tag in tags) {
+ if (tag == null)
+ continue;
+
+ string value = tag.MusicBrainzWorkId;
+
+ if (value != null)
+ return value;
+ }
+
+ return null;
+ }
+
+ set {
+ foreach (Tag tag in tags)
+ if (tag != null)
+ tag.MusicBrainzWorkId = value;
+ }
+ }
///
/// Gets and sets the MusicBrainz Disc ID.
From 05bcac18045ecf10e4b5655506a9405a6766c7c8 Mon Sep 17 00:00:00 2001
From: Ma <101021254+CodeWithMa@users.noreply.github.com>
Date: Sat, 29 Jul 2023 17:25:30 +0200
Subject: [PATCH 05/10] fix Mpeg4 AppleTags: MusicBrainzTrackId + Add
MusicBrainzRecordingId, MusicBrainzWorkId
---
src/TaglibSharp/Mpeg4/AppleTag.cs | 34 +++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/TaglibSharp/Mpeg4/AppleTag.cs b/src/TaglibSharp/Mpeg4/AppleTag.cs
index 020aab18..27266230 100644
--- a/src/TaglibSharp/Mpeg4/AppleTag.cs
+++ b/src/TaglibSharp/Mpeg4/AppleTag.cs
@@ -1474,10 +1474,44 @@ public override string MusicBrainzReleaseArtistId {
/// http://musicbrainz.org/doc/PicardTagMapping
///
public override string MusicBrainzTrackId {
+ get { return GetDashBox ("com.apple.iTunes", "MusicBrainz Release Track Id"); }
+ set { SetDashBox ("com.apple.iTunes", "MusicBrainz Release Track Id", value); }
+ }
+
+ ///
+ /// Gets and sets the MusicBrainz RecordingID
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// RecordingID for the media described by the current
+ /// instance, or null if no value is present.
+ ///
+ ///
+ /// This property is implemented using the "dash"/"----" box type.
+ /// http://musicbrainz.org/doc/PicardTagMapping
+ ///
+ public override string MusicBrainzRecordingId {
get { return GetDashBox ("com.apple.iTunes", "MusicBrainz Track Id"); }
set { SetDashBox ("com.apple.iTunes", "MusicBrainz Track Id", value); }
}
+ ///
+ /// Gets and sets the MusicBrainz WorkID
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// WorkID for the media described by the current
+ /// instance, or null if no value is present.
+ ///
+ ///
+ /// This property is implemented using the "dash"/"----" box type.
+ /// http://musicbrainz.org/doc/PicardTagMapping
+ ///
+ public override string MusicBrainzWorkId {
+ get { return GetDashBox ("com.apple.iTunes", "MusicBrainz Work Id"); }
+ set { SetDashBox ("com.apple.iTunes", "MusicBrainz Work Id", value); }
+ }
+
///
/// Gets and sets the MusicBrainz DiscID
///
From 757a17e0d64e800799d2d6c23c3971c6b0245564 Mon Sep 17 00:00:00 2001
From: Ma <101021254+CodeWithMa@users.noreply.github.com>
Date: Sat, 29 Jul 2023 17:30:29 +0200
Subject: [PATCH 06/10] Ogg/GroupedComment: Add MusicBrainzRecordingId,
MusicBrainzWorkId
---
src/TaglibSharp/Ogg/GroupedComment.cs | 60 +++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/src/TaglibSharp/Ogg/GroupedComment.cs b/src/TaglibSharp/Ogg/GroupedComment.cs
index 80f2a900..9fc25100 100644
--- a/src/TaglibSharp/Ogg/GroupedComment.cs
+++ b/src/TaglibSharp/Ogg/GroupedComment.cs
@@ -1110,6 +1110,66 @@ public override string MusicBrainzTrackId {
set { if (tags.Count > 0) tags[0].MusicBrainzTrackId = value; }
}
+ ///
+ /// Gets and sets the MusicBrainz Recording ID.
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// RecordingID for the media described by the
+ /// current instance or null if no value is present.
+ ///
+ ///
+ /// When getting the value, the child comments are looped
+ /// through in order and the first non-
+ /// and non-empty value is returned.
+ /// When setting the value, it is stored in the first
+ /// comment.
+ ///
+ ///
+ public override string MusicBrainzRecordingId {
+ get {
+ foreach (XiphComment tag in tags) {
+ string value = tag?.MusicBrainzRecordingId;
+
+ if (!string.IsNullOrEmpty (value))
+ return value;
+ }
+
+ return null;
+ }
+ set { if (tags.Count > 0) tags[0].MusicBrainzRecordingId = value; }
+ }
+
+ ///
+ /// Gets and sets the MusicBrainz Work ID.
+ ///
+ ///
+ /// A containing the MusicBrainz
+ /// WorkID for the media described by the
+ /// current instance or null if no value is present.
+ ///
+ ///
+ /// When getting the value, the child comments are looped
+ /// through in order and the first non-
+ /// and non-empty value is returned.
+ /// When setting the value, it is stored in the first
+ /// comment.
+ ///
+ ///
+ public override string MusicBrainzWorkId {
+ get {
+ foreach (XiphComment tag in tags) {
+ string value = tag?.MusicBrainzWorkId;
+
+ if (!string.IsNullOrEmpty (value))
+ return value;
+ }
+
+ return null;
+ }
+ set { if (tags.Count > 0) tags[0].MusicBrainzWorkId = value; }
+ }
+
///
/// Gets and sets the MusicBrainz Disc ID.
///
From 1569a3ae5080fa544724b3cd12a9794235049a8c Mon Sep 17 00:00:00 2001
From: Ma <101021254+CodeWithMa@users.noreply.github.com>
Date: Sat, 29 Jul 2023 17:36:59 +0200
Subject: [PATCH 07/10] fix Ogg/XiphComment: MusicBrainzTrackId + Add
MusicBrainzRecordingId, MusicBrainzWorkId
---
src/TaglibSharp/Ogg/XiphComment.cs | 36 +++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/src/TaglibSharp/Ogg/XiphComment.cs b/src/TaglibSharp/Ogg/XiphComment.cs
index dd1f98e8..9598baf6 100644
--- a/src/TaglibSharp/Ogg/XiphComment.cs
+++ b/src/TaglibSharp/Ogg/XiphComment.cs
@@ -1291,13 +1291,47 @@ public override string MusicBrainzReleaseArtistId {
/// instance or if no value present.
///
///
- /// This property is implemented using the "MUSICBRAINZ_TRACKID" field.
+ /// This property is implemented using the "MUSICBRAINZ_RELEASETRACKID" field.
///
public override string MusicBrainzTrackId {
+ get { return GetFirstField ("MUSICBRAINZ_RELEASETRACKID"); }
+ set { SetField ("MUSICBRAINZ_RELEASETRACKID", value); }
+ }
+
+ ///
+ /// Gets and sets the MusicBrainz Recording ID for the media
+ /// represented by the current instance.
+ ///
+ ///
+ /// A object containing the MusicBrainz
+ /// RecordingID for the media represented by the current
+ /// instance or if no value present.
+ ///
+ ///
+ /// This property is implemented using the "MUSICBRAINZ_TRACKID" field.
+ ///
+ public override string MusicBrainzRecordingId {
get { return GetFirstField ("MUSICBRAINZ_TRACKID"); }
set { SetField ("MUSICBRAINZ_TRACKID", value); }
}
+ ///
+ /// Gets and sets the MusicBrainz Work ID for the media
+ /// represented by the current instance.
+ ///
+ ///
+ /// A object containing the MusicBrainz
+ /// WorkID for the media represented by the current
+ /// instance or if no value present.
+ ///
+ ///
+ /// This property is implemented using the "MUSICBRAINZ_WORKID" field.
+ ///
+ public override string MusicBrainzWorkId {
+ get { return GetFirstField ("MUSICBRAINZ_WORKID"); }
+ set { SetField ("MUSICBRAINZ_WORKID", value); }
+ }
+
///
/// Gets and sets the MusicBrainz Disc ID for the media
/// represented by the current instance.
From 8186aea4af22f8b611d3f340a56c4c79d2795021 Mon Sep 17 00:00:00 2001
From: Ma <101021254+CodeWithMa@users.noreply.github.com>
Date: Sat, 29 Jul 2023 18:14:09 +0200
Subject: [PATCH 08/10] Add TaggingFormats Tests.
---
.../TaggingFormats/ApeTest.cs | 52 ++++++++++++++++-
.../TaggingFormats/AsfTest.cs | 50 +++++++++++++++++
.../TaggingFormats/Id3V2Test.cs | 56 +++++++++++++++++++
.../TaggingFormats/Mpeg4Test.cs | 50 +++++++++++++++++
.../TaggingFormats/XiphTest.cs | 50 +++++++++++++++++
5 files changed, 257 insertions(+), 1 deletion(-)
diff --git a/src/TaglibSharp.Tests/TaggingFormats/ApeTest.cs b/src/TaglibSharp.Tests/TaggingFormats/ApeTest.cs
index 2082f6b8..dd375bae 100644
--- a/src/TaglibSharp.Tests/TaggingFormats/ApeTest.cs
+++ b/src/TaglibSharp.Tests/TaggingFormats/ApeTest.cs
@@ -634,6 +634,56 @@ public void TestMusicBrainzTrackID ()
});
}
+ [Test]
+ public void TestMusicBrainzRecordingID ()
+ {
+ Tag tag = new Tag ();
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzRecordingId, "Initial (Null): " + m);
+ });
+
+ tag.MusicBrainzRecordingId = val_sing;
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
+ Assert.AreEqual (val_sing, t.MusicBrainzRecordingId, "Value Set (!Null): " + m);
+ });
+
+ tag.MusicBrainzRecordingId = string.Empty;
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzRecordingId, "Value Cleared (Null): " + m);
+ });
+ }
+
+ [Test]
+ public void TestMusicBrainzWorkID ()
+ {
+ Tag tag = new Tag ();
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzWorkId, "Initial (Null): " + m);
+ });
+
+ tag.MusicBrainzWorkId = val_sing;
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
+ Assert.AreEqual (val_sing, t.MusicBrainzWorkId, "Value Set (!Null): " + m);
+ });
+
+ tag.MusicBrainzWorkId = string.Empty;
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzWorkId, "Value Cleared (Null): " + m);
+ });
+ }
+
[Test]
public void TestMusicBrainzDiscID ()
{
@@ -842,4 +892,4 @@ void TagTestWithSave (ref Tag tag, TagTestFunc testFunc)
testFunc (tag, "After Save");
}
}
-}
\ No newline at end of file
+}
diff --git a/src/TaglibSharp.Tests/TaggingFormats/AsfTest.cs b/src/TaglibSharp.Tests/TaggingFormats/AsfTest.cs
index 232e9db9..d0ad9845 100644
--- a/src/TaglibSharp.Tests/TaggingFormats/AsfTest.cs
+++ b/src/TaglibSharp.Tests/TaggingFormats/AsfTest.cs
@@ -633,6 +633,56 @@ public void TestMusicBrainzTrackID ()
});
}
+ [Test]
+ public void TestMusicBrainzRecordingID ()
+ {
+ var file = CreateFile (out var abst);
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzRecordingId, "Initial (Null): " + m);
+ });
+
+ file.Tag.MusicBrainzRecordingId = val_sing;
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
+ Assert.AreEqual (val_sing, t.MusicBrainzRecordingId, "Value Set (!Null): " + m);
+ });
+
+ file.Tag.MusicBrainzRecordingId = string.Empty;
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzRecordingId, "Value Cleared (Null): " + m);
+ });
+ }
+
+ [Test]
+ public void TestMusicBrainzWorkID ()
+ {
+ var file = CreateFile (out var abst);
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzWorkId, "Initial (Null): " + m);
+ });
+
+ file.Tag.MusicBrainzWorkId = val_sing;
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
+ Assert.AreEqual (val_sing, t.MusicBrainzWorkId, "Value Set (!Null): " + m);
+ });
+
+ file.Tag.MusicBrainzWorkId = string.Empty;
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzWorkId, "Value Cleared (Null): " + m);
+ });
+ }
+
[Test]
public void TestMusicBrainzDiscID ()
{
diff --git a/src/TaglibSharp.Tests/TaggingFormats/Id3V2Test.cs b/src/TaglibSharp.Tests/TaggingFormats/Id3V2Test.cs
index 8b2ea676..d968a922 100644
--- a/src/TaglibSharp.Tests/TaggingFormats/Id3V2Test.cs
+++ b/src/TaglibSharp.Tests/TaggingFormats/Id3V2Test.cs
@@ -744,6 +744,62 @@ public void TestMusicBrainzTrackID ()
}
}
+ [Test]
+ public void TestMusicBrainzRecordingID ()
+ {
+ var tag = new Tag ();
+ for (byte version = 2; version <= 4; version++) {
+ tag.Version = version;
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzRecordingId, "Initial (Null): " + m);
+ });
+
+ tag.MusicBrainzRecordingId = val_sing;
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
+ Assert.AreEqual (val_sing, t.MusicBrainzRecordingId, "Value Set (!Null): " + m);
+ });
+
+ tag.MusicBrainzRecordingId = string.Empty;
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzRecordingId, "Value Cleared (Null): " + m);
+ });
+ }
+ }
+
+ [Test]
+ public void TestMusicBrainzWorkID ()
+ {
+ var tag = new Tag ();
+ for (byte version = 2; version <= 4; version++) {
+ tag.Version = version;
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzWorkId, "Initial (Null): " + m);
+ });
+
+ tag.MusicBrainzWorkId = val_sing;
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
+ Assert.AreEqual (val_sing, t.MusicBrainzWorkId, "Value Set (!Null): " + m);
+ });
+
+ tag.MusicBrainzWorkId = string.Empty;
+
+ TagTestWithSave (ref tag, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzWorkId, "Value Cleared (Null): " + m);
+ });
+ }
+ }
+
[Test]
public void TestMusicBrainzDiscID ()
{
diff --git a/src/TaglibSharp.Tests/TaggingFormats/Mpeg4Test.cs b/src/TaglibSharp.Tests/TaggingFormats/Mpeg4Test.cs
index dbc0ca5d..d36e160e 100644
--- a/src/TaglibSharp.Tests/TaggingFormats/Mpeg4Test.cs
+++ b/src/TaglibSharp.Tests/TaggingFormats/Mpeg4Test.cs
@@ -634,6 +634,56 @@ public void TestMusicBrainzTrackID ()
});
}
+ [Test]
+ public void TestMusicBrainzRecordingID ()
+ {
+ var file = CreateFile (out var abst);
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzRecordingId, "Initial (Null): " + m);
+ });
+
+ file.Tag.MusicBrainzRecordingId = val_sing;
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
+ Assert.AreEqual (val_sing, t.MusicBrainzRecordingId, "Value Set (!Null): " + m);
+ });
+
+ file.Tag.MusicBrainzRecordingId = string.Empty;
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzRecordingId, "Value Cleared (Null): " + m);
+ });
+ }
+
+ [Test]
+ public void TestMusicBrainzWorkID ()
+ {
+ var file = CreateFile (out var abst);
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzWorkId, "Initial (Null): " + m);
+ });
+
+ file.Tag.MusicBrainzWorkId = val_sing;
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
+ Assert.AreEqual (val_sing, t.MusicBrainzWorkId, "Value Set (!Null): " + m);
+ });
+
+ file.Tag.MusicBrainzWorkId = string.Empty;
+
+ TagTestWithSave (ref file, abst, delegate (Tag t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzWorkId, "Value Cleared (Null): " + m);
+ });
+ }
+
[Test]
public void TestMusicBrainzDiscID ()
{
diff --git a/src/TaglibSharp.Tests/TaggingFormats/XiphTest.cs b/src/TaglibSharp.Tests/TaggingFormats/XiphTest.cs
index c103d125..5f8db080 100644
--- a/src/TaglibSharp.Tests/TaggingFormats/XiphTest.cs
+++ b/src/TaglibSharp.Tests/TaggingFormats/XiphTest.cs
@@ -659,6 +659,56 @@ public void TestMusicBrainzTrackID ()
});
}
+ [Test]
+ public void TestMusicBrainzRecordingID ()
+ {
+ var tag = new XiphComment ();
+
+ TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzRecordingId, "Initial (Null): " + m);
+ });
+
+ tag.MusicBrainzRecordingId = val_sing;
+
+ TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
+ Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
+ Assert.AreEqual (val_sing, t.MusicBrainzRecordingId, "Value Set (!Null): " + m);
+ });
+
+ tag.MusicBrainzRecordingId = string.Empty;
+
+ TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzRecordingId, "Value Cleared (Null): " + m);
+ });
+ }
+
+ [Test]
+ public void TestMusicBrainzWorkID ()
+ {
+ var tag = new XiphComment ();
+
+ TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Initial (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzWorkId, "Initial (Null): " + m);
+ });
+
+ tag.MusicBrainzWorkId = val_sing;
+
+ TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
+ Assert.IsFalse (t.IsEmpty, "Value Set (!IsEmpty): " + m);
+ Assert.AreEqual (val_sing, t.MusicBrainzWorkId, "Value Set (!Null): " + m);
+ });
+
+ tag.MusicBrainzWorkId = string.Empty;
+
+ TagTestWithSave (ref tag, delegate (XiphComment t, string m) {
+ Assert.IsTrue (t.IsEmpty, "Value Cleared (IsEmpty): " + m);
+ Assert.IsNull (t.MusicBrainzWorkId, "Value Cleared (Null): " + m);
+ });
+ }
+
[Test]
public void TestMusicBrainzDiscID ()
{
From 14506af79e2e773d1b6d498fe82a4498469432f3 Mon Sep 17 00:00:00 2001
From: Ma <101021254+CodeWithMa@users.noreply.github.com>
Date: Sat, 29 Jul 2023 18:24:49 +0200
Subject: [PATCH 09/10] Update Test: Change MusicBrainzTrackId to
MusicBrainzRecordingId
---
src/TaglibSharp.Tests/FileFormats/M4aFormatTest.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/TaglibSharp.Tests/FileFormats/M4aFormatTest.cs b/src/TaglibSharp.Tests/FileFormats/M4aFormatTest.cs
index 8bb33a89..62dc9b87 100644
--- a/src/TaglibSharp.Tests/FileFormats/M4aFormatTest.cs
+++ b/src/TaglibSharp.Tests/FileFormats/M4aFormatTest.cs
@@ -54,10 +54,10 @@ public void bgo_676934 ()
[Test]
public void bgo_701689 ()
{
- // This file contains a musicbrainz track id "883821fc-9bbc-4e04-be79-b4b12c4c4a4e"
+ // This file contains a musicbrainz recording id "883821fc-9bbc-4e04-be79-b4b12c4c4a4e"
// This case also handles bgo #701690 as a proper value for the tag must be returned
var file = TagLib.File.Create (TestPath.Samples + "bgo_701689.m4a");
- Assert.AreEqual ("883821fc-9bbc-4e04-be79-b4b12c4c4a4e", file.Tag.MusicBrainzTrackId, "#1");
+ Assert.AreEqual ("883821fc-9bbc-4e04-be79-b4b12c4c4a4e", file.Tag.MusicBrainzRecordingId, "#1");
}
[Test]
From ffca9b39d8b3394a78030fca355e58fd8494df85 Mon Sep 17 00:00:00 2001
From: Ma <101021254+CodeWithMa@users.noreply.github.com>
Date: Sun, 30 Jul 2023 08:43:07 +0200
Subject: [PATCH 10/10] undo github actions change
---
.github/workflows/ubuntu.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index cb9cd696..bb0cde49 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v1
- name: Setup .NET Core
- uses: actions/setup-dotnet@v3
+ uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.302
- name: Build with dotnet