]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Check the output name is not fixed when there are several videos to download
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>
Mon, 21 Jul 2008 21:29:06 +0000 (23:29 +0200)
committerRicardo Garcia <devnull@localhost>
Mon, 21 Jul 2008 21:29:06 +0000 (23:29 +0200)
youtube-dl

index 45773fda2480257a7cf42b5907118ee9664d629b..dfbdc4a4784f3337099a8289217ae15be9d193d9 100755 (executable)
@@ -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
        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.
 
        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
                                        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:
                                        try:
                                                filename = self._params['outtmpl'] % result
                                        except (KeyError), err: