From c2c7d5207532877c2a5166cce5420cc67c0ad928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Mon, 16 Jan 2017 02:11:23 +0100 Subject: [PATCH] added option to change output container --- coub-dl.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coub-dl.py b/coub-dl.py index 6415007..35d8f47 100644 --- a/coub-dl.py +++ b/coub-dl.py @@ -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]):