From 3e12ed1f69d63bbab57d0bcde1ff9f6a7d2674d6 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Thu, 28 Jul 2016 21:16:21 +0200 Subject: [PATCH 1/3] audio: Postpone set_metadata until track is playing --- docs/changelog.rst | 3 +++ mopidy/audio/actor.py | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 22199087..a13baa3d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -35,6 +35,9 @@ Bug fix release. - Audio: Ensure audio tags are never ``None``. (Fixes: :issue:`1449`) +- Audio: Update :meth:`mopidy.audio.Audio.set_metadata` to postpone sending + tags if there is a pending track change. (Fixes: :issue:`1357`) + - Core: Avoid endless loop if all tracks in the tracklist are unplayable and consume mode is off. (Fixes: :issue:`1221`, :issue:`1454`, PR: :issue:`1455`) diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index 61a8e008..f96834e7 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -374,6 +374,10 @@ class _Handler(object): logger.debug('Audio event: tags_changed(tags=%r)', tags.keys()) AudioListener.send('tags_changed', tags=tags.keys()) + if self._audio._pending_metadata: + self._audio._playbin.send_event(self._audio._pending_metadata) + self._audio._pending_metadata = None + def on_segment(self, segment): gst_logger.debug( 'Got SEGMENT pad event: ' @@ -412,6 +416,7 @@ class Audio(pykka.ThreadingActor): self._tags = {} self._pending_uri = None self._pending_tags = None + self._pending_metadata = None self._playbin = None self._outputs = None @@ -800,12 +805,11 @@ class Audio(pykka.ThreadingActor): if track.album and track.album.name: set_value(Gst.TAG_ALBUM, track.album.name) - gst_logger.debug( - 'Sending TAG event for track %r: %r', - track.uri, taglist.to_string()) event = Gst.Event.new_tag(taglist) - # TODO: check if we get this back on our own bus? - self._playbin.send_event(event) + if not self._pending_uri: + self._playbin.send_event(event) + else: + self._pending_metadata = event def get_current_tags(self): """ From 5e8682cc51d751bef70c7e7a795f91ac9be9ed24 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sun, 7 Aug 2016 09:24:45 +0200 Subject: [PATCH 2/3] audio: Address my own comments on PR#1538 --- docs/changelog.rst | 3 ++- mopidy/audio/actor.py | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index a13baa3d..84bac249 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -36,7 +36,8 @@ Bug fix release. - Audio: Ensure audio tags are never ``None``. (Fixes: :issue:`1449`) - Audio: Update :meth:`mopidy.audio.Audio.set_metadata` to postpone sending - tags if there is a pending track change. (Fixes: :issue:`1357`) + tags if there is a pending track change. (Fixes: :issue:`1357`, PR: + :issue:`1538`) - Core: Avoid endless loop if all tracks in the tracklist are unplayable and consume mode is off. (Fixes: :issue:`1221`, :issue:`1454`, PR: :issue:`1455`) diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index f96834e7..6020bc1b 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -805,11 +805,14 @@ class Audio(pykka.ThreadingActor): if track.album and track.album.name: set_value(Gst.TAG_ALBUM, track.album.name) + gst_logger.debug( + 'Sending TAG event for track %r: %r', + track.uri, taglist.to_string()) event = Gst.Event.new_tag(taglist) - if not self._pending_uri: - self._playbin.send_event(event) - else: + if self._pending_uri: self._pending_metadata = event + else: + self._playbin.send_event(event) def get_current_tags(self): """ From a3164ca43b29fc67cf3dfe6b4eba79bbea58ae46 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sun, 7 Aug 2016 09:30:46 +0200 Subject: [PATCH 3/3] docs: PR#1496 fixed #1505 --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 84bac249..d6548865 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -24,7 +24,7 @@ Bug fix release. :issue:`1487`) - Audio: Better handling of seek when position does not match the expected - pending position. (Fixes: :issue:`1462`, PR: :issue:`1496`) + pending position. (Fixes: :issue:`1462`, :issue:`1505`, PR: :issue:`1496`) - Audio: Handle bad date tags from audio, thanks to Mario Lang and Tom Parker who fixed this in parallel. (Fixes: :issue:`1506`, PR: :issue:`1525`,