From 178279315599d41dc1a44d8a94be881f55fdca4d Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Sat, 15 Oct 2016 20:21:23 +0300 Subject: [PATCH] Update the corresponding options based on the selected format --- youtube_dl_gui/mainframe.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/youtube_dl_gui/mainframe.py b/youtube_dl_gui/mainframe.py index dbf3987..d852024 100644 --- a/youtube_dl_gui/mainframe.py +++ b/youtube_dl_gui/mainframe.py @@ -51,6 +51,8 @@ from .utils import ( from .formats import ( DEFAULT_FORMATS, + VIDEO_FORMATS, + AUDIO_FORMATS, FORMATS ) @@ -452,7 +454,18 @@ class MainFrame(wx.Frame): self._update_videoformat(None) def _update_videoformat(self, event): - self.opt_manager.options["selected_format"] = FORMATS[self._videoformat_combobox.GetValue()] + self.opt_manager.options["selected_format"] = selected_format = FORMATS[self._videoformat_combobox.GetValue()] + + if selected_format in VIDEO_FORMATS: + self.opt_manager.options["video_format"] = selected_format + self.opt_manager.options["to_audio"] = False + elif selected_format in AUDIO_FORMATS: + self.opt_manager.options["video_format"] = DEFAULT_FORMATS["default"] + self.opt_manager.options["audio_format"] = selected_format + self.opt_manager.options["to_audio"] = True + else: + self.opt_manager.options["video_format"] = DEFAULT_FORMATS["default"] + self.opt_manager.options["to_audio"] = False def _update_savepath(self, event): self.opt_manager.options["save_path"] = self._path_combobox.GetValue()