From af43612630892fc3cc8be9b0f13109b1a89b1198 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Mon, 1 Feb 2016 23:58:00 +0100 Subject: [PATCH] audio: Add a TODO and some notes on duration handling --- mopidy/audio/actor.py | 1 + mopidy/audio/scan.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/mopidy/audio/actor.py b/mopidy/audio/actor.py index 834bee55..db923e6d 100644 --- a/mopidy/audio/actor.py +++ b/mopidy/audio/actor.py @@ -746,6 +746,7 @@ class Audio(pykka.ThreadingActor): # Default to blank data to trick shoutcast into clearing any previous # values it might have. + # TODO: Verify if this works at all, likely it doesn't. set_value(Gst.TAG_ARTIST, ' ') set_value(Gst.TAG_TITLE, ' ') set_value(Gst.TAG_ALBUM, ' ') diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index 0b6831ea..c63405b0 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -137,6 +137,11 @@ def _start_pipeline(pipeline): def _query_duration(pipeline, timeout=100): + # 1. Try and get a duration, return if success. + # 2. Some formats need to play some buffers before duration is found. + # 3. Wait for a duration change event. + # 4. Try and get a duration again. + success, duration = pipeline.query_duration(Gst.Format.TIME) if success and duration >= 0: return duration // Gst.MSECOND