From 7137278213ae9ce6ac4d9acd9f1ea87b76d9ca03 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Tue, 30 Jan 2018 21:46:39 +0100 Subject: [PATCH] Do the merge and check some options in main --- lib/svtplay_dl/__init__.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/lib/svtplay_dl/__init__.py b/lib/svtplay_dl/__init__.py index f2884ef..2e55827 100644 --- a/lib/svtplay_dl/__init__.py +++ b/lib/svtplay_dl/__init__.py @@ -40,13 +40,6 @@ def setup_log(silent, verbose=False): def main(): """ Main program """ parse, options = parser(__version__) - - if len(options.urls) == 0: - parse.print_help() - sys.exit(0) - urls = options.urls - if len(urls) < 1: - parse.error("Incorrect number of arguments") if options.exclude: options.exclude = options.exclude.split(",") if options.require_subtitle: @@ -56,13 +49,12 @@ def main(): options.subtitle = True if options.merge_subtitle: options.remux = True - options = mergeparseroption(Options(), options) + if options.silent_semi: options.silent = True - setup_log(options.silent, options.verbose) if options.cmoreoperatorlist: - c = Cmore(options, urls) + c = Cmore(options, None) c.operatorlist() sys.exit(0) @@ -72,8 +64,16 @@ def main(): https=options.proxy) if options.flexibleq and not options.quality: - log.error("flexible-quality requires a quality") - sys.exit(4) + logging.error("flexible-quality requires a quality") + + if len(options.urls) == 0: + parse.print_help() + sys.exit(0) + urls = options.urls + options = mergeparseroption(Options(), options) + if len(urls) < 1: + parse.error("Incorrect number of arguments") + setup_log(options.silent, options.verbose) try: if len(urls) == 1: @@ -82,5 +82,3 @@ def main(): get_multiple_media(urls, options) except KeyboardInterrupt: print("") - -