diff --git a/coub-dl.py b/coub-dl.py index 0553145..ab284d7 100644 --- a/coub-dl.py +++ b/coub-dl.py @@ -160,7 +160,8 @@ def check_for_ytdl_and_ffmpeg(): print_opt(error_str.format('youtube-dl')) elif not ffmpeg_found: print_opt(error_str.format('ffmpeg')) - exit() + + if not ytdl_found or not ffmpeg_found: exit() def determine_output_filename(url, user_supplied, extension, files_dict): @@ -171,6 +172,12 @@ def determine_output_filename(url, user_supplied, extension, files_dict): files_dict[File.OUTPUT] += extension +def build_default_files_dict(): + return {Stream.AUDIO: 'audio', Stream.VIDEO: 'video', + File.LIST: 'list.txt', File.LOOP: 'loop', File.FRACTION: 'fraction', + File.OUTPUT: ''}, [File.OUTPUT] + + def parse_cmd_arguments(): parser = ArgumentParser(description='Download player-looped videos with youtube-dl & ffmpeg.') parser.add_argument('-nv', '--nonverbose', action='store_true', help='Turn off non-critical messages to user') @@ -225,10 +232,7 @@ if __name__ == '__main__': check_for_ytdl_and_ffmpeg() # create dict that contains files used - FILES = {Stream.AUDIO: 'audio', Stream.VIDEO: 'video', - File.LIST: 'list.txt', File.LOOP: 'loop', File.FRACTION: 'fraction', - File.OUTPUT: 'output'+args.extension} - OUTPUT_KEYS = [File.OUTPUT] + FILES, OUTPUT_KEYS = build_default_files_dict() URL = args.url determine_output_filename(URL, args.output, args.extension, FILES)