projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
14c3006
)
Improve fixed template checks
author
Ricardo Garcia
<sarbalap+freshmeat@gmail.com>
Tue, 22 Jul 2008 07:45:49 +0000
(09:45 +0200)
committer
Ricardo Garcia
<devnull@localhost>
Tue, 22 Jul 2008 07:45:49 +0000
(09:45 +0200)
youtube-dl
patch
|
blob
|
history
diff --git
a/youtube-dl
b/youtube-dl
index d3f2771101aa0bb0b0811ce08d02ec89a9468035..0df6ba14104cdefc0761d31a57225c10bb5d3772 100755
(executable)
--- a/
youtube-dl
+++ b/
youtube-dl
@@
-152,9
+152,16
@@
class FileDownloader(object):
def to_stderr(self, message):
"""Print message to stderr."""
sys.stderr.write('%s\n' % message)
def to_stderr(self, message):
"""Print message to stderr."""
sys.stderr.write('%s\n' % message)
+
+ def fixed_template(self):
+ """Checks if the output template is fixed."""
+ return (re.search(ur'%\(.+?\)s', self._params['outtmpl']) is None)
def download(self, url_list):
"""Download a given list of URLs."""
def download(self, url_list):
"""Download a given list of URLs."""
+ if len(url_list) > 1 and self.fixed_template():
+ sys.exit('ERROR: fixed output name but more than one file to download')
+
for url in url_list:
suitable_found = False
for ie in self._ies:
for url in url_list:
suitable_found = False
for ie in self._ies:
@@
-164,7
+171,7
@@
class FileDownloader(object):
suitable_found = True
results = [x for x in ie.extract(url) if x is not None]
suitable_found = True
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
:
+ if
len(results) > 1 and self.fixed_template()
:
sys.exit('ERROR: fixed output name but more than one file to download')
if self._params.get('simulate', False):
sys.exit('ERROR: fixed output name but more than one file to download')
if self._params.get('simulate', False):