Skip to content

Commit

Permalink
Building in TrackMetaData
Browse files Browse the repository at this point in the history
  • Loading branch information
skavan committed Jul 15, 2014
1 parent a1a6028 commit 427b81b
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 19 deletions.
18 changes: 9 additions & 9 deletions vbDeviceSpy/frmDeviceFinderClean.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vbDeviceSpy/frmDeviceFinderClean.resx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABE
FwAAAk1TRnQBSQFMAgEBCAEAASABAQEgAQEBEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA
FwAAAk1TRnQBSQFMAgEBCAEAASgBAQEoAQEBEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABMAMAAQEBAAEYBgABJP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AB4A//8n/wPnAc4CxgHnAt4B/wL3
If8E1gHOAcYB7wLnAf8C9y3/Aa0BpQKtAZQCrQGUAq0BlAKtAZQCrQGUAq0BlAGtA9YM/wMQIZQDIQz/
AfcC/wFrAb0B1gExAYwBrQFKAXsBlAFrAYQBjAGUApwBvQK1Ad4C1gH3Au8S/wHGAecB9wFaAa0BxgE5
Expand Down Expand Up @@ -293,7 +293,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAg
OQAAAk1TRnQBSQFMAgEBBQEAAaABAAGgAQABIAEAASABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAGA
OQAAAk1TRnQBSQFMAgEBBQEAAagBAAGoAQABIAEAASABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAGA
AwABQAMAAQEBAAEYBgABYP8A/wD/AP8A/wD/AP8A/wD/ACEAUZMDj/8AKgADmAPiA/5I/wP9A90Dlf8A
JwADkwP+A/AD7QPsA+sG6gPpA+gD5wPmA+UG5APjA+ID4QPgA98G3g/dA+AD/QOT/wAnAAOTA/8D7wN7
A+4DrwOwA6UDqgPEA6QDrgO8A9IDrgO3A5sDnQPHA6cDjQOXA7oDnwOcA90DcgPdA/8Dk/8AJwADkwP/
Expand Down
153 changes: 145 additions & 8 deletions vbDeviceSpy/player.vb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Public Class Player
End Get
End Property

Public ReadOnly Property CurrentTrack() As Track
Public ReadOnly Property CurrentTrack() As TrackHolder
Get

'Throw New NotImplementedException()
Expand Down Expand Up @@ -438,15 +438,15 @@ Public Class Player

#Region "Queue/Station Actions"

Public Sub SetAVTransportURI(track As Track)
Public Sub SetAVTransportURI(track As TrackHolder)
Dim arguments = New UPnPArgument(2) {}
arguments(0) = New UPnPArgument("InstanceID", 0UI)
arguments(1) = New UPnPArgument("CurrentURI", track.Uri)
arguments(2) = New UPnPArgument("CurrentURIMetaData", track.MetaData)
AVTransport.InvokeAsync("SetAVTransportURI", arguments)
End Sub

Public Function Enqueue(track As Track, Optional asNext As Boolean = False) As UInteger
Public Function Enqueue(track As TrackHolder, Optional asNext As Boolean = False) As UInteger
Dim arguments = New UPnPArgument(7) {}
arguments(0) = New UPnPArgument("InstanceID", 0UI)
arguments(1) = New UPnPArgument("EnqueuedURI", track.Uri)
Expand Down Expand Up @@ -626,7 +626,7 @@ Public Class PlayerState
Private m_NextTrackMetaData As String
End Class

Public Class Track
Public Class TrackHolder
Public Property Uri() As String
Get
Return m_Uri
Expand All @@ -652,13 +652,13 @@ End Class

Public Class SonosItem
Private m_DIDL As SonosDIDL
Private m_Track As Track
Private m_Track As TrackHolder

Public Overridable Property Track() As Track
Public Overridable Property Track() As TrackHolder
Get
Return m_Track
End Get
Set(value As Track)
Set(value As TrackHolder)
m_Track = value
End Set
End Property
Expand All @@ -673,6 +673,7 @@ Public Class SonosItem
End Property



Public Shared Function Parse(xmlString As String) As IList(Of SonosItem)
Dim xml = XElement.Parse(xmlString)
Dim ns As XNamespace = "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"
Expand All @@ -685,7 +686,7 @@ Public Class SonosItem
Dim list = New List(Of SonosItem)()

For Each item As XElement In items
Dim track = New Track()
Dim track = New TrackHolder()

'track.Uri = DirectCast(item.Element(ns + "res"), String)
'track.MetaData = DirectCast(item.Element(r + "resMD"), String)
Expand Down Expand Up @@ -850,6 +851,142 @@ Public Class SonosDIDL

End Class

Public Class TrackInfo

Private m_AlbumArtURI As String
Private m_Title As String
Private m_Artist As String
Private m_Album As String
Private m_Uri As String
Private m_Description As String
Private m_AlbumArtist As String
Private m_TrackNumber As String
Private m_class As String
Private m_StreamContent As String



Public Property AlbumArtURI() As String
Get
Return m_AlbumArtURI
End Get
Set(value As String)
m_AlbumArtURI = value
End Set
End Property

Public Property AlbumArtist As String
Get
Return m_AlbumArtist
End Get
Set(ByVal value As String)
m_AlbumArtist = value
End Set
End Property

Public Property ItemClass As String
Get
Return m_class
End Get
Set(ByVal value As String)
m_class = value
End Set
End Property

Public Property StreamContent As String
Get
Return m_StreamContent
End Get
Set(ByVal value As String)
m_StreamContent = value
End Set
End Property

Public Property TrackNumber As String
Get
Return m_TrackNumber
End Get
Set(ByVal value As String)
m_TrackNumber = value
End Set
End Property

Public Property Title() As String
Get
Return m_Title
End Get
Set(value As String)
m_Title = value
End Set
End Property

Public Property Artist() As String
Get
Return m_Artist
End Get
Set(value As String)
m_Artist = value
End Set
End Property

Public Property Album() As String
Get
Return m_Album
End Get
Set(value As String)
m_Album = value
End Set
End Property

Public Property Uri() As String
Get
Return m_Uri
End Get
Set(value As String)
m_Uri = value
End Set
End Property

Public Property Description() As String
Get
Return m_Description
End Get
Set(value As String)
m_Description = value
End Set
End Property

Public Shared Function Parse(xml As String) As TrackInfo
Dim didl = XElement.Parse(xml)
Return Parse(didl)
End Function

Public Shared Function Parse(didl As XElement) As TrackInfo
Dim ns As XNamespace = "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"
Dim dc As XNamespace = "http://purl.org/dc/elements/1.1/"
Dim upnp As XNamespace = "urn:schemas-upnp-org:metadata-1-0/upnp/"
Dim r As XNamespace = "urn:schemas-rinconnetworks-com:metadata-1-0/"

Dim items = didl.Elements(ns + "item")

'Dim list = New List(Of SonosDIDL)()
Dim response = New TrackInfo
For Each item As XElement In items

response.AlbumArtURI = item.Element(upnp + "albumArtURI").Value
response.Artist = item.Element(dc + "creator").Value
response.Title = item.Element(dc + "title").Value
response.Album = item.Element(upnp + "album").Value
response.AlbumArtist = item.Element(r + "albumArtist").Value
response.TrackNumber = item.Element(upnp + "originalTrackNumber").Value
response.ItemClass = item.Element(upnp + "class").Value
response.StreamContent = item.Element(r + "streamContent").Value
Next

Return response
End Function
End Class

Public Class MediaInfo
Public Property NrOfTracks() As UInteger
Get
Expand Down

0 comments on commit 427b81b

Please sign in to comment.