Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added support for IPLS Frame #208

Merged
merged 1 commit into from
Apr 10, 2020
Merged
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
34 changes: 34 additions & 0 deletions src/TaglibSharp.Tests/TaggingFormats/Id3V2Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,40 @@ public void TestEventTimeCodesFrame ()
});
}

[Test]
public void TestInvolvedPersonsFrame ()
{
var personFunction = new string[] {"Person1", "Function1", "Person2", "Function2"};
var delimiter = new string(new char[1]{'\0'});

var ipls = "";
foreach (var s in personFunction) {
ipls += s + delimiter;
}
ipls = ipls.Trim(new[] {'\0'});

ByteVector id = "IPLS";
var frame = new TextInformationFrame (id) {
Text = new string[] { ipls }
};

FrameTest (frame, 3,
delegate (Frame f, StringType e) {
(f as TextInformationFrame).TextEncoding = e;
},
(d, v) => new TextInformationFrame (d, v),

delegate (Frame f, string m) {
var g = (f as TextInformationFrame);
Assert.AreEqual (id, g.FrameId, m);
var p = g.Text[0].Split(new[] { '\0' });
for (var i = 0; i < p.Length; i++) {
Assert.AreEqual (personFunction[i], p[i], m);
}
});

}

delegate void TagTestFunc (Tag tag, string msg);

void TagTestWithSave (ref Tag tag, TagTestFunc testFunc)
Expand Down
5 changes: 5 additions & 0 deletions src/TaglibSharp/Id3v2/FrameFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ public static Frame CreateFrame (ByteVector data, File file, ref int offset, byt
if (header.FrameId[0] == (byte)'T')
return new TextInformationFrame (data, position, header, version);

// Involved People List (frames 4.4 in 2.3. in 2.4 this is a TIPL frame)
if (header.FrameId == FrameType.IPLS)
return new TextInformationFrame(data, position,
header, version);

// Unique File Identifier (frames 4.1)
if (header.FrameId == FrameType.UFID)
return new UniqueFileIdentifierFrame (data, position, header, version);
Expand Down
1 change: 1 addition & 0 deletions src/TaglibSharp/Id3v2/FrameTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static class FrameType
public static readonly ReadOnlyByteVector COMM = "COMM";
public static readonly ReadOnlyByteVector EQUA = "EQUA";
public static readonly ReadOnlyByteVector GEOB = "GEOB";
public static readonly ReadOnlyByteVector IPLS = "IPLS";
public static readonly ReadOnlyByteVector MCDI = "MCDI";
public static readonly ReadOnlyByteVector PCNT = "PCNT";
public static readonly ReadOnlyByteVector POPM = "POPM";
Expand Down