Skip to content

Commit

Permalink
fix: StreamContent should be a string.
Browse files Browse the repository at this point in the history
Fixed: #5
  • Loading branch information
svrooij committed Dec 8, 2023
1 parent b5ed306 commit dac123f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Sonos.Base/Metadata/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class Item
public VirtualLineIn? VitualLineIn { get; set; }

[XmlElement("streamContent", Namespace = "urn:schemas-rinconnetworks-com:metadata-1-0/")]
public StreamContent? StreamContent { get; set; }
public string? StreamContent { get; set; }

[XmlElement("desc", Namespace = "urn:schemas-rinconnetworks-com:metadata-1-0/", Form = System.Xml.Schema.XmlSchemaForm.Qualified)]
public DidlDesc? Desc { get; set; }
Expand Down
6 changes: 0 additions & 6 deletions src/Sonos.Base/Metadata/StreamContent.cs

This file was deleted.

26 changes: 26 additions & 0 deletions tests/Sonos.Base.Tests/Metadata/DidlSerializerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,30 @@ public void DeserializeMetadata_SonosPlaylist_ParsesDescElement()
Assert.Equal("cdudn", item?.Desc?.Id);
Assert.Equal("SA_RINCON2311_X_#Svc2311-0-Token", item?.Desc?.Value);
}

private const string xmlRadioStation = @"<DIDL-Lite xmlns:dc=""http://purl.org/dc/elements/1.1/""
xmlns:upnp=""urn:schemas-upnp-org:metadata-1-0/upnp/""
xmlns:r=""urn:schemas-rinconnetworks-com:metadata-1-0/""
xmlns=""urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"">
<item id=""-1"" parentID=""-1"" restricted=""true"">
<res protocolInfo=""aac:*:application/octet-stream:*"">
aac://http://stream.srg-ssr.ch/m/drs3/aacp_96</res>
<r:streamContent>ANDRYY - BRUCHPILOT</r:streamContent>
<dc:title>aacp_96</dc:title>
<upnp:class>object.item</upnp:class>
</item>
</DIDL-Lite>";

[Fact]
public void DeserializeMetadata_SonosRadioStream()
{
var didl = DidlSerializer.DeserializeMetadata(xmlRadioStation);
Assert.NotNull(didl);
Assert.Single(didl.Items);

var item = didl.Items[0];

Assert.Equal("aacp_96", item.Title);
Assert.Equal("ANDRYY - BRUCHPILOT", item.StreamContent);
}
}

0 comments on commit dac123f

Please sign in to comment.