From 23814a9bf5a4dc7b43dc1fd3ae06790560af73e3 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sat, 14 May 2016 11:17:34 +0200 Subject: [PATCH] select_quality: fix crash while using range fixes: #392 --- lib/svtplay_dl/utils/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/svtplay_dl/utils/__init__.py b/lib/svtplay_dl/utils/__init__.py index 9983994..c4d9df3 100644 --- a/lib/svtplay_dl/utils/__init__.py +++ b/lib/svtplay_dl/utils/__init__.py @@ -96,9 +96,12 @@ def protocol_prio(streams, priolist): def select_quality(options, streams): high = 0 if isinstance(options.quality, str): - quality = int(options.quality.split(",")[0]) - if len(options.quality.split(",")) > 1: - high = int(options.quality.split(",")[1]) + try: + quality = int(options.quality.split("-")[0]) + if len(options.quality.split("-")) > 1: + high = int(options.quality.split("-")[1]) + except ValueError: + raise error.UIException("Requested quality is invalid. use a number or range lowerNumber-higherNumber") else: quality = options.quality try: