added option to override output file name
This commit is contained in:
parent
dc03475d49
commit
59b089726e
@ -12,6 +12,7 @@ from argparse import ArgumentParser
|
|||||||
# parse arguments
|
# parse arguments
|
||||||
parser = ArgumentParser(description='Download player-looped videos with youtube-dl & ffmpeg.')
|
parser = ArgumentParser(description='Download player-looped videos with youtube-dl & ffmpeg.')
|
||||||
parser.add_argument('-nv', '--nonverbose', help='Turn off non-critical messages to user.')
|
parser.add_argument('-nv', '--nonverbose', help='Turn off non-critical messages to user.')
|
||||||
|
parser.add_argument('-o', '--output', default=None, help='Specify name of the output file (use -e for extension).')
|
||||||
parser.add_argument('-e', '--extension', default='mp4', help='Set the container to use for the output.')
|
parser.add_argument('-e', '--extension', default='mp4', help='Set the container to use for the output.')
|
||||||
parser.add_argument('url', type=str, help='The URL of the site containing the video to download.')
|
parser.add_argument('url', type=str, help='The URL of the site containing the video to download.')
|
||||||
|
|
||||||
@ -96,8 +97,12 @@ OUTPUT_KEYS = [File.OUTPUT]
|
|||||||
URL = args.url
|
URL = args.url
|
||||||
|
|
||||||
|
|
||||||
# fetch video title
|
# fetch video title if no filename was specified
|
||||||
FILES[File.OUTPUT] = check_output(('youtube-dl', '--get-title', args.url)).decode('utf-8').strip() + args.extension
|
if args.output is None:
|
||||||
|
FILES[File.OUTPUT] = check_output(('youtube-dl', '--get-title', args.url)).decode('utf-8').strip()
|
||||||
|
else:
|
||||||
|
FILES[File.OUTPUT] = args.output
|
||||||
|
FILES[File.OUTPUT] += args.extension
|
||||||
|
|
||||||
# ask what to do if output exists
|
# ask what to do if output exists
|
||||||
if exists(FILES[File.OUTPUT]):
|
if exists(FILES[File.OUTPUT]):
|
||||||
|
Loading…
Reference in New Issue
Block a user