From 59b089726e008131f9d1284467bbc5568e5dff9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Sat, 4 Feb 2017 14:40:10 +0100 Subject: [PATCH] added option to override output file name --- coub-dl.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/coub-dl.py b/coub-dl.py index d000f74..aefe386 100644 --- a/coub-dl.py +++ b/coub-dl.py @@ -12,6 +12,7 @@ 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('-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('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 -# fetch video title -FILES[File.OUTPUT] = check_output(('youtube-dl', '--get-title', args.url)).decode('utf-8').strip() + args.extension +# fetch video title if no filename was specified +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 if exists(FILES[File.OUTPUT]):