Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/TaglibSharp.Tests/FileFormats/M4aFormatTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
52 changes: 51 additions & 1 deletion src/TaglibSharp.Tests/TaggingFormats/ApeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
{
Expand Down Expand Up @@ -842,4 +892,4 @@ void TagTestWithSave (ref Tag tag, TagTestFunc testFunc)
testFunc (tag, "After Save");
}
}
}
}
50 changes: 50 additions & 0 deletions src/TaglibSharp.Tests/TaggingFormats/AsfTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
{
Expand Down
56 changes: 56 additions & 0 deletions src/TaglibSharp.Tests/TaggingFormats/Id3V2Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
{
Expand Down
50 changes: 50 additions & 0 deletions src/TaglibSharp.Tests/TaggingFormats/Mpeg4Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
{
Expand Down
50 changes: 50 additions & 0 deletions src/TaglibSharp.Tests/TaggingFormats/XiphTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
{
Expand Down
36 changes: 35 additions & 1 deletion src/TaglibSharp/Ape/Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1420,14 +1420,48 @@ public override string MusicBrainzReleaseArtistId {
/// or <see langword="null" /> if no value is present.
/// </value>
/// <remarks>
/// This property is implemented using the "MUSICBRAINZ_TRACKID" item.
/// This property is implemented using the "MUSICBRAINZ_RELEASETRACKID" item.
/// http://musicbrainz.org/doc/PicardTagMapping
/// </remarks>
public override string MusicBrainzTrackId {
get { return GetItemAsString ("MUSICBRAINZ_RELEASETRACKID"); }
set { SetValue ("MUSICBRAINZ_RELEASETRACKID", value); }
}

/// <summary>
/// Gets and sets the MusicBrainz RecordingID
/// </summary>
/// <value>
/// A <see cref="string" /> containing the MusicBrainz
/// RecordingID for the media described by the current
/// instance, or null if no value is present.
/// </value>
/// <remarks>
/// This property is implemented using the "MUSICBRAINZ_TRACKID" frame.
/// http://musicbrainz.org/doc/PicardTagMapping
/// </remarks>
public override string MusicBrainzRecordingId {
get { return GetItemAsString ("MUSICBRAINZ_TRACKID"); }
set { SetValue ("MUSICBRAINZ_TRACKID", value); }
}

/// <summary>
/// Gets and sets the MusicBrainz WorkID
/// </summary>
/// <value>
/// A <see cref="string" /> containing the MusicBrainz
/// WorkID for the media described by the current
/// instance, or null if no value is present.
/// </value>
/// <remarks>
/// This property is implemented using the "MUSICBRAINZ_WORKID" frame.
/// http://musicbrainz.org/doc/PicardTagMapping
/// </remarks>
public override string MusicBrainzWorkId {
get { return GetItemAsString ("MUSICBRAINZ_WORKID"); }
set { SetValue ("MUSICBRAINZ_WORKID", value); }
}

/// <summary>
/// Gets and sets the MusicBrainz Disc ID of the media
/// represented by the current instance.
Expand Down
Loading