From 89d1a45fc78f0a0035160153f3197153728ebc15 Mon Sep 17 00:00:00 2001 From: Osmo Salomaa Date: Sun, 27 Dec 2020 21:07:21 +0200 Subject: [PATCH] Add better error message if no video streams Part of #153 --- gaupol/player.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gaupol/player.py b/gaupol/player.py index ee1e96dc..2617c04d 100644 --- a/gaupol/player.py +++ b/gaupol/player.py @@ -358,6 +358,10 @@ def set_uri(self, uri): from gi.repository import GstPbutils discoverer = GstPbutils.Discoverer() self._info = discoverer.discover_uri(uri) + streams = self._info.get_stream_list() + stream_types = [x.get_stream_type_nick() for x in streams] + if "video" not in stream_types: + raise Exception(_("No video streams found")) stream = self._info.get_video_streams()[0] num = float(stream.get_framerate_num()) denom = float(stream.get_framerate_denom())