added option to change output container
This commit is contained in:
parent
83a2f82d23
commit
c2c7d52075
@ -12,9 +12,11 @@ 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('-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.')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
args.extension = '.' + args.extension
|
||||||
VERBOSE = False if args.nonverbose else True
|
VERBOSE = False if args.nonverbose else True
|
||||||
|
|
||||||
|
|
||||||
@ -89,13 +91,13 @@ def yes_no_question(question, default):
|
|||||||
|
|
||||||
|
|
||||||
FILES = {Stream.AUDIO: 'audio', Stream.VIDEO: 'video',
|
FILES = {Stream.AUDIO: 'audio', Stream.VIDEO: 'video',
|
||||||
File.LIST: 'list.txt', File.LOOP: 'loop', File.OUTPUT: 'output.mp4'}
|
File.LIST: 'list.txt', File.LOOP: 'loop', File.OUTPUT: 'output'+args.extension}
|
||||||
OUTPUT_KEYS = [File.OUTPUT]
|
OUTPUT_KEYS = [File.OUTPUT]
|
||||||
URL = args.url
|
URL = args.url
|
||||||
|
|
||||||
|
|
||||||
# fetch video title
|
# fetch video title
|
||||||
FILES[File.OUTPUT] = check_output(('/usr/bin/env', 'youtube-dl', '--get-title', args.url)).decode('utf-8').strip() + '.mp4'
|
FILES[File.OUTPUT] = check_output(('/usr/bin/env', 'youtube-dl', '--get-title', args.url)).decode('utf-8').strip() + 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