|
@@ -89,33 +89,35 @@ def get_title(url):
|
|
|
return video_title
|
|
|
|
|
|
|
|
|
-def download_video(url, itag_value):
|
|
|
+def download_video(url):
|
|
|
"""
|
|
|
Downloads a video from a specified url using youtube-dl.
|
|
|
|
|
|
- :param itag_value: video and audio parameter
|
|
|
- :type itag_value: str
|
|
|
:param url: URL to pass to youtube-dl
|
|
|
:type url: str
|
|
|
"""
|
|
|
conf = configuration.Conf.get_instance()
|
|
|
try:
|
|
|
+ youtube_dl_format = "%s[height=%s]+%s" % \
|
|
|
+ (conf.get_value("video_codec"),
|
|
|
+ conf.get_value("video_height"),
|
|
|
+ conf.get_value("audio_quality"))
|
|
|
LOGGER.debug(_("Executing command: %s -f %s %s"),
|
|
|
- conf.values["youtube-dl"], itag_value, url)
|
|
|
+ conf.values["youtube-dl"], youtube_dl_format, url)
|
|
|
if conf.outputlevel == "default":
|
|
|
subprocess.check_call([conf.values["youtube-dl"], "-f %s"
|
|
|
- % itag_value,
|
|
|
+ % 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"
|
|
|
- % itag_value,
|
|
|
+ % youtube_dl_format,
|
|
|
"-o", "%(title)s-%(id)s.%(ext)s", url],
|
|
|
stderr=sys.stderr, stdout=sys.stdout)
|
|
|
elif conf.outputlevel == "quiet":
|
|
|
subprocess.check_call([conf.values["youtube-dl"],
|
|
|
- "-f %s/%s" % itag_value,
|
|
|
+ "-f %s" % youtube_dl_format,
|
|
|
"-o", "%(title)s-%(id)s.%(ext)s", url],
|
|
|
stderr=open("/dev/null", "w"),
|
|
|
stdout=open("/dev/null", "w"))
|