added option to change output container

This commit is contained in:
Kjistóf 2017-01-16 02:11:23 +01:00
parent 83a2f82d23
commit c2c7d52075

View File

@ -12,9 +12,11 @@ from argparse import ArgumentParser
# parse arguments
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('-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.')
args = parser.parse_args()
args.extension = '.' + args.extension
VERBOSE = False if args.nonverbose else True
@ -89,13 +91,13 @@ def yes_no_question(question, default):
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]
URL = args.url
# 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
if exists(FILES[File.OUTPUT]):