mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 04:05:39 +01:00
select_quality: Replace sys.exits with UIExceptions
This commit is contained in:
parent
dad2790d9e
commit
84ca17a14c
@ -108,14 +108,12 @@ def select_quality(options, streams):
|
|||||||
try:
|
try:
|
||||||
optq = int(options.quality)
|
optq = int(options.quality)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
log.error("Requested quality need to be a number")
|
raise error.UIException("Requested quality needs to be a number")
|
||||||
sys.exit(4)
|
|
||||||
if optq:
|
if optq:
|
||||||
try:
|
try:
|
||||||
optf = int(options.flexibleq)
|
optf = int(options.flexibleq)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
log.error("Flexible-quality need to be a number")
|
raise error.UIException("Flexible-quality needs to be a number")
|
||||||
sys.exit(4)
|
|
||||||
if not optf:
|
if not optf:
|
||||||
wanted = [optq]
|
wanted = [optq]
|
||||||
else:
|
else:
|
||||||
@ -131,9 +129,8 @@ def select_quality(options, streams):
|
|||||||
if not selected and selected != 0:
|
if not selected and selected != 0:
|
||||||
data = sort_quality(streams)
|
data = sort_quality(streams)
|
||||||
quality = ", ".join("%s (%s)" % (str(x), str(y)) for x, y in data)
|
quality = ", ".join("%s (%s)" % (str(x), str(y)) for x, y in data)
|
||||||
log.error("Can't find that quality. Try one of: %s (or try --flexible-quality)", quality)
|
raise error.UIException("Can't find that quality. Try one of: %s (or "
|
||||||
|
"try --flexible-quality)" % quality)
|
||||||
sys.exit(4)
|
|
||||||
|
|
||||||
for s in streams:
|
for s in streams:
|
||||||
if s.bitrate == selected:
|
if s.bitrate == selected:
|
||||||
|
Loading…
Reference in New Issue
Block a user