diff options
author | Ricardo Garcia <sarbalap+freshmeat@gmail.com> | 2008-07-21 23:29:06 +0200 |
---|---|---|
committer | Ricardo Garcia <devnull@localhost> | 2008-07-21 23:29:06 +0200 |
commit | b46347267a8c460561d1bc3589c7eab55b6a4655 (patch) | |
tree | c67b3614e317da3d5a412a62b654041499fef20a | |
parent | 4fa74b5252a23c2890ddee52b8ee5811b5bb2987 (diff) | |
download | youtube-dl-b46347267a8c460561d1bc3589c7eab55b6a4655.tar.xz |
Check the output name is not fixed when there are several videos to download
-rwxr-xr-x | youtube-dl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/youtube-dl b/youtube-dl index 45773fda2..dfbdc4a47 100755 --- a/youtube-dl +++ b/youtube-dl @@ -38,7 +38,7 @@ class FileDownloader(object): For this, file downloader objects have a method that allows InfoExtractors to be registered in a given order. When it is passed a URL, the file downloader handles it to the first InfoExtractor it - finds that reports it's able to handle it. The InfoExtractor returns + finds that reports being able to handle it. The InfoExtractor returns all the information to the FileDownloader and the latter downloads the file or does whatever it's instructed to do. @@ -153,9 +153,12 @@ class FileDownloader(object): continue # Suitable InfoExtractor found suitable_found = True - for result in ie.extract(url): - if result is None: - continue + results = [x for x in ie.extract(url) if x is not None] + + if (len(url_list) > 1 or len(results) > 1) and re.search(r'%\(.+?\)s', self._params['outtmpl']) is None: + sys.exit('ERROR: fixed output name but more than one file to download') + + for result in results: try: filename = self._params['outtmpl'] % result except (KeyError), err: |