diff options
author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-12-15 11:42:38 +0100 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-12-15 11:42:38 +0100 |
commit | dca02c80bc5c370bb3b15c9343d255dd124d2a93 (patch) | |
tree | 6d951fa47dd2e79bce705cff4ced602bea400869 | |
parent | 9ee859b683cd19bcdc01c2b6271ad7380a402ad2 (diff) |
Fix detection of the extension if the 'extractaudio' is given and improve the error message (#1969)
Using 'foo.mp4' shouldn't raise an error.
If 'foo' is given suggest using 'foo.%(ext)s' for the template
-rw-r--r-- | youtube_dl/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 3e82cd637..55e59814b 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -604,10 +604,10 @@ def _real_main(argv=None): or (opts.useid and u'%(id)s.%(ext)s') or (opts.autonumber and u'%(autonumber)s-%(id)s.%(ext)s') or u'%(title)s-%(id)s.%(ext)s') - if '%(ext)s' not in outtmpl and opts.extractaudio: + if not os.path.splitext(outtmpl)[1] and opts.extractaudio: parser.error(u'Cannot download a video and extract audio into the same' - u' file! Use "%%(ext)s" instead of %r' % - determine_ext(outtmpl, u'')) + u' file! Use "{0}.%(ext)s" instead of "{0}" as the output' + u' template'.format(outtmpl)) ydl_opts = { 'usenetrc': opts.usenetrc, |