bazwilliams / openhomedevice

Python library to access services on Linn Ds and other Openhome devices
MIT License
7 stars 3 forks source link

TrackInfo is not complete #3

Closed KeesKemper closed 7 years ago

KeesKemper commented 7 years ago

When I check the trackInfo there is no performer, no publisher etc.

bazwilliams commented 7 years ago

Can you send me details of the track you are listening to please? Could be a metadata parsing issue

bazwilliams commented 7 years ago

Not a parsing bug, simply not implemented at all! The library was originally written for home assistant which had no way of using the other fields so I'll add the rest shortly.

Thanks for raising the issue!

bazwilliams commented 7 years ago

I should change the track info object to contain the following information. It will be a breaking change for existing clients, but better in the long run as this is an emerging standard.

  {
    "type": "{type}" // upnp:class
    "provider": "{provider}" // oh:provider
    "title": "{title}" // dc:title
    "artwork": "{artwork}" // oh:artwork
    "uri": "{uri}" // DIDL-Lite:res
    "artist": [ "{artist1}", "{artist2}" ] // upnp:artist
    "composer": [ "{composer1}", "{composer2}" ] // upnp:artist @role=composer
    "conductor": [ "{conductor1}", "{conductor2}" ] // upnp:artist @role=conductor
    "genre": [ "{genre1}", "{genre2}" ] // upnp:genre
    "albumTitle": "{albumTitle}" // upnp:album
    "albumArtwork": "{albumArtwork}" // upnp:albumArtURI
    "albumArtist": [ "{albumArtist1}", "{albumArtist2}" ] // upnp:artist @role=AlbumArtist
    "albumGenre": [ "{albumGenre1}", "{albumArtist2}" ] // upnp:genre
    "year": {year} // dc:date
    "disc": {disc} // oh:originalDiscNumber
    "discs": {discs} // oh:originalDiscCount
    "track": {track} // upnp:originalTrackNumber
    "tracks": {tracks} // oh:originalTrackCount
    "channels": {channels} // DIDL-Lite:res @nrAudioChannels
    "bitDepth": {bitDepth} // DIDL-Lite:res @bitsPerSample
    "sampleRate": {sampleRate} // DIDL-Lite:res @sampleFrequency
    "bitRate": {bitRate} // DIDL-Lite:res @bitrate
    "duration": {duration} // DIDL-Lite:res @duration // seconds, zero = live/eternal
    "mimeType": "{mimeType}" // DIDL-Lite:res @protocolInfo
    "work": "{work}" // oh:work
    "movement": "{movement}" // oh:movement
    "show": "{show}" // oh:show
    "episode": {episode} // oh:episodeNumber
    "episodes": {episodes} // oh:episodeCount
    "author": [ "{author1}", "{author2}" ] // dc:author
    "narrator": [ "{narrator1}", "{narrator2}" ] // upnp:artist @role=narrator
    "performer": [ "{performer1}", "{performer2}" ] // upnp:artist @role=performer
    "publisher": "{publisher}" // dc:publisher
    "published": "{published}" // oh:published // ISO 8601
    "website": "{website}" // oh:website
    "location": "{location}" // oh:location // ISO 6709
    "details": "{details}" // oh:details
    "description": "{description}" // dc:description
    "rating": {rating} // upnp:rating
    "extensions": "{extensions}" // oh:extensions // stringified json
  }
bazwilliams commented 7 years ago

Started a branch: https://github.com/bazwilliams/openhomedevice/tree/track-info

KeesKemper commented 7 years ago

Indeed, now I see much more in the trackInfo. Thanks a lot.

NAME : b'Adrestia' ROOM : b'Huiskamer' UUID : 3ae23d80-a787-0f90-ffff-ffffb95f0bf5 SOURCE : {'type': 'Playlist', 'name': 'Playlist'} STANDBY : False STATE : Playing TRACK : {'artist': 'Franz Gerihsen, Performer\n - Andrea Weigt, Performer\n - Marietta Schwittay-Niedzwicki, Performer\n - Harald Martini, Performer\n - Beata Borchert, Performer\n - Boris Pohlmann, Performer\n - Hee-Kwang Lee, Performer\n - Rupert Huber, Conductor\n - Cologne West German Radio Chorus, Choir\n - GrauSchumacher Piano Duo, Ensemble\n - Paul Gerhardt, Lyricist\n - Franz Liszt, Composer\n - Venantius Fortunatus, Lyricist\n - Johann Rist, Lyricist', 'year': '2013', 'track': '1', 'type': 'object.item.audioItem.musicTrack', 'description': None, 'rating': None, 'albumArtwork': 'http://static.qobuz.com/images/covers/24/90/4260063209024_600.jpg', 'title': 'Via Crucis, S53/R534 (version for solo voices, chorus and piano 4 hands) : Via Crucis, S53/R534 (version for solo voices, chorus and piano 4 hands): Einleitung: Vexilla regis prodeunt', 'author': None, 'tracks': None, 'albumTitle': 'Via Crucis', 'uri': 'http://192.168.0.110:58050/stream/audio/f1e22d6ae17a2173200ca0150f886de8.flac', 'publisher': 'NEOS Music', 'published': None, 'genre': 'Klassiek'} VOLUME : 100 MUTED : False SOURCES : []

KeesKemper commented 7 years ago

See below a track information from openhomedevice:

TRACK : {'rating': None, 'track': '2', 'albumArtwork': 'http://static.qobuz.com/images/covers/58/20/8424562332058_600.jpg', 'publisher': 'Glossa', 'author': None, 'year': '2017', 'published': None, 'albumTitle': 'The Bach Album', 'artist': 'Fahmi Alqhai', 'uri': 'http://192.168.0.110:58050/stream/audio/ca6749d552f7d312f18ef9a00511e219.flac', 'genre': 'Klassiek', 'tracks': None, 'type': 'object.item.audioItem.musicTrack', 'title': 'Violin Sonata No. 2 in A Minor, BWV 1003 (Arr. for Viola da gamba) : Violin Sonata No. 2 in A Minor, BWV 1003 (Arr. for Viola da gamba): II. Fuga', 'description': 'Digital booklet

'}

When I check the track info with BubbleUPnP on my Android phone I also see the following track information: Track number, Duration, Performer. I expect to see that in openhomedevice too.

bazwilliams commented 7 years ago

Thanks for the information, there are some gaps in the implementation at the moment. Would you be able to to pull the latest version and send me the output for the above track please?

This will give me more data for the parser so I can test it here.

KeesKemper commented 7 years ago

This is what I get now:

TRACK : {'albumArtwork': 'http://static.qobuz.com/images/covers/58/20/8424562332058_600.jpg', 'author': None, 'uri': 'http://192.168.0.110:58050/stream/audio/d4b655bd8c13dadc42c827acff612ec7.flac', 'type': 'object.item.audioItem.musicTrack', 'tracks': None, 'publisher': 'Glossa', 'published': None, 'description': 'Digital booklet

', 'artist': 'Fahmi Alqhai', 'track': '2', 'genre': 'Klassiek', 'albumTitle': 'The Bach Album', 'title': 'Violin Sonata No. 2 in A Minor, BWV 1003 (Arr. for Viola da gamba) : Violin Sonata No. 2 in A Minor, BWV 1003 (Arr. for Viola da gamba): II. Fuga', 'year': '2017', 'rating': None}

bazwilliams commented 7 years ago

I was hoping to see the output from the library, I added a print between done dashes with the output I receive from the device. Should look like some xml

KeesKemper commented 7 years ago

New try:


b'<?xml version="1.0" encoding="utf-8" standalone="yes"?>http://192.168.0.110:58050/stream/audio/7b326d979926ad934bd38bcfb46bc635.flac<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:sec="http://www.sec.co.kr/" xmlns:pv="http://www.pv.com/pvns/"&gt;&lt;item id="qobuz/albums/8424562332058/37122565" parentID="qobuz/albums/8424562332058" restricted="1"><upnp:class>object.item.audioItem.musicTrack</upnp:class><dc:title>Violin Partita No. 2 in D Minor, BWV 1004 (Arr. for Viola da gamba) : Violin Partita No. 2 in D Minor, BWV 1004 (Arr. for Viola da gamba): V. Ciaccona</dc:title><dc:creator>Fahmi Alqhai</dc:creator><upnp:artist>Fahmi Alqhai</upnp:artist><upnp:artist role="Performer">Fahmi Alqhai, Performer - Johann Sebastian Bach, Composer</upnp:artist><dc:publisher>Glossa</dc:publisher><upnp:albumArtURI>http://static.qobuz.com/images/covers/58/20/8424562332058_600.jpg&lt;/upnp:albumArtURI&gt;&lt;upnp:albumArtURI dlna:profileID="JPEG_TN">http://static.qobuz.com/images/covers/58/20/8424562332058_230.jpg&lt;/upnp:albumArtURI&gt;&lt;upnp:genre&gt;Klassiek&lt;/upnp:genre&gt;&lt;dc:date&gt;2017-01-06&lt;/dc:date&gt;&lt;dc:description&gt;&amp;lt;a href="http://static.qobuz.com/goodies/44/000096244.pdf"&amp;gt;Digital booklet&lt;/a&gt;&lt;br&gt;&lt;br&gt;</dc:description><upnp:album>The Bach Album</upnp:album><upnp:originalTrackNumber>15</upnp:originalTrackNumber><ownerUdn>000974e2-681e-1a36-ffff-ffffa38afd93</ownerUdn><res protocolInfo="http-get:*:audio/x-flac:DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000" bitsPerSample="16" sampleFrequency="44100" nrAudioChannels="2" duration="0:13:43.000">http://192.168.0.110:58050/stream/audio/7b326d979926ad934bd38bcfb46bc635.flac&lt;/res&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</u:TrackResponse></s:Body></s:Envelope>'

KeesKemper commented 7 years ago

New try:


b'<?xml version="1.0" encoding="utf-8" standalone="yes"?>http://192.168.0.110:58050/stream/audio/b362f0f7a1ff33b176bcf2adde75af96.flac<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:sec="http://www.sec.co.kr/" xmlns:pv="http://www.pv.com/pvns/"&gt;&lt;item id="qobuz/albums/8424562332058/37122539" parentID="qobuz/albums/8424562332058" restricted="1"><upnp:class>object.item.audioItem.musicTrack</upnp:class><dc:title>Violin Sonata No. 2 in A Minor, BWV 1003 (Arr. for Viola da gamba) : Violin Sonata No. 2 in A Minor, BWV 1003 (Arr. for Viola da gamba): II. Fuga</dc:title><dc:creator>Fahmi Alqhai</dc:creator><upnp:artist>Fahmi Alqhai</upnp:artist><upnp:artist role="Performer">Fahmi Alqhai, Performer - Johann Sebastian Bach, Composer</upnp:artist><dc:publisher>Glossa</dc:publisher><upnp:albumArtURI>http://static.qobuz.com/images/covers/58/20/8424562332058_600.jpg&lt;/upnp:albumArtURI&gt;&lt;upnp:albumArtURI dlna:profileID="JPEG_TN">http://static.qobuz.com/images/covers/58/20/8424562332058_230.jpg&lt;/upnp:albumArtURI&gt;&lt;upnp:genre&gt;Klassiek&lt;/upnp:genre&gt;&lt;dc:date&gt;2017-01-06&lt;/dc:date&gt;&lt;dc:description&gt;&amp;lt;a href="http://static.qobuz.com/goodies/44/000096244.pdf"&amp;gt;Digital booklet&lt;/a&gt;&lt;br&gt;&lt;br&gt;</dc:description><upnp:album>The Bach Album</upnp:album><upnp:originalTrackNumber>2</upnp:originalTrackNumber><ownerUdn>000974e2-681e-1a36-ffff-ffffa38afd93</ownerUdn><res protocolInfo="http-get:*:audio/x-flac:DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000" bitsPerSample="16" sampleFrequency="44100" nrAudioChannels="2" duration="0:07:40.000">http://192.168.0.110:58050/stream/audio/b362f0f7a1ff33b176bcf2adde75af96.flac&lt;/res&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</u:TrackResponse></s:Body></s:Envelope>'

bazwilliams commented 7 years ago

That's really helpful thanks! Will see what I can do this weekend.

bazwilliams commented 7 years ago

I've added more metadata parsing in that branch, your example track now yields:

{
  "mimeType": "http-get:*:audio/x-flac:DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000",
  "rating": null,
  "performer": [
    "Fahmi Alqhai, Performer - Johann Sebastian Bach, Composer"
  ],
  "bitDepth": 16,
  "channels": 2,
  "disc": null,
  "composer": [],
  "year": 2017,
  "duration": 0,
  "author": [],
  "albumArtist": [],
  "type": "object.item.audioItem.musicTrack",
  "narrator": [],
  "description": null,
  "conductor": [],
  "albumArtwork": "http://static.qobuz.com/images/covers/58/20/8424562332058_600.jpg",
  "track": 2,
  "tracks": null,
  "artwork": null,
  "genre": [
    "Klassiek"
  ],
  "publisher": [
    "Glossa"
  ],
  "albumGenre": [
    "Klassiek"
  ],
  "artist": [
    "Fahmi Alqhai"
  ],
  "bitRate": null,
  "albumTitle": [
    "The Bach Album"
  ],
  "uri": "http://192.168.0.110:58050/stream/audio/b362f0f7a1ff33b176bcf2adde75af96.flac",
  "discs": null,
  "published": [],
  "title": "Violin Sonata No. 2 in A Minor, BWV 1003 (Arr. for Viola da gamba) : Violin Sonata No. 2 in A Minor, BWV 1003 (Arr. for Viola da gamba): II. Fuga",
  "sampleRate": 44100
}
KeesKemper commented 7 years ago

For me it is usable in this way. Thanks a lot,

bazwilliams commented 7 years ago

Great - I'll bump the version and publish a new library tonight

bazwilliams commented 7 years ago

Now published as https://pypi.python.org/pypi/openhomedevice/0.3.0