From 87b1c9455c89b9dbd245d5851d55659e2b2621b6 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Mon, 26 Oct 2015 23:37:22 +0100 Subject: [PATCH] gst1: Update query_duration() usage --- mopidy/audio/scan.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index 9d7ecde5..c51762b9 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -114,15 +114,12 @@ def _start_pipeline(pipeline): def _query_duration(pipeline): - try: - duration = pipeline.query_duration(Gst.Format.TIME, None)[0] - except Gst.QueryError: + success, duration = pipeline.query_duration(Gst.Format.TIME) + + if not success or duration < 0: return None - if duration < 0: - return None - else: - return duration // Gst.MSECOND + return duration // Gst.MSECOND def _query_seekable(pipeline):