mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 03:03:01 +00:00
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
This commit is contained in:
parent
9ee859b683
commit
dca02c80bc
1 changed files with 3 additions and 3 deletions
|
@ -604,10 +604,10 @@ def _real_main(argv=None):
|
||||||
or (opts.useid and u'%(id)s.%(ext)s')
|
or (opts.useid and u'%(id)s.%(ext)s')
|
||||||
or (opts.autonumber and u'%(autonumber)s-%(id)s.%(ext)s')
|
or (opts.autonumber and u'%(autonumber)s-%(id)s.%(ext)s')
|
||||||
or u'%(title)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'
|
parser.error(u'Cannot download a video and extract audio into the same'
|
||||||
u' file! Use "%%(ext)s" instead of %r' %
|
u' file! Use "{0}.%(ext)s" instead of "{0}" as the output'
|
||||||
determine_ext(outtmpl, u''))
|
u' template'.format(outtmpl))
|
||||||
|
|
||||||
ydl_opts = {
|
ydl_opts = {
|
||||||
'usenetrc': opts.usenetrc,
|
'usenetrc': opts.usenetrc,
|
||||||
|
|
Loading…
Reference in a new issue