Add set_metadata to allow taginjection for shoutcast stream
This commit is contained in:
parent
85970dbc3b
commit
f4db449f0e
@ -21,6 +21,7 @@ class SpotifyPlaybackProvider(BasePlaybackProvider):
|
||||
Link.from_string(track.uri).as_track())
|
||||
self.backend.spotify.session.play(1)
|
||||
self.backend.output.play_uri('appsrc://')
|
||||
self.backend.output.set_metadata(track)
|
||||
return True
|
||||
except SpotifyError as e:
|
||||
logger.warning('Play %s failed: %s', track.uri, e)
|
||||
|
||||
@ -89,3 +89,17 @@ class BaseOutput(object):
|
||||
:rtype: :class:`True` if successful, else :class:`False`
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_metadata(self, track):
|
||||
"""
|
||||
Set track metadata for currently playing song.
|
||||
|
||||
Only needs to be called by sources such as appsrc which don't already
|
||||
inject tags in pipeline.
|
||||
|
||||
*MUST be implemented by subclass.*
|
||||
|
||||
:param track: Track containing metadata for current song.
|
||||
:type track: :class:`mopidy.modes.Track`
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@ -197,3 +197,12 @@ class GStreamerOutput(ThreadingActor, BaseOutput):
|
||||
"""Set volume in range [0..100]"""
|
||||
self.gst_volume.set_property('volume', volume / 100.0)
|
||||
return True
|
||||
|
||||
def set_metadata(self, track):
|
||||
tags = u'artist="%(artist)s",title="%(title)s",album="%(album)s"' % {
|
||||
'artist': u', '.join([a.name for a in track.artists]),
|
||||
'title': track.name,
|
||||
'album': track.album.name,
|
||||
}
|
||||
logger.debug('Setting tags to: %s', tags)
|
||||
self.gst_taginject.set_property('tags', tags)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user