mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-27 13:28:47 +02:00
Add album art
This commit is contained in:
parent
4974410d70
commit
5228b809ed
2 changed files with 11 additions and 0 deletions
|
@ -397,6 +397,14 @@ class MPDWrapper(object):
|
|||
print("Can't cast value %r to %s" %
|
||||
(value, tag_mapping[key][1]))
|
||||
|
||||
if 'title' in mpd_meta and 'album' in mpd_meta:
|
||||
result = musicbrainzngs.search_releases(artist=mpd_meta['title'], release=mpd_meta['album'],
|
||||
limit=1)
|
||||
if result['release-list']:
|
||||
snapmeta['artUrl'] = f"http://coverartarchive.org/release/{result['release-list'][0]['id']}/front-250"
|
||||
print(snapmeta['artUrl'])
|
||||
|
||||
|
||||
r = requests.post('http://127.0.0.1:1780/jsonrpc', json={"id": 4, "jsonrpc": "2.0", "method": "Stream.SetMeta", "params": {
|
||||
"id": "Spotify", "meta": snapmeta}})
|
||||
print(r)
|
||||
|
|
|
@ -407,6 +407,9 @@ class MPDWrapper(object):
|
|||
self._metadata = {}
|
||||
self._metadata['xesam:artist'] = self.__getValue(meta, 'artist', 'Unknown Artist')
|
||||
self._metadata['xesam:title'] = self.__getValue(meta, 'title', 'Unknown Title')
|
||||
if 'artUrl' in meta:
|
||||
self._metadata['mpris:artUrl'] = meta['artUrl']
|
||||
|
||||
self.notify_about_track(self._metadata)
|
||||
|
||||
new_meta = self._dbus_service.update_property('org.mpris.MediaPlayer2.Player',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue