summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2014-04-30 10:02:03 +0200
committerPhilipp Hagemeister <[email protected]>2014-04-30 10:02:08 +0200
commitacd69589a54d03f60a018a298c74a4c8aef2abc2 (patch)
tree3b5bc9562ec450c4e89fafdf914740193c80b0b8 /youtube_dl/YoutubeDL.py
parentb30b8698ea11e85079cc9e392cdf26f4e61671c4 (diff)
downloadyoutube-dl-acd69589a54d03f60a018a298c74a4c8aef2abc2.tar.gz
youtube-dl-acd69589a54d03f60a018a298c74a4c8aef2abc2.zip
[YoutubeDL] Do not require default output template to be set
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-xyoutube_dl/YoutubeDL.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index e9811bd05..f3666573a 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -31,6 +31,7 @@ from .utils import (
ContentTooShortError,
date_from_str,
DateRange,
+ DEFAULT_OUTTMPL,
determine_ext,
DownloadError,
encodeFilename,
@@ -440,7 +441,8 @@ class YoutubeDL(object):
if v is not None)
template_dict = collections.defaultdict(lambda: 'NA', template_dict)
- tmpl = os.path.expanduser(self.params['outtmpl'])
+ outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)
+ tmpl = os.path.expanduser(outtmpl)
filename = tmpl % template_dict
return filename
except ValueError as err:
@@ -1025,10 +1027,11 @@ class YoutubeDL(object):
def download(self, url_list):
"""Download a given list of URLs."""
+ outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)
if (len(url_list) > 1 and
- '%' not in self.params['outtmpl']
+ '%' not in outtmpl
and self.params.get('max_downloads') != 1):
- raise SameFileError(self.params['outtmpl'])
+ raise SameFileError(outtmpl)
for url in url_list:
try: