Skip to content

Commit 4340975

Browse files
authored
Added support for IPLS Frame (#208)
1 parent 3bb7508 commit 4340975

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

src/TaglibSharp.Tests/TaggingFormats/Id3V2Test.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,40 @@ public void TestEventTimeCodesFrame ()
15681568
});
15691569
}
15701570

1571+
[Test]
1572+
public void TestInvolvedPersonsFrame ()
1573+
{
1574+
var personFunction = new string[] {"Person1", "Function1", "Person2", "Function2"};
1575+
var delimiter = new string(new char[1]{'\0'});
1576+
1577+
var ipls = "";
1578+
foreach (var s in personFunction) {
1579+
ipls += s + delimiter;
1580+
}
1581+
ipls = ipls.Trim(new[] {'\0'});
1582+
1583+
ByteVector id = "IPLS";
1584+
var frame = new TextInformationFrame (id) {
1585+
Text = new string[] { ipls }
1586+
};
1587+
1588+
FrameTest (frame, 3,
1589+
delegate (Frame f, StringType e) {
1590+
(f as TextInformationFrame).TextEncoding = e;
1591+
},
1592+
(d, v) => new TextInformationFrame (d, v),
1593+
1594+
delegate (Frame f, string m) {
1595+
var g = (f as TextInformationFrame);
1596+
Assert.AreEqual (id, g.FrameId, m);
1597+
var p = g.Text[0].Split(new[] { '\0' });
1598+
for (var i = 0; i < p.Length; i++) {
1599+
Assert.AreEqual (personFunction[i], p[i], m);
1600+
}
1601+
});
1602+
1603+
}
1604+
15711605
delegate void TagTestFunc (Tag tag, string msg);
15721606

15731607
void TagTestWithSave (ref Tag tag, TagTestFunc testFunc)

src/TaglibSharp/Id3v2/FrameFactory.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ public static Frame CreateFrame (ByteVector data, File file, ref int offset, byt
219219
if (header.FrameId[0] == (byte)'T')
220220
return new TextInformationFrame (data, position, header, version);
221221

222+
// Involved People List (frames 4.4 in 2.3. in 2.4 this is a TIPL frame)
223+
if (header.FrameId == FrameType.IPLS)
224+
return new TextInformationFrame(data, position,
225+
header, version);
226+
222227
// Unique File Identifier (frames 4.1)
223228
if (header.FrameId == FrameType.UFID)
224229
return new UniqueFileIdentifierFrame (data, position, header, version);

src/TaglibSharp/Id3v2/FrameTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ static class FrameType
4242
public static readonly ReadOnlyByteVector COMM = "COMM";
4343
public static readonly ReadOnlyByteVector EQUA = "EQUA";
4444
public static readonly ReadOnlyByteVector GEOB = "GEOB";
45+
public static readonly ReadOnlyByteVector IPLS = "IPLS";
4546
public static readonly ReadOnlyByteVector MCDI = "MCDI";
4647
public static readonly ReadOnlyByteVector PCNT = "PCNT";
4748
public static readonly ReadOnlyByteVector POPM = "POPM";

0 commit comments

Comments
 (0)