diff --git a/youtube_dl_gui/DownloadObject.py b/youtube_dl_gui/DownloadObject.py index cfac4ce..aeef9f1 100644 --- a/youtube_dl_gui/DownloadObject.py +++ b/youtube_dl_gui/DownloadObject.py @@ -24,7 +24,7 @@ class DownloadObject(object): download() Params: URL to download Options list e.g. ['--help'] - + Return: DownlaodObject.OK DownloadObject.ERROR DownloadObject.STOPPED @@ -109,7 +109,7 @@ class DownloadObject(object): Return True if updated else return False. ''' updated = False - + for key in data: if key == 'filename': # Save full file path on files_list @@ -216,7 +216,7 @@ def extract_data(stdout): if header[0] == '[' and header[-1] == ']': header = header.replace('[', '').replace(']', '') - + if header == 'download': data_dictionary['status'] = 'download' @@ -246,9 +246,8 @@ def extract_data(stdout): elif header == 'ffmpeg': data_dictionary['status'] = 'post_process' - + else: data_dictionary['status'] = 'pre_process' return data_dictionary - diff --git a/youtube_dl_gui/DownloadThread.py b/youtube_dl_gui/DownloadThread.py index a228782..b95709f 100644 --- a/youtube_dl_gui/DownloadThread.py +++ b/youtube_dl_gui/DownloadThread.py @@ -54,7 +54,7 @@ class DownloadManager(Thread): sleep(0.1) self._terminate_all() - + if not self._kill: if self._stopped: self._callafter('closed') @@ -79,7 +79,7 @@ class DownloadManager(Thread): if thread.is_alive(): counter += 1 return len(self.download_list) + counter - + def close(self, kill=False): self._callafter('closing') self._running = False @@ -200,4 +200,3 @@ class DownloadThread(Thread): path = self.opt_manager.options['youtubedl_path'] path = fix_path(path) + get_youtubedl_filename() return path - diff --git a/youtube_dl_gui/Utils.py b/youtube_dl_gui/Utils.py index f4e2820..3c0f804 100644 --- a/youtube_dl_gui/Utils.py +++ b/youtube_dl_gui/Utils.py @@ -125,7 +125,7 @@ def shutdown_sys(password=''): def get_time(seconds): ''' Return day, hours, minutes, seconds from given seconds''' dtime = {'seconds': 0, 'minutes': 0, 'hours': 0, 'days': 0} - + if seconds < 60: dtime['seconds'] = seconds elif seconds < 3600: @@ -140,6 +140,5 @@ def get_time(seconds): dtime['hours'] = seconds % 86400 / 3600 dtime['minutes'] = seconds % 86400 % 3600 / 60 dtime['seconds'] = seconds % 86400 % 3600 % 60 - - return dtime + return dtime diff --git a/youtube_dl_gui/YoutubeDLGUI.py b/youtube_dl_gui/YoutubeDLGUI.py index 86b5488..44aacfa 100644 --- a/youtube_dl_gui/YoutubeDLGUI.py +++ b/youtube_dl_gui/YoutubeDLGUI.py @@ -181,11 +181,11 @@ class MainFrame(wx.Frame): self.download_thread = None self.ori_url_list = [] self.timer = 0 - + def fin_tasks(self): if self.opt_manager.options['shutdown']: ''' Store sudo password in a temp variable - because we will call _remove_sensitive_data() in + because we will call _remove_sensitive_data() in self.opt_manager.save_to_file() ''' sudo_password = self.opt_manager.options['sudo_password'] self.save_options() @@ -201,14 +201,14 @@ class MainFrame(wx.Frame): def fin_message(self): current_time = time() dtime = get_time(current_time - self.timer) - + msg = 'Downloaded %s url(s) in ' % self.successful_downloads - + days = int(dtime['days']) hours = int(dtime['hours']) minutes = int(dtime['minutes']) seconds = int(dtime['seconds']) - + if days != 0: msg += '%s days, ' % days if hours != 0: @@ -216,9 +216,9 @@ class MainFrame(wx.Frame): if minutes != 0: msg += '%s minutes, ' % minutes msg += '%s seconds ' % seconds - + self.status_bar_write(msg) - + def download_handler(self, msg): topic = msg.topic[0] data = msg.data @@ -226,7 +226,7 @@ class MainFrame(wx.Frame): # Report downloading videos number videos_no = self.download_thread.get_items_counter() self.status_bar_write('Downloading %s url(s)' % videos_no) - + if topic == 'download_thread': self.status_list.write(data) if data['status'] == 'Finished': @@ -559,27 +559,27 @@ class PlaylistPanel(wx.Panel): StartTextBox = wx.BoxSizer(wx.HORIZONTAL) StartTextBox.Add(wx.StaticText(self, label='Playlist Start')) MainBoxSizer.Add(StartTextBox, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, border=5) - + StartBox = wx.BoxSizer(wx.HORIZONTAL) self.start_spinner = wx.SpinCtrl(self, size=(70, 20)) self.start_spinner.SetRange(1, 999) StartBox.Add(self.start_spinner) MainBoxSizer.Add(StartBox, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, border=5) - + StopTextBox = wx.BoxSizer(wx.HORIZONTAL) StopTextBox.Add(wx.StaticText(self, label='Playlist Stop')) MainBoxSizer.Add(StopTextBox, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, border=15) - + StopBox = wx.BoxSizer(wx.HORIZONTAL) self.stop_spinner = wx.SpinCtrl(self, size=(70, 20)) self.stop_spinner.SetRange(0, 999) StopBox.Add(self.stop_spinner) MainBoxSizer.Add(StopBox, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, border=5) - + MaxTextBox = wx.BoxSizer(wx.HORIZONTAL) MaxTextBox.Add(wx.StaticText(self, label='Max Downloads')) MainBoxSizer.Add(MaxTextBox, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, border=15) - + MaxBox = wx.BoxSizer(wx.HORIZONTAL) self.max_spinner = wx.SpinCtrl(self, size=(70, 20)) self.max_spinner.SetRange(0, 999) @@ -1000,7 +1000,7 @@ class FilesystemPanel(wx.Panel): WriteThumnailBox = wx.BoxSizer(wx.HORIZONTAL) self.write_thumbnail_checkbox = wx.CheckBox(self, label='Write thumbnail to disk') WriteThumnailBox.Add(self.write_thumbnail_checkbox, flag=wx.LEFT, border=5) - box.Add(WriteThumnailBox, flag=wx.TOP, border=5 + self.win_border) + box.Add(WriteThumnailBox, flag=wx.TOP, border=5 + self.win_border) def set_right_box(self, box): MinBox = wx.BoxSizer(wx.HORIZONTAL)