From a651e51667f6cf0fdf77c4eafbf6cb8ca5d49cbf Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Wed, 23 Nov 2016 14:10:09 +0200 Subject: [PATCH] Add 'No mtime' option, closes #127 --- youtube_dl_gui/optionsframe.py | 5 +++++ youtube_dl_gui/optionsmanager.py | 6 +++++- youtube_dl_gui/parsers.py | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/youtube_dl_gui/optionsframe.py b/youtube_dl_gui/optionsframe.py index 8d5505c..67681db 100644 --- a/youtube_dl_gui/optionsframe.py +++ b/youtube_dl_gui/optionsframe.py @@ -857,6 +857,7 @@ class ExtraTab(TabPanel): self.youtube_dl_debug_checkbox = self.crt_checkbox("Debug youtube-dl") self.ignore_errors_checkbox = self.crt_checkbox("Ignore errors") self.ignore_config_checkbox = self.crt_checkbox("Ignore youtube-dl config") + self.no_mtime_checkbox = self.crt_checkbox("No mtime") self.native_hls_checkbox = self.crt_checkbox("Prefer native HLS") self._set_layout() @@ -877,6 +878,8 @@ class ExtraTab(TabPanel): extra_opts_sizer.AddSpacer((5, -1)) extra_opts_sizer.Add(self.ignore_config_checkbox) extra_opts_sizer.AddSpacer((5, -1)) + extra_opts_sizer.Add(self.no_mtime_checkbox) + extra_opts_sizer.AddSpacer((5, -1)) extra_opts_sizer.Add(self.native_hls_checkbox) vertical_sizer.Add(extra_opts_sizer, flag=wx.ALL, border=5) @@ -890,6 +893,7 @@ class ExtraTab(TabPanel): self.youtube_dl_debug_checkbox.SetValue(self.opt_manager.options["youtube_dl_debug"]) self.ignore_config_checkbox.SetValue(self.opt_manager.options["ignore_config"]) self.native_hls_checkbox.SetValue(self.opt_manager.options["native_hls"]) + self.no_mtime_checkbox.SetValue(self.opt_manager.options["nomtime"]) def save_options(self): self.opt_manager.options["cmd_args"] = self.cmdline_args_textctrl.GetValue() @@ -897,6 +901,7 @@ class ExtraTab(TabPanel): self.opt_manager.options["youtube_dl_debug"] = self.youtube_dl_debug_checkbox.GetValue() self.opt_manager.options["ignore_config"] = self.ignore_config_checkbox.GetValue() self.opt_manager.options["native_hls"] = self.native_hls_checkbox.GetValue() + self.opt_manager.options["nomtime"] = self.no_mtime_checkbox.GetValue() class LogGUI(wx.Frame): diff --git a/youtube_dl_gui/optionsmanager.py b/youtube_dl_gui/optionsmanager.py index f25277e..cd337b4 100644 --- a/youtube_dl_gui/optionsmanager.py +++ b/youtube_dl_gui/optionsmanager.py @@ -222,6 +222,9 @@ class OptionsManager(object): confirm_deletion (boolean): When True ask user before item removal. + nomtime (boolean): When True will not use the Last-modified header to + set the file modification time. + """ #TODO Remove old options & check options validation self.options = { @@ -284,7 +287,8 @@ class OptionsManager(object): 'confirm_exit': True, 'native_hls': True, 'show_completion_popup': True, - 'confirm_deletion': True + 'confirm_deletion': True, + 'nomtime': False } def load_from_file(self): diff --git a/youtube_dl_gui/parsers.py b/youtube_dl_gui/parsers.py index 18eede2..3c6abe2 100644 --- a/youtube_dl_gui/parsers.py +++ b/youtube_dl_gui/parsers.py @@ -103,7 +103,8 @@ class OptionsParser(object): OptionHolder('audio_quality', '--audio-quality', '5', ['to_audio']), OptionHolder('youtube_dl_debug', '-v', False), OptionHolder('ignore_config', '--ignore-config', False), - OptionHolder('native_hls', '--hls-prefer-native', False) + OptionHolder('native_hls', '--hls-prefer-native', False), + OptionHolder('nomtime', '--no-mtime', False) ] def parse(self, options_dictionary):