Skip to content

Commit

Permalink
Added support for IPLS Frame (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
hwahrmann authored Apr 10, 2020
1 parent 3bb7508 commit 4340975
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
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

0 comments on commit 4340975

Please # to comment.