|
@@ -98,29 +98,25 @@ def download_video(url):
|
|
|
"""
|
|
|
conf = configuration.Conf.get_instance()
|
|
|
try:
|
|
|
- youtube_dl_format = "%s[height=%s]+%s" % \
|
|
|
+ youtube_dl_format = "%s[height=%s]+%s/%s+best" % \
|
|
|
(conf.get_value("video_codec"),
|
|
|
conf.get_value("video_height"),
|
|
|
- conf.get_value("audio_quality"))
|
|
|
+ conf.get_value("audio_quality"),
|
|
|
+ conf.get_value("video_codec"))
|
|
|
LOGGER.debug(_("Executing command: %s -f %s %s"),
|
|
|
conf.values["youtube-dl"], youtube_dl_format, url)
|
|
|
- if conf.outputlevel == "default":
|
|
|
- subprocess.check_call([conf.values["youtube-dl"], "-f %s"
|
|
|
- % youtube_dl_format,
|
|
|
- "-o", "%(title)s-%(id)s.%(ext)s", url],
|
|
|
- stderr=sys.stderr,
|
|
|
- stdout=open("/dev/null", "w"))
|
|
|
- elif conf.outputlevel == "verbose":
|
|
|
- subprocess.check_call([conf.values["youtube-dl"], "-f %s"
|
|
|
- % youtube_dl_format,
|
|
|
- "-o", "%(title)s-%(id)s.%(ext)s", url],
|
|
|
- stderr=sys.stderr, stdout=sys.stdout)
|
|
|
+ stderr = open("/dev/null", "w")
|
|
|
+ stdout = sys.stdout
|
|
|
+ if conf.outputlevel == "verbose":
|
|
|
+ stderr = sys.stderr
|
|
|
elif conf.outputlevel == "quiet":
|
|
|
- subprocess.check_call([conf.values["youtube-dl"],
|
|
|
- "-f %s" % youtube_dl_format,
|
|
|
- "-o", "%(title)s-%(id)s.%(ext)s", url],
|
|
|
- stderr=open("/dev/null", "w"),
|
|
|
- stdout=open("/dev/null", "w"))
|
|
|
+ stdout = open("/dev/null", "w")
|
|
|
+ stderr = open("/dev/null", "w")
|
|
|
+ subprocess.check_call([conf.values["youtube-dl"], "-f %s"
|
|
|
+ % youtube_dl_format,
|
|
|
+ "-o", "%(title)s-%(id)s.%(ext)s", url],
|
|
|
+ stderr=stderr,
|
|
|
+ stdout=stdout)
|
|
|
except subprocess.CalledProcessError as error:
|
|
|
LOGGER.debug(_("Error while calling youtube-dl: %s"), error.output)
|
|
|
raise stov_exceptions.YoutubeDlCallFailed()
|