From e0bb3e7916c0b4a3ef1f475bb4e31174383003e1 Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Sun, 26 Feb 2017 19:32:11 +0200 Subject: [PATCH] Fix OptionsParser 'to_audio' requirement bug --- youtube_dl_gui/parsers.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/youtube_dl_gui/parsers.py b/youtube_dl_gui/parsers.py index 7840818..b06caba 100644 --- a/youtube_dl_gui/parsers.py +++ b/youtube_dl_gui/parsers.py @@ -148,6 +148,29 @@ class OptionsParser(object): options_list.append("-x") options_list.append(option.flag) options_list.append(to_string(value)) + + #NOTE Temp fix + # If current 'audio_quality' is not the default one ('5') + # then append the audio quality flag and value to the + # options list + if options_dict["audio_quality"] != "5": + options_list.append("--audio-quality") + options_list.append(to_string(options_dict["audio_quality"])) + + elif option.name == "audio_quality": + # If the '--audio-quality' is not already in the options list + # from the above branch then follow the standard procedure. + # We don't have to worry for the sequence in which the code + # will be executed since the 'audio_quality' option is placed + # after the 'audio_format' option in the self._ydl_options list + if option.flag not in options_list: + if option.check_requirements(options_dict): + value = options_dict[option.name] + + if value != option.default_value: + options_list.append(option.flag) + options_list.append(to_string(value)) + elif option.check_requirements(options_dict): value = options_dict[option.name]