From 7f88b6b6b7bbe56e6fea05f4d50da881f433fa24 Mon Sep 17 00:00:00 2001 From: A S Lewis Date: Fri, 29 Dec 2023 19:46:34 +0000 Subject: [PATCH] Possible fix for PyCairo crashes, reinstate debug messages --- README.rst | 2 +- VERSION | 2 +- nsis/tartube_install_64bit.nsi | 6 +- pack/bin/no_download/tartube | 4 +- pack/bin/pkg/tartube | 4 +- pack/bin/strict/tartube | 4 +- pack/tartube.1 | 2 +- setup.py | 2 +- tartube/config.py | 4 +- tartube/downloads.py | 469 +++++++- tartube/ffmpeg_tartube.py | 2 +- tartube/mainapp.py | 956 ++++++++++++++++ tartube/mainwin.py | 1947 ++++++++++++++++++++++++++++++++ tartube/tartube | 4 +- tartube/utils.py | 28 + 15 files changed, 3404 insertions(+), 32 deletions(-) diff --git a/README.rst b/README.rst index a016cec..71b03c2 100644 --- a/README.rst +++ b/README.rst @@ -46,7 +46,7 @@ Problems can be reported at `our GitHub page `__): diff --git a/VERSION b/VERSION index 83c9ca9..0c8cd89 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.4.433 +2.4.438 diff --git a/nsis/tartube_install_64bit.nsi b/nsis/tartube_install_64bit.nsi index d4be599..e25184a 100644 --- a/nsis/tartube_install_64bit.nsi +++ b/nsis/tartube_install_64bit.nsi @@ -1,4 +1,4 @@ -# Tartube v2.4.433 installer script for MS Windows +# Tartube v2.4.438 installer script for MS Windows # # Copyright (C) 2019-2023 A S Lewis # @@ -294,7 +294,7 @@ ;Name and file Name "Tartube" - OutFile "install-tartube-2.4.433-64bit.exe" + OutFile "install-tartube-2.4.438-64bit.exe" ;Default installation folder InstallDir "$LOCALAPPDATA\Tartube" @@ -397,7 +397,7 @@ Section "Tartube" SecClient # "Publisher" "A S Lewis" # WriteRegStr HKLM \ # "Software\Microsoft\Windows\CurrentVersion\Uninstall\Tartube" \ -# "DisplayVersion" "2.4.433" +# "DisplayVersion" "2.4.438" # Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" diff --git a/pack/bin/no_download/tartube b/pack/bin/no_download/tartube index cadbfec..3ccbb02 100644 --- a/pack/bin/no_download/tartube +++ b/pack/bin/no_download/tartube @@ -44,8 +44,8 @@ import mainapp # 'Global' variables __packagename__ = 'tartube' -__version__ = '2.4.433' -__date__ = '22 Nov 2023' +__version__ = '2.4.438' +__date__ = '29 Dec 2023' __copyright__ = 'Copyright \xa9 2019-2023 A S Lewis' __license__ = """ Copyright \xa9 2019-2023 A S Lewis. diff --git a/pack/bin/pkg/tartube b/pack/bin/pkg/tartube index 0164cac..e4a8a13 100644 --- a/pack/bin/pkg/tartube +++ b/pack/bin/pkg/tartube @@ -44,8 +44,8 @@ import mainapp # 'Global' variables __packagename__ = 'tartube' -__version__ = '2.4.433' -__date__ = '22 Nov 2023' +__version__ = '2.4.438' +__date__ = '29 Dec 2023' __copyright__ = 'Copyright \xa9 2019-2023 A S Lewis' __license__ = """ Copyright \xa9 2019-2023 A S Lewis. diff --git a/pack/bin/strict/tartube b/pack/bin/strict/tartube index 255b25e..b652008 100644 --- a/pack/bin/strict/tartube +++ b/pack/bin/strict/tartube @@ -44,8 +44,8 @@ import mainapp # 'Global' variables __packagename__ = 'tartube' -__version__ = '2.4.433' -__date__ = '22 Nov 2023' +__version__ = '2.4.438' +__date__ = '29 Dec 2023' __copyright__ = 'Copyright \xa9 2019-2023 A S Lewis' __license__ = """ Copyright \xa9 2019-2023 A S Lewis. diff --git a/pack/tartube.1 b/pack/tartube.1 index 50c709e..038712e 100644 --- a/pack/tartube.1 +++ b/pack/tartube.1 @@ -1,4 +1,4 @@ -.TH man 1 "22 Nov 2023" "2.4.433" "tartube man page" +.TH man 1 "29 Dec 2023" "2.4.438" "tartube man page" .SH NAME tartube \- GUI front-end for youtube-dl and yt-dlp .SH SYNOPSIS diff --git a/setup.py b/setup.py index 77926df..07db9b1 100644 --- a/setup.py +++ b/setup.py @@ -183,7 +183,7 @@ # Setup setuptools.setup( name = 'tartube', - version = '2.4.433', + version = '2.4.438', description = 'GUI front-end for youtube-dl, yt-dlp and other compatible' \ + ' video downloaders', long_description = long_description, diff --git a/tartube/config.py b/tartube/config.py index ed0e41c..acc1a40 100644 --- a/tartube/config.py +++ b/tartube/config.py @@ -10947,7 +10947,7 @@ def setup_name_tab(self): # (To avoid messing up the neat format of the rows above and below, add # a secondary grid, and put the next set of widgets inside it) grid2 = self.add_secondary_grid(grid, 0, 1, grid_width, 1) - + self.add_label(grid2, _('Extra command line options (e.g. --help)'), 0, 0, 1, 1, @@ -10958,7 +10958,7 @@ def setup_name_tab(self): 'extra_override_flag', 1, 0, 2, 1, ) - + self.extra_cmd_string_textview, \ self.extra_cmd_string_textbuffer = self.add_textview(grid, 'extra_cmd_string', diff --git a/tartube/downloads.py b/tartube/downloads.py index 403eab2..cea5cc5 100644 --- a/tartube/downloads.py +++ b/tartube/downloads.py @@ -56,6 +56,10 @@ import feedparser +# Debugging flag (calls utils.debug_time at the start of every function) +DEBUG_FUNC_FLAG = True + + # Decorator to add thread synchronisation to some functions in the # downloads.DownloadList object _SYNC_LOCK = threading.RLock() @@ -131,6 +135,9 @@ class DownloadManager(threading.Thread): def __init__(self, app_obj, operation_type, download_list_obj, \ custom_dl_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 139 __init__') + super(DownloadManager, self).__init__() # IV list - class objects @@ -294,8 +301,6 @@ def __init__(self, app_obj, operation_type, download_list_obj, \ if self.alt_limits_check_time > 55: self.alt_limits_check_time = 0 # (Also update the icon in the Progress tab) - # !!! DEBUG GIT #577 -# self.app_obj.main_win_obj.toggle_alt_limits_image(self.alt_limits_flag) GObject.timeout_add( 0, self.app_obj.main_win_obj.toggle_alt_limits_image, @@ -318,6 +323,9 @@ def run(self): download operation is complete. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 319 run') + manager_string = _('D/L Manager:') + ' ' self.app_obj.main_win_obj.output_tab_write_stdout( @@ -427,10 +435,6 @@ def run(self): ) # (Also update the icon in the Progress tab) - # !!! DEBUG GIT #577 -# self.app_obj.main_win_obj.toggle_alt_limits_image( -# self.alt_limits_flag, -# ) GObject.timeout_add( 0, self.app_obj.main_win_obj.toggle_alt_limits_image, @@ -573,8 +577,6 @@ def run(self): ) # (Also update the icon in the Progress tab) - # !!! DEBUG GIT #577 -# self.app_obj.main_win_obj.toggle_alt_limits_image(False) GObject.timeout_add( 0, self.app_obj.main_win_obj.toggle_alt_limits_image, @@ -617,6 +619,9 @@ def apply_ignore_limits(self): (Doing things this way is a lot simpler than the alternatives.) """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 631 apply_ignore_limits') + for item_id in self.download_list_obj.download_item_list: download_item_obj \ @@ -636,6 +641,9 @@ def check_alt_limits(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 653 check_alt_limits') + if not self.app_obj.alt_num_worker_apply_flag: return False @@ -719,6 +727,9 @@ def change_worker_count(self, number): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 739 change_worker_count') + # How many workers do we have already? current = len(self.worker_list) # If this object hasn't set up its worker pool yet, let the setup code @@ -791,6 +802,9 @@ def check_master_slave(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 814 check_master_slave') + for worker_obj in self.worker_list: if not worker_obj.available_flag \ @@ -829,6 +843,9 @@ def check_workers_all_finished(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 855 check_workers_all_finished') + for worker_obj in self.worker_list: if not worker_obj.available_flag: return False @@ -845,6 +862,9 @@ def create_bypass_worker(self): mainapp.TartubeApp.num_worker_default. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 874 create_bypass_worker') + # How many workers do we have already? current = len(self.worker_list) # If this object hasn't set up its worker pool yet, let the setup code @@ -868,7 +888,10 @@ def create_bypass_worker(self): self.worker_list.append(DownloadWorker(self, True)) # Create an additional page in the main window's Output tab, if # required - self.app_obj.main_win_obj.output_tab_setup_pages() + GObject.timeout_add( + 0, + self.app_obj.main_win_obj.output_tab_setup_pages, + ) def get_available_worker(self, media_data_obj): @@ -890,6 +913,9 @@ def get_available_worker(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 922 get_available_worker') + # Some workers are only available when media_data_obj is media.Video # that's a broadcasting livestream if isinstance(media_data_obj, media.Video) \ @@ -928,6 +954,9 @@ def mark_video_as_doomed(self, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 963 mark_video_as_doomed') + if isinstance(video_obj, media.Video) \ and not video_obj in self.doomed_video_list: self.doomed_video_list.append(video_obj) @@ -945,6 +974,9 @@ def nudge_progress_bar(self): Updates the main window's progress bar. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 983 nudge_progress_bar') + if self.current_item_obj: GObject.timeout_add( @@ -977,6 +1009,9 @@ def register_classic_url(self, parent_obj, json_dict): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1018 register_classic_url') + self.classic_extract_list.append(parent_obj) self.classic_extract_list.append(json_dict) @@ -992,6 +1027,9 @@ def register_clip(self): to self.register_video() must be made. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1036 register_clip') + self.total_clip_count += 1 @@ -1007,6 +1045,9 @@ def register_slice(self): self.register_video() must be made. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1054 register_slice') + self.total_slice_count += 1 @@ -1032,6 +1073,9 @@ def register_video(self, dl_type): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1082 register_video') + if dl_type == 'other': # Special count for already checked/downloaded media.Videos, in # order to prevent mainwin.NewbieDialogue opening @@ -1070,6 +1114,9 @@ def register_video_size(self, size=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1123 register_video_size') + # (In case the filesystem didn't detect the file size, for whatever # reason, we'll check for a None value) if size is not None: @@ -1111,6 +1158,9 @@ def remove_worker(self, worker_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1167 remove_worker') + new_list = [] for other_obj in self.worker_list: @@ -1135,6 +1185,9 @@ def stop_download_operation(self): loop, the downloads.DownloadWorker objects are cleaned up. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1194 stop_download_operation') + self.running_flag = False self.manual_stop_flag = True @@ -1153,6 +1206,9 @@ def stop_download_operation_soon(self): currently being downloaded have finished downloading. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1215 stop_download_operation_soon') + self.manual_stop_flag = True self.download_list_obj.prevent_fetch_new_items() @@ -1201,6 +1257,9 @@ class DownloadWorker(threading.Thread): def __init__(self, download_manager_obj, broadcast_flag=False): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1266 __init__') + super(DownloadWorker, self).__init__() # IV list - class objects @@ -1270,6 +1329,9 @@ def run(self): object and wait for the result. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1338 run') + # Import the main application and custom download manager (for # convenience) app_obj = self.download_manager_obj.app_obj @@ -1413,6 +1475,9 @@ def run_video_downloader(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1484 run_video_downloader') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -1548,6 +1613,9 @@ def run_clip_slice_downloader(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1622 run_clip_slice_downloader') + # Import the main application and custom download manager (for # convenience) app_obj = self.download_manager_obj.app_obj @@ -1621,6 +1689,9 @@ def run_stream_downloader(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1698 run_stream_downloader') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -1750,6 +1821,9 @@ def close(self): Tidy up IVs and stop any child processes. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1830 close') + self.running_flag = False if self.downloader_obj: @@ -1790,6 +1864,9 @@ def check_rss(self, container_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1873 check_rss') + app_obj = self.download_manager_obj.app_obj # Livestreams are usually the first entry in the RSS feed, having not @@ -1912,6 +1989,9 @@ def prepare_download(self, download_item_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 1998 prepare_download') + self.download_item_obj = download_item_obj self.options_manager_obj = download_item_obj.options_manager_obj @@ -1929,6 +2009,9 @@ def set_doomed_flag(self, flag): """Called by downloads.DownloadManager.change_worker_count().""" + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 2018 set_doomed_flag') + self.doomed_flag = flag @@ -1958,6 +2041,9 @@ def data_callback(self, dl_stat_dict, last_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 2050 data_callback') + main_win_obj = self.download_manager_obj.app_obj.main_win_obj if not self.download_item_obj.operation_classic_flag: @@ -2058,6 +2144,9 @@ class DownloadList(object): def __init__(self, app_obj, operation_type, media_data_list, \ custom_dl_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 2153 __init__') + # IV list - class objects # ----------------------- self.app_obj = app_obj @@ -2341,6 +2430,9 @@ def abandon_remaining_items(self): marked as 'Waiting' should be marked as 'Not started'. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 2439 abandon_remaining_items') + main_win_obj = self.app_obj.main_win_obj download_manager_obj = self.app_obj.download_manager_obj @@ -2404,6 +2496,9 @@ def change_item_stage(self, item_id, new_stage): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 2505 change_item_stage') + self.download_item_dict[item_id].stage = new_stage @@ -2488,6 +2583,9 @@ def create_item(self, media_data_obj, scheduled_obj=None, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 2592 create_item') + # Sanity check - if no URL is specified, then there is nothing to # download if not isinstance(media_data_obj, media.Folder) \ @@ -2789,6 +2887,9 @@ def create_dummy_item(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 2896 create_dummy_item') + if media_data_obj.options_obj is not None: # (Download options specified by the Drag and Drop tab) options_manager_obj = media_data_obj.options_obj @@ -2831,6 +2932,9 @@ def fetch_next_item(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 2941 fetch_next_item') + if not self.prevent_fetch_flag: # In case of any recent calls to self.create_item(), which want to @@ -2866,6 +2970,9 @@ def is_queuing(self, item_id): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 2979 is_queuing') + if item_id in self.download_item_dict: item_obj = self.download_item_dict[item_id] if item_obj.stage == formats.MAIN_STAGE_QUEUED: @@ -2890,6 +2997,9 @@ def move_item_to_bottom(self, download_item_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3006 move_item_to_bottom') + # Move the item to the bottom (end) of the list if download_item_obj is None \ or not download_item_obj.item_id in self.download_item_list: @@ -2918,6 +3028,9 @@ def move_item_to_top(self, download_item_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3037 move_item_to_top') + # Move the item to the top (beginning) of the list if download_item_obj is None \ or not download_item_obj.item_id in self.download_item_list: @@ -2941,6 +3054,9 @@ def prevent_fetch_new_items(self): soon as any ongoing video downloads have finished. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3063 prevent_fetch_new_items') + self.prevent_fetch_flag = True @@ -2954,6 +3070,9 @@ def set_final_item(self, item_id): to check/download). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3079 set_final_item') + if item_id in self.download_item_dict: self.final_item_id = item_id @@ -2985,6 +3104,9 @@ def reorder_master_slave(self): start, it at least makes the download order predictable. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3113 reorder_master_slave') + master_list = [] other_list = [] for item_id in self.download_item_list: @@ -3045,6 +3167,9 @@ class DownloadItem(object): def __init__(self, item_id, media_data_obj, scheduled_obj, options_manager_obj, operation_type, ignore_limits_flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3176 __init__') + # IV list - class objects # ----------------------- # The media data object to be downloaded. When the download operation @@ -3093,6 +3218,9 @@ def set_ignore_limits_flag(self): """Called by DownloadManager.apply_ignore_limits(), following a call from mainapp>TartubeApp.script_slow_timer_callback().""" + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3227 set_ignore_limits_flag') + self.ignore_limits_flag = True @@ -3177,6 +3305,9 @@ class VideoDownloader(object): def __init__(self, download_manager_obj, download_worker_obj, \ download_item_obj, force_sim_flag=False): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3314 __init__') + # IV list - class objects # ----------------------- # The downloads.DownloadManager object handling the entire download @@ -3438,6 +3569,9 @@ def do_download(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3578 do_download') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -3704,6 +3838,9 @@ def check_dl_is_correct_type(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3847 check_dl_is_correct_type') + # Special case: if the download operation was launched from the # Classic Mode tab, there is no need to do anything if self.dl_classic_flag: @@ -3771,6 +3908,9 @@ def close(self): Destructor function for this object. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3917 close') + # Tell the PipeReader objects to shut down, thus joining their threads self.stdout_reader.join() self.stderr_reader.join() @@ -3794,6 +3934,9 @@ def confirm_archived_video(self, filename): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3943 confirm_archived_video') + # Create shortcut variables (for convenience) app_obj = self.download_manager_obj.app_obj media_data_obj = self.download_item_obj.media_data_obj @@ -3831,6 +3974,9 @@ def confirm_new_video(self, dir_path, filename, extension, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 3983 confirm_new_video') + # Create shortcut variables (for convenience) app_obj = self.download_manager_obj.app_obj media_data_obj = self.download_item_obj.media_data_obj @@ -3980,6 +4126,9 @@ def confirm_new_video_classic_mode(self, dir_path, filename, extension): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 4135 confirm_new_video_classic_mode') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -4039,6 +4188,9 @@ def confirm_old_video(self, dir_path, filename, extension): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 4197 confirm_old_video') + # Create shortcut variables (for convenience) app_obj = self.download_manager_obj.app_obj media_data_obj = self.download_item_obj.media_data_obj @@ -4207,6 +4359,9 @@ def confirm_sim_video(self, json_dict): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 4368 confirm_sim_video') + # Import the main application and download list (for convenience) app_obj = self.download_manager_obj.app_obj dl_list_obj = self.download_manager_obj.download_list_obj @@ -4915,6 +5070,9 @@ def convert_video_to_container(self): handles that. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 5079 convert_video_to_container') + app_obj = self.download_manager_obj.app_obj old_video_obj = self.download_item_obj.media_data_obj container_obj = old_video_obj.parent_obj @@ -4993,7 +5151,12 @@ def convert_video_to_container(self): # Add the new channel/playlist to the Video Index (but don't # select it) - app_obj.main_win_obj.video_index_add_row(new_container_obj, True) + GObject.timeout_add( + 0, + app_obj.main_win_obj.video_index_add_row, + new_container_obj, + True, + ) # Add the new channel/playlist to the download manager's list of # things to download... @@ -5006,7 +5169,9 @@ def convert_video_to_container(self): self.download_item_obj.ignore_limits_flag, ) # ...and add a row the Progress List - app_obj.main_win_obj.progress_list_add_row( + GObject.timeout_add( + 0, + app_obj.main_win_obj.progress_list_add_row, new_download_item_obj.item_id, new_download_item_obj.media_data_obj, ) @@ -5033,6 +5198,9 @@ def create_child_process(self, cmd_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 5200 create_child_process') + # Strip double quotes from arguments # (Since we're sending the system command one argument at a time, we # don't need to retain the double quotes around any single argument @@ -5089,6 +5257,9 @@ def extract_filename(self, input_data): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 5259 extract_filename') + path, fullname = os.path.split(input_data.strip("\"")) filename, extension = os.path.splitext(fullname) @@ -5136,6 +5307,9 @@ def extract_stdout_data(self, stdout): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 5309 extract_stdout_data') + # Import the media data object (for convenience) media_data_obj = self.download_item_obj.media_data_obj @@ -5538,6 +5712,9 @@ def extract_stdout_status(self, dl_stat_dict): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 5714 extract_stdout_status') + if 'status' in dl_stat_dict: if dl_stat_dict['status'] == formats.COMPLETED_STAGE_ALREADY: self.set_return_code(self.ALREADY) @@ -5565,6 +5742,9 @@ def is_blocked(self, stderr): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 5744 is_blocked') + # N.B. These strings also appear in self.is_ignorable() regex_list = [ 'Content Warning', @@ -5599,6 +5779,9 @@ def is_child_process_alive(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 5781 is_child_process_alive') + if self.child_process is None: return False @@ -5626,6 +5809,9 @@ def is_debug(self, stderr): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 5811 is_debug') + return stderr.split(' ')[0] == '[debug]' @@ -5647,6 +5833,9 @@ def is_ignorable(self, stderr): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 5835 is_ignorable') + app_obj = self.download_manager_obj.app_obj media_data_obj = self.download_item_obj.media_data_obj @@ -5791,6 +5980,9 @@ def is_network_error(self, stderr): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 5982 is_network_error') + if re.search(r'[Uu]nable to download video data', stderr) \ or re.search(r'[Uu]nable to download webpage', stderr) \ or re.search(r'[Nn]ame or service not known', stderr) \ @@ -5820,6 +6012,9 @@ def is_warning(self, stderr): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6014 is_warning') + return stderr.split(':')[0] == 'WARNING' @@ -5839,6 +6034,9 @@ def last_data_callback(self): The new key-value pairs are used to update the main window. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6036 last_data_callback') + dl_stat_dict = {} if self.return_code == self.OK: @@ -5900,6 +6098,9 @@ def match_vid_or_url(self, media_data_obj, vid, url=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6100 match_vid_or_url') + if ( media_data_obj.vid is not None \ and media_data_obj.vid == vid @@ -5931,6 +6132,9 @@ def process_error_warning(self, vid): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6134 process_error_warning') + if not vid in self.video_msg_buffer_dict: GObject.timeout_add( @@ -5996,7 +6200,9 @@ def process_error_warning(self, vid): # but for a child video, we have to call it directly # The True argument means 'display the last error/warning only' # in case the same video generates several errors - app_obj.main_win_obj.errors_list_add_operation_msg( + GObject.timeout_add( + 0, + app_obj.main_win_obj.errors_list_add_operation_msg, video_obj, True, ) @@ -6021,6 +6227,9 @@ def read_child_process(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6227 read_child_process') + # mini_list is in the form [time, pipe_type, data] try: mini_list = self.queue.get_nowait() @@ -6209,6 +6418,9 @@ def register_error_warning(self, data): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6418 register_error_warning') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -6391,7 +6603,9 @@ def register_error_warning(self, data): # but for a child video, we have to call it directly # The True argument means 'display the last error/warning only' # in case the same video generates several errors - app_obj.main_win_obj.errors_list_add_operation_msg( + GObject.timeout_add( + 0, + app_obj.main_win_obj.errors_list_add_operation_msg, new_obj, True, ) @@ -6466,6 +6680,9 @@ def set_error(self, media_data_obj, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6678 set_error') + if isinstance(media_data_obj, media.Video): if not media_data_obj.dbid in self.video_error_warning_dict: @@ -6494,6 +6711,9 @@ def set_warning(self, media_data_obj, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6709 set_warning') + if isinstance(media_data_obj, media.Video): if not media_data_obj.dbid in self.video_error_warning_dict: @@ -6525,6 +6745,9 @@ def set_return_code(self, code): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6743 set_return_code') + # (The code -1, STALLED, overrules everything else) if code == -1 or code >= self.return_code: self.return_code = code @@ -6534,6 +6757,9 @@ def set_temp_destination(self, path, filename, extension): """Called by self.extract_stdout_data().""" + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6755 set_temp_destination') + self.temp_path = path self.temp_filename = filename self.temp_extension = extension @@ -6543,6 +6769,9 @@ def reset_temp_destination(self): """Called by self.extract_stdout_data().""" + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6767 reset_temp_destination') + self.temp_path = None self.temp_filename = None self.temp_extension = None @@ -6557,6 +6786,9 @@ def stop(self): self.STOPPED. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6784 stop') + if self.is_child_process_alive(): if os.name == 'nt': @@ -6584,6 +6816,9 @@ def stop_soon(self): current video. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6814 stop_soon') + self.stop_soon_flag = True @@ -6665,6 +6900,9 @@ class ClipDownloader(object): def __init__(self, download_manager_obj, download_worker_obj, \ download_item_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 6898 __init__') + # IV list - class objects # ----------------------- # The downloads.DownloadManager object handling the entire download @@ -6780,6 +7018,9 @@ def do_download_clips(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 7016 do_download_clips') + # Import the main application and video object (for convenience) app_obj = self.download_manager_obj.app_obj orig_video_obj = self.download_item_obj.media_data_obj @@ -6927,6 +7168,9 @@ def do_download_clips_with_chapters(self, orig_video_obj, parent_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 7166 do_download_clips_with_chapters') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -7137,6 +7381,9 @@ def do_download_clips_with_downloader(self, orig_video_obj, stamp_list, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 7379 do_download_clips_with_downloader') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -7426,6 +7673,9 @@ def do_download_clips_with_ffmpeg(self, orig_video_obj, stamp_list, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 7671 do_download_clips_with_ffmpeg') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -7637,6 +7887,9 @@ def do_download_remove_slices(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 7885 do_download_remove_slices') + # Import the main application and video object (for convenience) app_obj = self.download_manager_obj.app_obj orig_video_obj = self.download_item_obj.media_data_obj @@ -8023,6 +8276,9 @@ def close(self): Destructor function for this object. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 8274 close') + # Tell the PipeReader objects to shut down, thus joining their threads self.stdout_reader.join() self.stderr_reader.join() @@ -8053,6 +8309,9 @@ def confirm_video_clip(self, dest_obj, dest_dir, orig_video_obj, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 8307 confirm_video_clip') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -8090,7 +8349,9 @@ def confirm_video_clip(self, dest_obj, dest_dir, orig_video_obj, \ # Update the Results List (unless the download operation was # launched from the Classic Mode tab) - app_obj.main_win_obj.results_list_add_row( + GObject.timeout_add( + 0, + app_obj.main_win_obj.results_list_add_row, self.download_item_obj, clip_video_obj, {}, # No 'mini_options_dict' to apply @@ -8152,6 +8413,9 @@ def confirm_video_remove_slices(self, orig_video_obj, output_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 8409 confirm_video_remove_slices') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -8229,6 +8493,9 @@ def create_child_process(self, cmd_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 8489 create_child_process') + # Strip double quotes from arguments # (Since we're sending the system command one argument at a time, we # don't need to retain the double quotes around any single argument @@ -8281,6 +8548,9 @@ def create_temp_dir_for_chapters(self, orig_video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 8544 create_temp_dir_for_chapters') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -8330,6 +8600,9 @@ def create_temp_dir_for_slices(self, orig_video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 8596 create_temp_dir_for_slices') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -8379,6 +8652,9 @@ def extract_stdout_data(self, stdout): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 8648 extract_stdout_data') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -8472,6 +8748,9 @@ def is_child_process_alive(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 8744 is_child_process_alive') + if self.child_process is None: return False @@ -8499,6 +8778,9 @@ def is_network_error(self, stderr): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 8774 is_network_error') + # v2.3.012, this error is seen on MS Windows: # unable to download video data: = self.return_code: self.return_code = code @@ -8908,6 +9202,9 @@ def stop(self): self.STOPPED. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 9198 stop') + if self.is_child_process_alive(): if os.name == 'nt': @@ -8935,6 +9232,9 @@ def stop_soon(self): current video. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 9228 stop_soon') + self.stop_soon_flag = True @@ -8997,6 +9297,9 @@ class StreamDownloader(object): def __init__(self, download_manager_obj, download_worker_obj, \ download_item_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 9293 __init__') + # IV list - class objects # ----------------------- # The downloads.DownloadManager object handling the entire download @@ -9097,6 +9400,9 @@ def do_download(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 9396 do_download') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj video_obj = self.download_item_obj.media_data_obj @@ -9300,6 +9606,9 @@ def do_download_basic(self): because self.download_item_obj.media_data_obj is always a media.Video). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 9602 do_download_basic') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -9399,6 +9708,9 @@ def do_download_m3u(self): the .m3u manifest first. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 9704 do_download_m3u') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -9541,6 +9853,9 @@ def do_download_streamlink(self): Downloads a broadcasting livestream using streamlink. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 9849 do_download_streamlink') + # Import the main application (for convenience) app_obj = self.download_manager_obj.app_obj @@ -9632,6 +9947,9 @@ def choose_path(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 9943 choose_path') + video_obj = self.download_item_obj.media_data_obj if not video_obj.dummy_flag: return video_obj.get_actual_path(self.download_manager_obj.app_obj) @@ -9668,6 +9986,9 @@ def close(self): Destructor function for this object. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 9982 close') + # Tell the PipeReader objects to shut down, thus joining their threads self.stdout_reader.join() self.stderr_reader.join() @@ -9693,6 +10014,9 @@ def create_child_process(self, cmd_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10010 create_child_process') + # Strip double quotes from arguments # (Since we're sending the system command one argument at a time, we # don't need to retain the double quotes around any single argument @@ -9742,6 +10066,9 @@ def download_data_callback(self, speed='', filesize=''): self.last_data_callback() is called at the end of it. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10062 download_data_callback') + if self.segment_count == 0: percent = '?' else: @@ -9778,6 +10105,9 @@ def is_child_process_alive(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10101 is_child_process_alive') + if self.child_process is None: return False @@ -9801,6 +10131,9 @@ def last_data_callback(self): The new key-value pairs are used to update the main window. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10127 last_data_callback') + dl_stat_dict = {} if self.return_code == self.OK: @@ -9840,6 +10173,9 @@ def read_child_process(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10169 read_child_process') + # mini_list is in the form [time, pipe_type, data] try: mini_list = self.queue.get_nowait() @@ -10010,6 +10346,9 @@ def reset(self): everything, ready for the second function. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10342 reset') + if self.child_process: # Tell the PipeReader objects to shut down, thus joining their @@ -10038,6 +10377,9 @@ def set_actual_output_path(self, output_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10373 set_actual_output_path') + # Update IVs directory, filename, ext = utils.extract_path_components(output_path) @@ -10064,6 +10406,9 @@ def set_error(self, media_data_obj, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10402 set_error') + if not self.first_error_flag: self.first_error_flag = True @@ -10092,6 +10437,9 @@ def set_return_code(self, code): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10433 set_return_code') + if code >= self.return_code: self.return_code = code @@ -10109,6 +10457,9 @@ def show_cmd(self, cmd): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10453 show_cmd') + # Import the main app (for convenience) app_obj = self.download_manager_obj.app_obj @@ -10143,6 +10494,9 @@ def show_msg(self, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10490 show_msg') + # Import the main app (for convenience) app_obj = self.download_manager_obj.app_obj @@ -10182,6 +10536,9 @@ def show_error(self, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10532 show_error') + # Import the main app (for convenience) app_obj = self.download_manager_obj.app_obj @@ -10216,6 +10573,9 @@ def stop(self): self.STOPPED. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10569 stop') + if self.is_child_process_alive(): if os.name == 'nt': @@ -10243,6 +10603,9 @@ def stop_soon(self): instruction to stop after that download has finished. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10599 stop_soon') + pass @@ -10309,6 +10672,9 @@ class JSONFetcher(object): def __init__(self, download_manager_obj, download_worker_obj, \ container_obj, entry_dict): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10668 __init__') + # IV list - class objects # ----------------------- # The downloads.DownloadManager object handling the entire download @@ -10398,6 +10764,9 @@ def do_fetch(self): we assume that the livestream is waiting to start. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10760 do_fetch') + # Import the main app (for convenience) app_obj = self.download_manager_obj.app_obj @@ -10502,6 +10871,9 @@ def close(self): Destructor function for this object. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10876 close') + # Tell the PipeReader objects to shut down, thus joining their threads self.stdout_reader.join() self.stderr_reader.join() @@ -10526,6 +10898,9 @@ def create_child_process(self, cmd_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10894 create_child_process') + # Strip double quotes from arguments # (Since we're sending the system command one argument at a time, we # don't need to retain the double quotes around any single argument @@ -10576,6 +10951,9 @@ def is_child_process_alive(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10947 is_child_process_alive') + if self.child_process is None: return False @@ -10598,6 +10976,9 @@ def read_child_process(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 10972 read_child_process') + # mini_list is in the form [time, pipe_type, data] try: mini_list = self.queue.get_nowait() @@ -10675,6 +11056,9 @@ def stop(self): Terminates the child process. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11052 stop') + if self.is_child_process_alive(): if os.name == 'nt': @@ -10714,6 +11098,9 @@ class StreamManager(threading.Thread): def __init__(self, app_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11094 __init__') + super(StreamManager, self).__init__() # IV list - class objects @@ -10756,6 +11143,9 @@ def run(self): Initiates the download. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11139 run') + # Generate a local list of media.Video objects marked as livestreams # (in case the mainapp.TartubeApp IV changes during the course of # this operation) @@ -10799,6 +11189,9 @@ def stop_livestream_operation(self): loop, the downloads.MiniJSONFetcher objects are cleaned up. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11185 stop_livestream_operation') + self.running_flag = False # Halt the MiniJSONFetcher; it doesn't matter if it was in the middle @@ -10845,6 +11238,9 @@ class MiniJSONFetcher(object): def __init__(self, livestream_manager_obj, video_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11234 __init__') + # IV list - class objects # ----------------------- # The downloads.StreamManager object handling the entire livestream @@ -10887,6 +11283,9 @@ def do_fetch(self): we assume that the livestream is waiting to start. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11279 do_fetch') + # Import the main app (for convenience) app_obj = self.livestream_manager_obj.app_obj @@ -10931,6 +11330,9 @@ def close(self): Destructor function for this object. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11326 close') + # Tell the PipeReader objects to shut down, thus joining their threads self.stdout_reader.join() self.stderr_reader.join() @@ -10955,6 +11357,9 @@ def create_child_process(self, cmd_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11353 create_child_process') + # Strip double quotes from arguments # (Since we're sending the system command one argument at a time, we # don't need to retain the double quotes around any single argument @@ -11005,6 +11410,9 @@ def is_child_process_alive(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11406 is_child_process_alive') + if self.child_process is None: return False @@ -11031,6 +11439,9 @@ def parse_json(self, stdout): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11435 parse_json') + # (Try/except to check for invalid JSON) try: return json.loads(stdout) @@ -11059,6 +11470,9 @@ def read_child_process(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11466 read_child_process') + # mini_list is in the form [time, pipe_type, data] try: mini_list = self.queue.get_nowait() @@ -11167,6 +11581,9 @@ def stop(self): Terminates the child process. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11577 stop') + if self.is_child_process_alive(): if os.name == 'nt': @@ -11206,6 +11623,9 @@ class CustomDLManager(object): def __init__(self, uid, name): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11619 __init__') + # IV list - other # --------------- # Unique ID for this custom download manager @@ -11326,6 +11746,9 @@ def clone_settings(self, other_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11742 clone_settings') + self.dl_by_video_flag = other_obj.dl_by_video_flag self.dl_if_subs_flag = other_obj.dl_if_subs_flag self.ignore_if_no_subs_flag = other_obj.ignore_if_no_subs_flag @@ -11347,6 +11770,9 @@ def reset_settings(self): Resets settings to their default values. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11766 reset_settings') + self.dl_by_video_flag = False self.dl_if_subs_flag = False self.ignore_if_no_subs_flag = False @@ -11382,6 +11808,9 @@ def set_dl_precede_flag(self, flag): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11804 set_dl_precede_flag') + if not flag: self.dl_precede_flag = False else: @@ -11423,6 +11852,9 @@ class PipeReader(threading.Thread): def __init__(self, queue, pipe_type): + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11848 __init__') + super(PipeReader, self).__init__() # IV list - other @@ -11462,6 +11894,9 @@ def run(self): Reads from STDOUT or STERR using the attached filed filehandle. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11890 run') + # Use this flag so that the loop can ignore FFmpeg error messsages # (because the parent VideoDownloader object shouldn't use that as a # serious error) @@ -11514,6 +11949,9 @@ def attach_fh(self, fh): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11945 attach_fh') + self.fh = fh @@ -11530,5 +11968,8 @@ def join(self, timeout=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('dld 11964 join') + self.running_flag = False super(PipeReader, self).join(timeout) diff --git a/tartube/ffmpeg_tartube.py b/tartube/ffmpeg_tartube.py index bfb7106..7b26d22 100644 --- a/tartube/ffmpeg_tartube.py +++ b/tartube/ffmpeg_tartube.py @@ -1020,7 +1020,7 @@ def get_system_cmd(self, app_obj, video_obj=None, start_point=None, ) return source_video_path, output_path, return_list - + # Special case: when called from config.FFmpegOptionsEditWin, then show # a specimen system command resembling the one that will eventually # be generated by FFmpegManager.run_ffmpeg_multiple_files() diff --git a/tartube/mainapp.py b/tartube/mainapp.py index e7dfdd2..ec38cb3 100644 --- a/tartube/mainapp.py +++ b/tartube/mainapp.py @@ -112,6 +112,13 @@ import wizwin +# Debugging flag (calls utils.debug_time at the start of every function) +DEBUG_FUNC_FLAG = True +# ...(but don't call utils.debug_time from the timer functions such as +# self.script_slow_timer_callback() ) +DEBUG_NO_TIMER_FUNC_FLAG = True + + # Classes @@ -125,6 +132,9 @@ class TartubeApp(Gtk.Application): def __init__(self, *args, **kwargs): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 136 __init__') + # Register the application if not __main__.__multiple_instance_flag__: @@ -2612,6 +2622,9 @@ def do_startup(self): """Gio.Application standard function.""" + if DEBUG_FUNC_FLAG: + utils.debug_time('app 2627 do_startup') + GObject.threads_init() Gtk.Application.do_startup(self) @@ -3468,6 +3481,9 @@ def do_activate(self): """Gio.Application standard function.""" + if DEBUG_FUNC_FLAG: + utils.debug_time('app 3486 do_activate') + # If the flag is set, restrict Tartube to a single instance if not __main__.__multiple_instance_flag__ and self.main_win_obj: @@ -3510,6 +3526,9 @@ def do_shutdown(self): database files have already been saved. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 3531 do_shutdown') + # Stop the GObject timers immediately if self.script_slow_timer_id: GObject.source_remove(self.script_slow_timer_id) @@ -3564,6 +3583,9 @@ def start(self): Performs general initialisation. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 3588 start') + # Part 1 - Give mainapp.TartubeApp IVs their initial values # --------------------------------------------------------- @@ -3738,6 +3760,9 @@ def start_continue(self, new_config_flag): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 3765 start_continue') + # Part 5 - Finish setting up the main window # ------------------------------------------ @@ -4034,6 +4059,9 @@ def stop(self, dialogue_win=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 4064 stop') + # If a (silent) livestream operation is in progress, we can stop it # immediately if self.livestream_manager_obj: @@ -4118,6 +4146,9 @@ def stop_continue(self): self.do_shutdown(). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 4151 stop_continue') + # (No need to check the livestream operation here - it was stopped in # the call to self.stop() ) if self.download_manager_obj: @@ -4225,6 +4256,9 @@ def system_error(self, error_code, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 4261 system_error') + if self.main_win_obj and self.system_error_show_flag: GObject.timeout_add( 0, @@ -4255,6 +4289,9 @@ def system_warning(self, error_code, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 4294 system_warning') + if self.main_win_obj and self.system_warning_show_flag: GObject.timeout_add( 0, @@ -4283,6 +4320,9 @@ def system_exception(self, except_type, value, details): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 4325 system_exception') + self.system_error( 901, "Uncaught exception:\n" \ @@ -4305,6 +4345,9 @@ def write_downloader_log(self, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 4350 write_downloader_log') + path = os.path.abspath(os.path.join(self.data_dir, self.ytdl_log_name)) # !!! DEBUG GIT #557 # with open(path, 'a') as outfile: @@ -4340,6 +4383,9 @@ def load_config(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 4388 load_config') + # Define global variables for this function global _ @@ -5366,6 +5412,9 @@ def load_config_ytdl_update(self, version, json_dict): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 5417 load_config_ytdl_update') + # (In version v0.5.027, the value of these IVs were overhauled. If # loading from an earlier config file, replace those values with the # new default values) @@ -5600,6 +5649,9 @@ def load_config_import_scheduled(self, version, json_dict): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 5654 load_config_import_scheduled') + # Set up variables whose values are the default values of the old IVs scheduled_check_mode = 'disabled' scheduled_check_wait_value = 2 @@ -5730,6 +5782,9 @@ def save_config(self): loading/saving. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 5787 save_config') + # The config file can be stored at one of two locations, depending on # whether xdg is available, or not # v2.0.003 (amended v2.1.034) The user can force Tartube to use the @@ -6283,6 +6338,9 @@ def get_config_path(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 6343 get_config_path') + # The config file can be stored at one of two locations, depending on # whether xdg is available, or not # v2.0.003 (amended v2.1.034) The user can force Tartube to use the @@ -6322,6 +6380,9 @@ def load_db(self, switch_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 6385 load_db') + # Sanity check path = os.path.abspath(os.path.join(self.data_dir, self.db_file_name)) if self.current_manager_obj \ @@ -6681,6 +6742,9 @@ def update_db(self, version): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 6747 update_db') + # (Other system folders, having been added later, are not required by # this list) fixed_folder_list = [ @@ -8232,6 +8296,9 @@ def save_db(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 8310 save_db') + # Sanity check if self.current_manager_obj \ or self.disable_load_save_flag \ @@ -8476,6 +8543,9 @@ def switch_db(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 8548 switch_db') + # Extract values from the argument list path = data_list.pop(0) pref_win_obj = data_list.pop(0) @@ -8627,6 +8697,9 @@ def backup_data_variables_before_switch(self): using the previous database, as before. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 8702 backup_data_variables_before_switch') + self.backup_data_dir = self.data_dir self.backup_downloads_dir = self.downloads_dir self.backup_alt_downloads_dir = self.alt_downloads_dir @@ -8645,6 +8718,9 @@ def clear_data_variables_after_switch(self): copies of several IVs we made, in case the load failed. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 8723 clear_data_variables_after_switch') + self.backup_data_dir = None self.backup_downloads_dir = None self.backup_alt_downloads_dir = None @@ -8664,6 +8740,9 @@ def restore_data_variables_after_switch(self): database, as before. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 8745 restore_data_variables_after_switch') + self.data_dir = self.backup_data_dir self.downloads_dir = self.backup_downloads_dir self.alt_downloads_dir = self.backup_alt_downloads_dir @@ -8682,6 +8761,9 @@ def update_temporary_dirs_after_switch(self): directories, both for the old and new database files. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 8766 update_temporary_dirs_after_switch') + # For the old database, delete Tartube's temporary folder from the # filesystem if os.path.isdir(self.backup_temp_dir): @@ -8721,6 +8803,9 @@ def choose_alt_db(self): user. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 8808 choose_alt_db') + db_file_path = os.path.abspath( os.path.join(self.data_dir, self.db_file_name), ) @@ -8798,6 +8883,9 @@ def forget_db(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 8888 forget_db') + # Extract values from the argument list path = data_list.pop(0) pref_win_obj = data_list.pop(0) @@ -8842,6 +8930,9 @@ def forget_all_db(self, pref_win_obj=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 8935 forget_all_db') + # Sanity check if self.current_manager_obj or self.disable_load_save_flag: return False @@ -8867,6 +8958,9 @@ def reset_db(self): created. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 8963 reset_db') + # Reset IVs to their default states self.custom_dl_reg_count = 0 self.custom_dl_reg_dict = {} @@ -8941,6 +9035,9 @@ def check_integrity_db(self, no_prompt_flag=False, parent_win_obj=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 9040 check_integrity_db') + # Basic checks if self.disable_load_save_flag: @@ -9328,6 +9425,9 @@ def fix_integrity_db(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 9430 fix_integrity_db') + # Extract the arguments error_reg_dict = data_list.pop(0) error_master_dict = data_list.pop(0) @@ -9484,6 +9584,9 @@ def check_broken_objs(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 9589 check_broken_objs') + count = 0 # Get a specimen of each type of media data object @@ -9544,6 +9647,9 @@ def fix_broken_objs(self): add any missing IVs with default values. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 9652 fix_broken_objs') + for media_data_obj in self.media_reg_dict.values(): update_dict = media_data_obj.compile_updated_ivs() @@ -9568,6 +9674,9 @@ def compile_specimen_obj_list(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 9679 compile_specimen_obj_list') + # Find a specimen media.Video object video_obj = None for media_data_obj in self.media_reg_dict.values(): @@ -9622,6 +9731,9 @@ def update_data_dirs(self): variables that are derived from it. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 9736 update_data_dirs') + self.downloads_dir = self.data_dir self.alt_downloads_dir = os.path.abspath( os.path.join(self.data_dir, 'downloads'), @@ -9649,6 +9761,9 @@ def setup_paths(self): auto-detect youtube-dl's location, if possible. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 9766 setup_paths') + # Set youtube-dl path IVs if os.name == 'nt': @@ -9797,6 +9912,9 @@ def auto_detect_paths(self): IVs accordingly. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 9917 auto_detect_paths') + # Auto-detection does not apply to MS Windows, for which paths are # fixed if os.name == 'nt': @@ -9873,6 +9991,9 @@ def auto_delete_old_videos(self, update_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 9996 auto_delete_old_videos') + if not self.auto_delete_flag: return @@ -9920,6 +10041,9 @@ def auto_remove_old_videos(self, update_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10046 auto_remove_old_videos') + if not self.auto_remove_flag: return @@ -9963,6 +10087,9 @@ def check_external(self): custom downloaded. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10092 check_external') + # After loading a new database, clear any existing unavailable # containers self.container_unavailable_dict = {} @@ -10006,6 +10133,9 @@ def check_external_dir(self, dir_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10138 check_external_dir') + # Make the semaphore file, if it doesn't already exist # (This function returns the file path on success, or if the file # alread exists. It returns None if the directory doesn't exist or if @@ -10057,6 +10187,9 @@ def convert_version(self, version): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10192 convert_version') + num_list = version.split('.') if len(num_list) != 3: return None @@ -10080,6 +10213,9 @@ def find_sound_effects(self): directory, and updates the IVs. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10218 find_sound_effects') + sound_dir_list = [] sound_dir_list.append( os.path.abspath( @@ -10125,6 +10261,9 @@ def create_fixed_folders(self): destroyed by the user. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10266 create_fixed_folders') + self.fixed_all_folder = self.add_folder( formats.FOLDER_ALL_VIDEOS, None, # No parent folder @@ -10249,6 +10388,9 @@ def rename_fixed_folders(self): otherwise be renamed. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10393 rename_fixed_folders') + self.rename_fixed_folder( self.fixed_all_folder, formats.FOLDER_ALL_VIDEOS, @@ -10320,6 +10462,9 @@ def rename_fixed_folder(self, media_data_obj, new_name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10467 rename_fixed_folder') + # If there is (by chance) a folder with the same name, it must be # renamed for other_obj in self.get_container_list(new_name): @@ -10356,6 +10501,9 @@ def check_fixed_folder(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10506 check_fixed_folder') + if media_data_obj is not None \ and isinstance(media_data_obj, media.Folder) \ and media_data_obj.fixed_flag \ @@ -10385,6 +10533,9 @@ def delete_temp_folders(self): 'Temporary Videos' folder. (The folders themselves are not deleted). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10538 delete_temp_folders') + # (Must compile a list of top-level container objects first, or Python # will complain about the dictionary changing size) obj_list = [] @@ -10420,6 +10571,9 @@ def open_temp_folders(self): things out of them, before they are deleted.) """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10576 open_temp_folders') + for dbid in self.container_reg_dict.keys(): media_data_obj = self.media_reg_dict[dbid] @@ -10449,6 +10603,8 @@ def disable_load_save(self, error_msg=None, lock_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10608 disable_load_save') # This flag is used to detect an interrupted database load due to a # Python error, which would mean that the call to self.load_db() @@ -10484,6 +10640,9 @@ def disable_scheduled_dl(self): Warnings tab. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10645 disable_scheduled_dl') + self.disable_scheduled_dl_flag = True self.system_error( 105, @@ -10501,6 +10660,9 @@ def remove_db_lock_file(self): IVs. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10665 remove_db_lock_file') + if self.db_lock_file_path is not None: if os.path.isfile(self.db_lock_file_path): @@ -10518,6 +10680,9 @@ def remove_stale_lock_file(self): file is stale, and can be removed; so remove it. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10685 remove_stale_lock_file') + lock_path = os.path.abspath( os.path.join(self.data_dir, self.db_file_name + '.lock'), ) @@ -10539,6 +10704,9 @@ def file_error_dialogue(self, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10709 file_error_dialogue') + if self.main_win_obj and self.dialogue_manager_obj: self.dialogue_manager_obj.show_msg_dialogue(msg, 'error', 'ok') @@ -10575,6 +10743,9 @@ def make_directory(self, dir_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10748 make_directory') + try: os.makedirs(dir_path) return True @@ -10610,6 +10781,9 @@ def remove_directory(self, dir_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10768 remove_directory') + try: shutil.rmtree(dir_path) return True @@ -10645,6 +10819,9 @@ def remove_file(self, file_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10824 remove_file') + try: os.remove(file_path) return True @@ -10681,6 +10858,9 @@ def move_file_or_directory(self, old_path, new_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10863 move_file_or_directory') + try: shutil.move(old_path, new_path) return True @@ -10721,6 +10901,9 @@ def make_semaphore_file(self, dir_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10906 make_semaphore_file') + # e.g. .tartube.sem file_path = os.path.abspath( os.path.join(dir_path, '.' + __main__.__packagename__ + '.sem'), @@ -10762,6 +10945,9 @@ def move_backup_files(self): new location. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10950 move_backup_files') + try: file_list = os.listdir(path = self.data_dir) except: @@ -10799,6 +10985,9 @@ def open_wiz_win(self): and install youtube-dl and/or FFmpeg """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 10990 open_wiz_win') + # Open the wizard window. When it closes, self.open_wiz_win_continue() # is called wizwin.SetupWizWin(self) @@ -10817,6 +11006,9 @@ def open_wiz_win_continue(self, wiz_win_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11011 open_wiz_win_continue') + # Once again, auto-detect the location of youtube-dl (or its fork), # now that the user has chosen one self.auto_detect_paths() @@ -10847,6 +11039,9 @@ def prompt_user_for_data_dir(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11044 prompt_user_for_data_dir') + dialogue_win = self.dialogue_manager_obj.show_file_chooser( _('Please select Tartube\'s data folder'), self.main_win_obj, @@ -10904,6 +11099,9 @@ def check_downloader(self, arg, wiz_win_obj=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11104 check_downloader') + if not wiz_win_obj: if self.ytdl_path_custom_flag: @@ -10948,6 +11146,9 @@ def get_downloader(self, wiz_win_obj=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11151 get_downloader') + if not wiz_win_obj: if self.ytdl_fork is not None: @@ -10986,6 +11187,9 @@ def retrieve_videos_from_db(self, data_list, dummy_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11192 retrieve_videos_from_db') + return_list = [] # Search the media data registry @@ -11049,6 +11253,9 @@ def get_proxy(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11258 get_proxy') + if not self.dl_proxy_list: return None @@ -11066,6 +11273,9 @@ def apply_locale(self): Calls the python gettext module to apply the current system locale. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11278 apply_locale') + LOCALE = None error_msg = None @@ -11205,6 +11415,9 @@ def download_manager_start(self, operation_type, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11420 download_manager_start') + # Check for interrupted database loads if self.db_loading_flag: @@ -11402,6 +11615,9 @@ def download_manager_continue(self, arg_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11620 download_manager_continue') + # Extract arguments from arg_list operation_type = arg_list.pop(0) automatic_flag = arg_list.pop(0) @@ -11610,6 +11826,9 @@ def download_manager_halt_timer(self): continue running for a few seconds more. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11831 download_manager_halt_timer') + if self.dl_timer_id: self.dl_timer_check_time \ = int(time.time()) + self.dl_timer_final_time @@ -11624,6 +11843,9 @@ def download_manager_finished(self): widgets. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 11848 download_manager_finished') + # This function behaves differently, if the download operation was # launched from the Classic Mode tab operation_type = self.download_manager_obj.operation_type @@ -11948,6 +12170,9 @@ def update_manager_start(self, update_type): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12175 update_manager_start') + # Check for interrupted database loads if self.db_loading_flag: @@ -12077,6 +12302,9 @@ def update_manager_start_from_wizwin(self, wiz_win_obj, update_type): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12307 update_manager_start_from_wizwin') + if self.current_manager_obj \ or __main__.__pkg_strict_install_flag__ \ or update_type == 'ffmpeg' and os.name != 'nt': @@ -12114,6 +12342,9 @@ def update_manager_halt_timer(self): continue running for a few seconds more. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12347 update_manager_halt_timer') + if self.update_timer_id: self.update_timer_check_time \ = int(time.time()) + self.update_timer_final_time @@ -12127,6 +12358,9 @@ def update_manager_finished(self): widgets. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12363 update_manager_finished') + global HAVE_MATPLOTLIB_FLAG # Import IVs from updates.UpdateManager, before it is destroyed @@ -12260,6 +12494,9 @@ def refresh_manager_start(self, media_data_obj=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12499 refresh_manager_start') + # Check for interrupted database loads if self.db_loading_flag: @@ -12382,6 +12619,9 @@ def refresh_manager_continue(self, media_data_obj=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12624 refresh_manager_continue') + # During a refresh operation, show a progress bar in the Videos tab self.main_win_obj.show_progress_bar('refresh') # Reset the Output tab @@ -12418,6 +12658,9 @@ def refresh_manager_halt_timer(self): continue running for a few seconds more. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12663 refresh_manager_halt_timer') + if self.refresh_timer_id: self.refresh_timer_check_time \ = int(time.time()) + self.refresh_timer_final_time @@ -12431,6 +12674,9 @@ def refresh_manager_finished(self): widgets. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12679 refresh_manager_finished') + # Get the time taken by the refresh operation, so we can convert it # into a nice string below (e.g. '05:15') # For some reason, RefreshManager.stop_time() might not be set, so we @@ -12538,6 +12784,9 @@ def info_manager_start(self, info_type, media_data_obj=None, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12789 info_manager_start') + # Check for interrupted database loads if self.db_loading_flag: @@ -12643,6 +12892,9 @@ def info_manager_halt_timer(self): continue running for a few seconds more. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12897 info_manager_halt_timer') + if self.info_timer_id: self.info_timer_check_time \ = int(time.time()) + self.info_timer_final_time @@ -12655,6 +12907,9 @@ def info_manager_finished(self): The info operation has finished, so update IVs and main window widgets. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 12912 info_manager_finished') + # Import IVs from info.InfoManager, before it is destroyed video_obj = self.info_manager_obj.video_obj info_type = self.info_manager_obj.info_type @@ -12855,6 +13110,9 @@ def tidy_manager_start(self, choices_dict): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13115 tidy_manager_start') + # Check for interrupted database loads if self.db_loading_flag: @@ -12929,6 +13187,9 @@ def tidy_manager_halt_timer(self): running for a few seconds more. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13192 tidy_manager_halt_timer') + if self.tidy_timer_id: self.tidy_timer_check_time \ = int(time.time()) + self.tidy_timer_final_time @@ -12941,6 +13202,9 @@ def tidy_manager_finished(self): The tidy operation has finished, so update IVs and main window widgets. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13207 tidy_manager_finished') + # Get the time taken by the tidy operation, so we can convert it into a # nice string below (e.g. '05:15') # For some reason, TidyManager.stop_time() might not be set, so we need @@ -13024,6 +13288,9 @@ def livestream_manager_start(self): self.livestream_manager_finished() is called. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13293 livestream_manager_start') + # N.B. Check commented out at the moment, as I think it's unnecessary # # Check for interrupted database loads # if self.db_loading_flag: @@ -13074,6 +13341,9 @@ def livestream_manager_finished(self): widgets. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13346 livestream_manager_finished') + # Any code can check whether livestream operation is in progress, or # not, by checking this IV self.livestream_manager_obj = None @@ -13241,6 +13511,9 @@ def process_manager_start(self, options_obj, video_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13516 process_manager_start') + # Check for interrupted database loads if self.db_loading_flag: @@ -13313,6 +13586,9 @@ def process_manager_halt_timer(self): continue running for a few seconds more. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13591 process_manager_halt_timer') + if self.process_timer_id: self.process_timer_check_time \ = int(time.time()) + self.process_timer_final_time @@ -13326,6 +13602,9 @@ def process_manager_finished(self): widgets. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13607 process_manager_finished') + # Get the number of successes and failures success_count = self.process_manager_obj.success_count fail_count = self.process_manager_obj.fail_count @@ -13456,6 +13735,9 @@ def create_video_from_download(self, download_item_obj, dir_path, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13740 create_video_from_download') + # The downloads.DownloadItem handles a download for a video, a channel # or a playlist media_data_obj = download_item_obj.media_data_obj @@ -13584,6 +13866,9 @@ def convert_video_from_download(self, container_obj, options_manager_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13871 convert_video_from_download') + # Does the container object already contain this video? video_obj = None for child_obj in container_obj.child_list: @@ -13658,6 +13943,9 @@ def announce_video_download(self, download_item_obj, video_obj, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13948 announce_video_download') + # Add the video to the 'Recent Videos' folder, if it's not already # there. (The code has to go here and not, say, in # self.create_video_from_download(), because the latter is not @@ -13704,6 +13992,9 @@ def announce_video_clone(self, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 13997 announce_video_clone') + video_path = video_obj.get_actual_path(self) # Only set the .name IV if the video is currently unnamed @@ -13770,6 +14061,9 @@ def create_livestream_from_download(self, container_obj, live_mode, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14066 create_livestream_from_download') + # Fetch the options.OptionsManager object that applies to the container options_manager_obj = utils.get_options_manager(self, container_obj) @@ -13852,6 +14146,9 @@ def update_video_when_file_found(self, video_obj, video_path, temp_dict, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14151 update_video_when_file_found') + # Only set the .name IV if the video is currently unnamed # (N.B. The output template override, if applicable, is handled below) if video_obj.name == self.default_video_name: @@ -14013,6 +14310,9 @@ def update_video_from_json(self, video_obj, mode='default'): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14315 update_video_from_json') + json_path = video_obj.check_actual_path_by_ext(self, '.info.json') if json_path is not None: @@ -14173,6 +14473,9 @@ def update_video_from_filesystem(self, video_obj, video_path, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14478 update_video_from_filesystem') + if override_flag or video_obj.upload_time is None: video_obj.set_upload_time(os.path.getmtime(video_path)) @@ -14243,6 +14546,9 @@ def set_duration_from_moviepy(self, video_obj, video_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14551 set_duration_from_moviepy') + try: clip = moviepy.editor.VideoFileClip(video_path) video_obj.set_duration(clip.duration) @@ -14276,6 +14582,9 @@ def prepare_overwrite_video(self, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14587 prepare_overwrite_video') + path = os.path.abspath( os.path.join( video_obj.parent_obj.get_actual_dir(self), @@ -14310,6 +14619,9 @@ def extract_parent_name_from_metadata(self, video_obj, json_dict): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14624 extract_parent_name_from_metadata') + # For a typical YouTube video, both fields will exist # For a typical YouTube playlist, the .channel field will be something # like 'REAL_NAME - videos' @@ -14378,6 +14690,9 @@ def add_video(self, parent_obj, source=None, dl_sim_flag=False, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14695 add_video') + # Videos can't be placed inside other videos if parent_obj and isinstance(parent_obj, media.Video): return self.system_error( @@ -14469,6 +14784,9 @@ def add_channel(self, name, parent_obj=None, source=None, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14789 add_channel') + # Channels can only be placed inside an unrestricted media.Folder # object (if they have a parent at all) if parent_obj \ @@ -14555,6 +14873,9 @@ def add_playlist(self, name, parent_obj=None, source=None, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14878 add_playlist') + # Playlists can only be place inside an unrestricted media.Folder # object (if they have a parent at all) if parent_obj \ @@ -14649,6 +14970,9 @@ def add_folder(self, name, parent_obj=None, dl_sim_flag=False, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 14975 add_folder') + # Folders can only be placed inside an unrestricted media.Folder object # (if they have a parent at all) if parent_obj \ @@ -14732,6 +15056,9 @@ def move_container_to_top(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 15061 move_container_to_top') + # Do some basic checks if media_data_obj is None or isinstance(media_data_obj, media.Video) \ or self.current_manager_obj or not media_data_obj.parent_obj: @@ -14829,6 +15156,9 @@ def move_container_to_top_continue(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 15161 move_container_to_top_continue') + # Move the sub-directories to their new location if not self.move_file_or_directory( media_data_obj.get_default_dir(self), @@ -14883,6 +15213,9 @@ def move_container(self, source_obj, dest_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 15218 move_container') + # Do some basic checks if source_obj is None or isinstance(source_obj, media.Video) \ or dest_obj is None or isinstance(dest_obj, media.Video): @@ -15046,6 +15379,9 @@ def move_container_continue(self, media_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 15384 move_container_continue') + source_obj = media_list[0] dest_obj = media_list[1] @@ -15106,6 +15442,9 @@ def move_videos(self, dest_obj, video_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 15447 move_videos') + if isinstance(dest_obj, media.Video) or not video_list: return self.system_error( 152, @@ -15181,6 +15520,9 @@ def move_videos_continue(self, media_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 15525 move_videos_continue') + dest_obj = media_list[0] video_list = media_list[1] @@ -15368,6 +15710,9 @@ def convert_remote_container(self, old_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 15715 convert_remote_container') + if ( not isinstance(old_obj, media.Channel) \ and not isinstance(old_obj, media.Playlist) @@ -15458,6 +15803,9 @@ def delete_video(self, video_obj, delete_files_flag=False, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 15808 delete_video') + if not isinstance(video_obj, media.Video): return self.system_error( 155, @@ -15575,6 +15923,9 @@ def delete_video_files(self, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 15928 delete_video_files') + # Sanity check if video_obj.file_name is None and not video_obj.dummy_flag: return @@ -15658,6 +16009,9 @@ def delete_container(self, media_data_obj, empty_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16014 delete_container') + # Check this isn't a video or a fixed folder (which cannot be removed) # v2.1.029 In some older databases, a fixed folder called 'downloads_2' # was created, containing a small number of videos. I'm still not @@ -15778,6 +16132,9 @@ def delete_container_continue(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16137 delete_container_continue') + # Unpack the arguments media_data_obj = data_list[0] empty_flag = data_list[1] @@ -15825,6 +16182,9 @@ def delete_container_complete(self, media_data_obj, empty_flag, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16187 delete_container_complete') + # Confirmation has been obtained, and any files have been deleted (if # required), so now deal with window widgets and with the media data # registry @@ -15981,6 +16341,9 @@ def get_container_list(self, name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16346 get_container_list') + return_list = [] for container_obj in self.container_reg_dict.values(): @@ -16014,6 +16377,9 @@ def get_first_container(self, name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16382 get_first_container') + earliest_obj = None earliest_dbid = 0 @@ -16056,6 +16422,9 @@ def find_duplicate_name_in_container(self, parent_obj, name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16427 find_duplicate_name_in_container') + if parent_obj is None: for dbid in self.container_top_level_list: @@ -16094,6 +16463,9 @@ def is_container(self, name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16468 is_container') + for container_obj in self.container_reg_dict.values(): if container_obj.name == name: return True @@ -16123,6 +16495,9 @@ def get_fixed_folder(self, fixed_type): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16500 get_fixed_folder') + # These values are used by options.OptionsManager if fixed_type == 'temp': return self.fixed_temp_folder @@ -16187,6 +16562,9 @@ def prepare_mark_video(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16567 prepare_mark_video') + action_type = data_list.pop(0) action_flag = data_list.pop(0) container_obj = data_list.pop(0) @@ -16298,6 +16676,9 @@ def mark_video_bookmark(self, video_obj, bookmark_flag, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16681 mark_video_bookmark') + # (List of Video Index rows to update, at the end of this function) update_list = [self.fixed_bookmark_folder] if not no_update_index_flag: @@ -16464,6 +16845,9 @@ def mark_video_downloaded(self, video_obj, dl_flag, not_new_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16850 mark_video_downloaded') + # (List of Video Index rows to update, at the end of this function) update_list = [video_obj.parent_obj, self.fixed_all_folder] @@ -16610,6 +16994,9 @@ def mark_video_favourite(self, video_obj, fav_flag, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 16999 mark_video_favourite') + # (List of Video Index rows to update, at the end of this function) update_list = [self.fixed_fav_folder] if not no_update_index_flag: @@ -16795,6 +17182,9 @@ def mark_video_live(self, video_obj, live_mode, live_data_dict={}, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 17187 mark_video_live') + # (List of Video Index rows to update, at the end of this function) update_list = [self.fixed_live_folder] if not no_update_index_flag: @@ -17034,6 +17424,9 @@ def mark_video_missing(self, video_obj, missing_flag, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 17249 mark_video_missing') + # (List of Video Index rows to update, at the end of this function) update_list = [self.fixed_missing_folder] if not no_update_index_flag: @@ -17213,6 +17606,9 @@ def mark_video_new(self, video_obj, new_flag, no_update_index_flag=False, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 17611 mark_video_new') + # (List of Video Index rows to update, at the end of this function) update_list = [self.fixed_new_folder] if not no_update_index_flag: @@ -17380,6 +17776,9 @@ def mark_video_waiting(self, video_obj, waiting_flag, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 17781 mark_video_waiting') + # (List of Video Index rows to update, at the end of this function) update_list = [self.fixed_waiting_folder] if not no_update_index_flag: @@ -17544,6 +17943,9 @@ def mark_folder_hidden(self, folder_obj, hidden_flag): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 17948 mark_folder_hidden') + if not isinstance(folder_obj, media.Folder): return self.system_error( 164, @@ -17603,6 +18005,9 @@ def mark_container_archived(self, media_data_obj, archive_flag, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 18010 mark_container_archived') + if isinstance(media_data_obj, media.Video): return self.system_error( 165, @@ -17740,6 +18145,9 @@ def mark_container_favourite(self, media_data_obj, fav_flag, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 18150 mark_container_favourite') + if isinstance(media_data_obj, media.Video): return self.system_error( 166, @@ -17937,6 +18345,9 @@ def mark_container_missing(self, media_data_obj, missing_flag): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 18350 mark_container_missing') + if isinstance(media_data_obj, media.Video) \ or ( isinstance(media_data_obj, media.Folder) \ @@ -18066,6 +18477,9 @@ def mark_container_new(self, media_data_obj, new_flag, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 18482 mark_container_new') + if isinstance(media_data_obj, media.Video): return self.system_error( 168, @@ -18239,6 +18653,9 @@ def rename_container(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 18658 rename_container') + # Do some basic checks if media_data_obj is None \ or isinstance(media_data_obj, media.Video) \ @@ -18380,6 +18797,9 @@ def rename_container_silently(self, media_data_obj, new_name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 18802 rename_container_silently') + # Nothing in the Tartube code should be capable of calling this # function with an illegal name, but we'll still check if new_name is None \ @@ -18451,6 +18871,9 @@ def check_container_name_is_legal(self, name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 18876 check_container_name_is_legal') + for regex in self.illegal_name_regex_list: if re.search(regex, name, re.IGNORECASE): # Illegal name @@ -18475,6 +18898,9 @@ def update_container_url(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 18903 update_container_url') + # Extract values from the argument list model = data_list.pop(0) tree_iter = data_list.pop(0) @@ -18502,6 +18928,9 @@ def update_container_url_multiple(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 18933 update_container_url_multiple') + # Extract values from the argument list pref_win = data_list.pop(0) model = data_list.pop(0) @@ -18560,6 +18989,9 @@ def update_container_name(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 18994 update_container_name') + # Extract values from the argument list model = data_list.pop(0) tree_iter = data_list.pop(0) @@ -18596,6 +19028,9 @@ def video_compare(self, obj1, obj2): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 19033 video_compare') + if self.catalogue_reverse_sort_flag: obj1, obj2 = obj2, obj1 @@ -18705,6 +19140,9 @@ def folder_child_compare(self, obj1, obj2): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 19145 folder_child_compare') + if self.catalogue_reverse_sort_flag: obj1, obj2 = obj2, obj1 @@ -18773,6 +19211,9 @@ def export_from_db(self, media_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 19216 export_from_db') + # If the specified list is empty, a summary of the whole database is # exported if not media_list: @@ -19136,6 +19577,9 @@ def export_from_db_to_text_insert(self, db_dict, line_list, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 19582 export_from_db_to_text_insert') + for dbid in db_dict.keys(): mini_dict = db_dict[dbid] @@ -19250,6 +19694,9 @@ def export_from_db_to_csv_insert(self, db_dict, line_list, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 19699 export_from_db_to_csv_insert') + separator = self.export_csv_separator for dbid in db_dict.keys(): @@ -19357,6 +19804,9 @@ def import_into_db(self): self.export_from_db(). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 19809 import_into_db') + # Prompt the user for the export file to load dialogue_win = self.dialogue_manager_obj.show_file_chooser( _('Select the database export'), @@ -19550,6 +20000,9 @@ def parse_csv_import(self, text): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20005 parse_csv_import') + db_dict = {} fake_dbid = 0 check_flag = False @@ -19726,6 +20179,9 @@ def parse_text_import(self, text): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20184 parse_text_import') + db_dict = {} fake_dbid = 0 check_flag = False @@ -19938,6 +20394,9 @@ def parse_import_insert(self, db_dict, container_name, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20399 parse_import_insert') + for this_fake_dbid in db_dict: this_mini_dict = db_dict[this_fake_dbid] @@ -20017,6 +20476,9 @@ def process_import(self, db_dict, flat_db_dict, parent_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20481 process_import') + url_check_dict = {} if parent_obj: @@ -20228,6 +20690,9 @@ def rename_imported_container(self, parent_obj, name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20695 rename_imported_container') + count = 1 while True: @@ -20254,6 +20719,9 @@ def watch_video_in_player(self, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20724 watch_video_in_player') + path = video_obj.get_actual_path(self) if os.path.isfile(path): @@ -20306,6 +20774,9 @@ def download_watch_videos(self, video_list, watch_flag=True): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20779 download_watch_videos') + # Sanity check: this function is only for videos for video_obj in video_list: if not isinstance(video_obj, media.Video): @@ -20369,6 +20840,9 @@ def delete_custom_dl_manager(self, custom_dl_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20845 delete_custom_dl_manager') + # Sanity check if self.current_manager_obj \ or self.general_custom_dl_obj == custom_dl_obj: @@ -20415,6 +20889,9 @@ def apply_classic_custom_dl_manager(self, custom_dl_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20894 apply_classic_custom_dl_manager') + if self.current_manager_obj: return self.system_error( 173, @@ -20444,6 +20921,9 @@ def disapply_classic_custom_dl_manager(self): destroy the object. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20926 disapply_classic_custom_dl_manager') + if self.current_manager_obj or not self.classic_custom_dl_obj: return self.system_error( 174, @@ -20479,6 +20959,9 @@ def create_custom_dl_manager(self, name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20964 create_custom_dl_manager') + self.custom_dl_reg_count += 1 custom_dl_obj = downloads.CustomDLManager( @@ -20511,6 +20994,9 @@ def clone_custom_dl_manager_from_window(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 20999 clone_custom_dl_manager_from_window') + edit_win_obj = data_list.pop(0) custom_dl_obj = data_list.pop(0) @@ -20539,6 +21025,9 @@ def clone_custom_dl_manager(self, old_custom_dl_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21030 clone_custom_dl_manager') + # Work out a name for the clone that's not already in use # (custom download manager objects don't have unique names, but in this # case we'll give it a unique name, so that the user can clearly see @@ -20597,6 +21086,9 @@ def reset_custom_dl_manager(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21091 reset_custom_dl_manager') + edit_win_obj = data_list.pop(0) old_custom_dl_obj = edit_win_obj.edit_obj @@ -20634,6 +21126,9 @@ def export_custom_dl_manager(self, custom_dl_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21131 export_custom_dl_manager') + # Prompt the user for the file path to use dialogue_win = self.dialogue_manager_obj.show_file_chooser( _('Select where to save the custom download export'), @@ -20729,6 +21224,9 @@ def import_custom_dl_manager(self, custom_dl_name=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21229 import_custom_dl_manager') + # Prompt the user for the export file to load dialogue_win = self.dialogue_manager_obj.show_file_chooser( _('Select the custom download export file'), @@ -20829,6 +21327,9 @@ def compile_custom_dl_manager_list(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21332 compile_custom_dl_manager_list') + manager_list = [] for this_obj in self.custom_dl_reg_dict.values(): @@ -20865,6 +21366,9 @@ def check_custom_download_managers(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21371 check_custom_download_managers') + for custom_dl_obj in self.custom_dl_reg_dict.values(): if custom_dl_obj != self.general_custom_dl_obj \ and ( @@ -20895,6 +21399,9 @@ def add_profile(self, profile_name, dbid_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21404 add_profile') + if profile_name in self.profile_dict: return self.system_error( @@ -20929,6 +21436,9 @@ def delete_profile(self, profile_name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21441 delete_profile') + if not profile_name in self.profile_dict: return self.system_error( @@ -20974,6 +21484,9 @@ def apply_download_options(self, media_data_obj, options_obj=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21489 apply_download_options') + if self.current_manager_obj \ or media_data_obj.options_obj\ or ( @@ -21043,6 +21556,9 @@ def remove_download_options(self, media_data_obj, no_update_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21561 remove_download_options') + # Sanity check. Removing an options manager object during an operation # is not allowed, with one exception: during a download operation, # a video marked as downloaded can have its options manager removed @@ -21122,6 +21638,9 @@ def delete_download_options(self, options_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21643 delete_download_options') + # Sanity check if self.current_manager_obj \ or self.general_options_obj == options_obj: @@ -21185,6 +21704,9 @@ def apply_classic_download_options(self, options_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21709 apply_classic_download_options') + if self.current_manager_obj: return self.system_error( 181, @@ -21209,6 +21731,9 @@ def remove_classic_download_options(self): in the Classic Mode tab, but doesn't destroy the manager itself. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21736 remove_classic_download_options') + if self.current_manager_obj or not self.classic_options_obj: return self.system_error( 182, @@ -21248,6 +21773,9 @@ def create_download_options(self, name, dbid=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21778 create_download_options') + self.options_reg_count += 1 options_obj = options.OptionsManager( @@ -21280,6 +21808,9 @@ def clone_download_options(self, old_options_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21813 clone_download_options') + # Work out a name for the clone that's not already in use (either by # an existing options manager, or by a channel/playlist/folder) # (Options manager objects don't have unique names, but in this case @@ -21345,6 +21876,9 @@ def clone_download_options_from_window(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21881 clone_download_options_from_window') + edit_win_obj = data_list.pop(0) options_obj = data_list.pop(0) @@ -21369,6 +21903,9 @@ def reset_download_options(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21908 reset_download_options') + edit_win_obj = data_list.pop(0) old_options_obj = edit_win_obj.edit_obj @@ -21427,6 +21964,9 @@ def export_download_options(self, options_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 21969 export_download_options') + # Prompt the user for the file path to use dialogue_win = self.dialogue_manager_obj.show_file_chooser( _('Select where to save the options export'), @@ -21513,6 +22053,9 @@ def import_download_options(self, options_name=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22058 import_download_options') + # Prompt the user for the export file to load dialogue_win = self.dialogue_manager_obj.show_file_chooser( _('Select the options export file'), @@ -21621,6 +22164,9 @@ def create_ffmpeg_options(self, name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22169 create_ffmpeg_options') + self.ffmpeg_reg_count += 1 options_obj = ffmpeg_tartube.FFmpegOptionsManager( @@ -21649,6 +22195,9 @@ def clone_ffmpeg_options_from_window(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22200 clone_ffmpeg_options_from_window') + edit_win_obj = data_list.pop(0) options_obj = data_list.pop(0) @@ -21677,6 +22226,9 @@ def clone_ffmpeg_options(self, old_options_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22231 clone_ffmpeg_options') + # Work out a name for the clone that's not already in use # (FFmpeg Options manager objects don't have unique names, but in this # case we'll give it a unique name, so that the user can clearly see @@ -21732,6 +22284,9 @@ def reset_ffmpeg_options(self, data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22289 reset_ffmpeg_options') + edit_win_obj = data_list.pop(0) old_options_obj = edit_win_obj.edit_obj @@ -21763,6 +22318,9 @@ def delete_ffmpeg_options(self, options_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22323 delete_ffmpeg_options') + # Sanity check if self.ffmpeg_options_obj == options_obj: return self.system_error( @@ -21796,6 +22354,9 @@ def export_ffmpeg_options(self, options_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22359 export_ffmpeg_options') + # Prompt the user for the file path to use dialogue_win = self.dialogue_manager_obj.show_file_chooser( _('Select where to save the options export'), @@ -21882,6 +22443,9 @@ def import_ffmpeg_options(self, options_name=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22448 import_ffmpeg_options') + # Prompt the user for the export file to load dialogue_win = self.dialogue_manager_obj.show_file_chooser( _('Select the options export file'), @@ -21984,6 +22548,9 @@ def play_sound(self, sound_name=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22553 play_sound') + if self.sound_dir is None: return @@ -22033,6 +22600,9 @@ def script_slow_timer_callback(self): """ + if DEBUG_FUNC_FLAG and not DEBUG_NO_TIMER_FUNC_FLAG: + utils.debug_time('app 22605 script_slow_timer_callback') + # No point keeping the timer going, once load/save (and therefore all # operations) are disabled if self.disable_load_save_flag: @@ -22288,6 +22858,9 @@ def script_slow_timer_get_return_value(self): GObject timer going, or 0 to halt it. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22863 script_slow_timer_get_return_value') + if self.script_once_timer_id is not None: # Halt the once-only timer @@ -22329,6 +22902,9 @@ def script_slow_timer_insert_download(self, media_data_obj, scheduled_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22907 script_slow_timer_insert_download') + if self.download_manager_obj: if join_mode == 'priority': @@ -22371,6 +22947,9 @@ def script_slow_timer_reset_scheduled_dl(self, scheduled_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 22952 script_slow_timer_reset_scheduled_dl') + current_time = time.time() for scheduled_obj in scheduled_list: @@ -22399,6 +22978,9 @@ def script_fast_timer_callback(self): """ + if DEBUG_FUNC_FLAG and not DEBUG_NO_TIMER_FUNC_FLAG: + utils.debug_time('app 22983 script_fast_timer_callback') + # Reset the position of main window sliders (due to Gtk issues, for a # second time), if required if self.main_win_slider_reset_flag: @@ -22453,6 +23035,9 @@ def dl_timer_callback(self): """ + if DEBUG_FUNC_FLAG and not DEBUG_NO_TIMER_FUNC_FLAG: + utils.debug_time('app 23040 dl_timer_callback') + # This function behaves differently, if the download operation was # launched from the Classic Mode tab if not self.download_manager_obj \ @@ -22542,6 +23127,9 @@ def update_timer_callback(self): """ + if DEBUG_FUNC_FLAG and not DEBUG_NO_TIMER_FUNC_FLAG: + utils.debug_time('app 23132 update_timer_callback') + if self.update_timer_check_time is None: # Update operation still in progress, return 1 to keep the timer @@ -22575,6 +23163,9 @@ def refresh_timer_callback(self): """ + if DEBUG_FUNC_FLAG and not DEBUG_NO_TIMER_FUNC_FLAG: + utils.debug_time('app 23168 refresh_timer_callback') + if self.refresh_timer_check_time is None: # Refresh operation still in progress, return 1 to keep the timer @@ -22608,6 +23199,9 @@ def info_timer_callback(self): """ + if DEBUG_FUNC_FLAG and not DEBUG_NO_TIMER_FUNC_FLAG: + utils.debug_time('app 23204 info_timer_callback') + if self.info_timer_check_time is None: # Info operation still in progress, return 1 to keep the timer @@ -22641,6 +23235,9 @@ def tidy_timer_callback(self): """ + if DEBUG_FUNC_FLAG and not DEBUG_NO_TIMER_FUNC_FLAG: + utils.debug_time('app 23240 tidy_timer_callback') + if self.tidy_timer_check_time is None: # Tidy operation still in progress, return 1 to keep the timer @@ -22674,6 +23271,9 @@ def process_timer_callback(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23276 process_timer_callback') + if self.process_timer_check_time is None: # Process operation still in progress, return 1 to keep the timer @@ -22709,6 +23309,9 @@ def on_button_apply_error_filter(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23314 on_button_apply_error_filter') + # Apply the filter self.main_win_obj.errors_list_apply_filter() @@ -22728,6 +23331,9 @@ def on_button_apply_filter(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23336 on_button_apply_filter') + # Sanity check if not self.main_win_obj.video_catalogue_dict: return self.system_error( @@ -22754,6 +23360,9 @@ def on_button_cancel_date(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23365 on_button_cancel_date') + self.main_win_obj.video_catalogue_unshow_date() @@ -22771,6 +23380,9 @@ def on_button_cancel_error_filter(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23385 on_button_cancel_error_filter') + # Apply the filter self.main_win_obj.errors_list_cancel_filter() @@ -22789,6 +23401,9 @@ def on_button_cancel_filter(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23406 on_button_cancel_filter') + # Sanity check if not self.main_win_obj.video_catalogue_dict: return self.system_error( @@ -22817,6 +23432,9 @@ def on_button_check_all(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23437 on_button_check_all') + media_list = [] for dbid in self.main_win_obj.video_index_marker_dict.keys(): if dbid in self.container_reg_dict: @@ -22845,6 +23463,9 @@ def on_button_classic_add_clips(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23468 on_button_classic_add_clips') + self.main_win_obj.on_video_catalogue_process_clip_classic_mode() @@ -22864,6 +23485,9 @@ def on_button_classic_add_urls(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23490 on_button_classic_add_urls') + self.main_win_obj.classic_mode_tab_add_urls() @@ -22882,6 +23506,9 @@ def on_button_classic_archive(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23511 on_button_classic_archive') + if self.main_win_obj.classic_archive_button.get_active(): self.classic_ytdl_archive_flag = True else: @@ -22903,6 +23530,9 @@ def on_button_classic_dest_dir(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23535 on_button_classic_dest_dir') + dialogue_win = self.dialogue_manager_obj.show_file_chooser( _('Please select a destination folder'), self.main_win_obj, @@ -22946,6 +23576,9 @@ def on_button_classic_dest_dir_open(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23581 on_button_classic_dest_dir_open') + utils.open_file(self, self.classic_dir_list[0]) @@ -22965,6 +23598,9 @@ def on_button_classic_clear(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23603 on_button_classic_clear') + dbid_list = list(self.main_win_obj.classic_media_dict.keys()) if not dbid_list: return @@ -23002,6 +23638,9 @@ def on_button_classic_clear_dl(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23643 on_button_classic_clear_dl') + video_list = list(self.main_win_obj.classic_media_dict.values()) # Filter out un-downloaded videos @@ -23043,6 +23682,9 @@ def on_button_classic_clips(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23687 on_button_classic_clips') + selection = self.main_win_obj.classic_progress_treeview.get_selection() (model, path_list) = selection.get_selected_rows() if not path_list: @@ -23099,6 +23741,9 @@ def on_button_classic_download(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23746 on_button_classic_download') + self.main_win_obj.classic_mode_tab_start_download() @@ -23116,6 +23761,9 @@ def on_button_classic_ffmpeg(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23766 on_button_classic_ffmpeg') + selection = self.main_win_obj.classic_progress_treeview.get_selection() (model, path_list) = selection.get_selected_rows() if not path_list: @@ -23168,6 +23816,9 @@ def on_button_classic_menu(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23821 on_button_classic_menu') + # Open the popup menu self.main_win_obj.classic_popup_menu() @@ -23186,6 +23837,9 @@ def on_button_classic_move_up(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23842 on_button_classic_move_up') + self.main_win_obj.classic_mode_tab_move_row(True) @@ -23203,6 +23857,9 @@ def on_button_classic_move_down(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23862 on_button_classic_move_down') + self.main_win_obj.classic_mode_tab_move_row(False) @@ -23221,6 +23878,9 @@ def on_button_classic_open(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23883 on_button_classic_open') + selection = self.main_win_obj.classic_progress_treeview.get_selection() (model, path_list) = selection.get_selected_rows() if not path_list: @@ -23270,6 +23930,9 @@ def on_button_classic_play(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23935 on_button_classic_play') + selection = self.main_win_obj.classic_progress_treeview.get_selection() (model, path_list) = selection.get_selected_rows() if not path_list: @@ -23316,6 +23979,9 @@ def on_button_classic_redownload(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 23984 on_button_classic_redownload') + selection = self.main_win_obj.classic_progress_treeview.get_selection() (model, path_list) = selection.get_selected_rows() if not path_list: @@ -23402,6 +24068,9 @@ def on_button_classic_remove(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24073 on_button_classic_remove') + selection = self.main_win_obj.classic_progress_treeview.get_selection() (model, path_list) = selection.get_selected_rows() if not path_list: @@ -23448,6 +24117,9 @@ def on_button_classic_stop(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24122 on_button_classic_stop') + selection = self.main_win_obj.classic_progress_treeview.get_selection() (model, path_list) = selection.get_selected_rows() if not path_list: @@ -23494,6 +24166,9 @@ def on_button_custom_dl_all(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24171 on_button_custom_dl_all') + media_data_list = [] for dbid in self.main_win_obj.video_index_marker_dict.keys(): if dbid in self.container_reg_dict: @@ -23542,6 +24217,9 @@ def on_button_download_all(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24222 on_button_download_all') + media_list = [] for dbid in self.main_win_obj.video_index_marker_dict.keys(): if dbid in self.container_reg_dict: @@ -23568,6 +24246,9 @@ def on_button_drag_drop_add(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24251 on_button_drag_drop_add') + # Open the popup menu self.main_win_obj.drag_drop_add_dropzone() @@ -23588,6 +24269,9 @@ def on_button_find_date(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24274 on_button_find_date') + # Sanity check if not self.main_win_obj.video_catalogue_dict: return self.system_error( @@ -23673,6 +24357,9 @@ def on_button_first_page(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24362 on_button_first_page') + self.main_win_obj.video_catalogue_redraw_all( self.main_win_obj.video_index_current_dbid, 1, @@ -23696,6 +24383,9 @@ def on_button_hide_system(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24388 on_button_hide_system') + # Toggle the menu item, which sets the IV (and updates the toolbar # button) if not self.main_win_obj.hide_system_menu_item.get_active(): @@ -23718,6 +24408,9 @@ def on_button_last_page(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24413 on_button_last_page') + self.main_win_obj.video_catalogue_redraw_all( self.main_win_obj.video_index_current_dbid, self.main_win_obj.catalogue_toolbar_last_page, @@ -23740,6 +24433,9 @@ def on_button_next_page(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24438 on_button_next_page') + self.main_win_obj.video_catalogue_redraw_all( self.main_win_obj.video_index_current_dbid, self.main_win_obj.catalogue_toolbar_current_page + 1, @@ -23762,6 +24458,9 @@ def on_button_previous_page(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24463 on_button_previous_page') + self.main_win_obj.video_catalogue_redraw_all( self.main_win_obj.video_index_current_dbid, self.main_win_obj.catalogue_toolbar_current_page - 1, @@ -23785,6 +24484,9 @@ def on_button_resort_catalogue(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24489 on_button_resort_catalogue') + if self.main_win_obj.video_index_current_dbid is not None: self.main_win_obj.video_catalogue_force_resort() @@ -23804,6 +24506,9 @@ def on_button_reverse_sort_catalogue(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24511 on_button_reverse_sort_catalogue') + if not self.catalogue_reverse_sort_flag: self.catalogue_reverse_sort_flag = True else: @@ -23828,6 +24533,9 @@ def on_button_scroll_down(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24538 on_button_scroll_down') + adjust = self.main_win_obj.catalogue_scrolled.get_vadjustment() adjust.set_value(adjust.get_upper()) @@ -23846,6 +24554,9 @@ def on_button_scroll_up(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24559 on_button_scroll_up') + self.main_win_obj.catalogue_scrolled.get_vadjustment().set_value(0) @@ -23864,6 +24575,9 @@ def on_button_show_filter(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24580 on_button_show_filter') + if not self.catalogue_show_filter_flag: self.catalogue_show_filter_flag = True else: @@ -23889,6 +24603,9 @@ def on_button_stop_operation(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24608 on_button_stop_operation') + self.operation_halted_flag = True # (The livestream operation runs silently in the background, so the @@ -23923,6 +24640,9 @@ def on_button_switch_view(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24645 on_button_switch_view') + # self.catalogue_mode_list provides an ordered list of values for # self.catalogue_mode and self.catalogue_mode_type # Find the current setting in the list, and switch to the next setting @@ -23976,6 +24696,9 @@ def on_button_use_regex(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24701 on_button_use_regex') + # Sanity check if not self.main_win_obj.video_catalogue_dict: return self.system_error( @@ -24003,6 +24726,9 @@ def on_menu_about(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24731 on_menu_about') + dialogue_win = Gtk.AboutDialog() dialogue_win.set_transient_for(self.main_win_obj) dialogue_win.set_destroy_with_parent(True) @@ -24041,6 +24767,9 @@ def on_menu_about_close(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24772 on_menu_about_close') + action.destroy() @@ -24060,6 +24789,9 @@ def on_menu_add_bulk(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24794 on_menu_add_bulk') + # If a folder is selected in the Video Index, the dialogue window # should suggest that as the new folder's parent folder suggest_parent_dbid = None @@ -24160,6 +24892,9 @@ def on_menu_add_channel(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 24897 on_menu_add_channel') + dl_sim_flag = False monitor_flag = False # (The while loop below must be run at least once) @@ -24318,6 +25053,9 @@ def on_menu_add_folder(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25058 on_menu_add_folder') + # If a folder (but not a channel/playlist) is selected in the Video # Index, use that as the dialogue window's suggested parent folder suggest_parent_dbid = None @@ -24439,6 +25177,9 @@ def on_menu_add_playlist(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25182 on_menu_add_playlist') + dl_sim_flag = False monitor_flag = False # (The while loop below must be run at least once) @@ -24597,6 +25338,9 @@ def on_menu_add_video(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25343 on_menu_add_video') + dialogue_win = mainwin.AddVideoDialogue(self.main_win_obj) response = dialogue_win.run() @@ -24672,6 +25416,9 @@ def on_menu_auto_switch(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25421 on_menu_auto_switch') + if not self.auto_switch_profile_flag: self.auto_switch_profile_flag = True else: @@ -24692,6 +25439,9 @@ def on_menu_create_profile(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25444 on_menu_create_profile') + # Don't create profiles if nothing marked if not self.main_win_obj.video_index_marker_dict: @@ -24775,6 +25525,9 @@ def on_menu_cancel_live(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25530 on_menu_cancel_live') + # The actions are stored in five different dictionaries. Compile a # single dictionary, eliminating duplicates, so we can count how # many media.Video objects are affected (and updte the Video @@ -24845,6 +25598,9 @@ def on_menu_change_db(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25603 on_menu_change_db') + config.SystemPrefWin(self, 'db') @@ -24863,6 +25619,9 @@ def on_menu_change_theme(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25624 on_menu_change_theme') + dialogue_win = mainwin.ChangeThemeDialogue(self.main_win_obj) response = dialogue_win.run() @@ -24951,6 +25710,9 @@ def on_menu_check_db(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25715 on_menu_check_db') + self.check_integrity_db() @@ -24968,6 +25730,9 @@ def on_menu_check_all(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25735 on_menu_check_all') + self.download_manager_start('sim') @@ -24985,6 +25750,9 @@ def on_menu_check_version(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25755 on_menu_check_version') + self.info_manager_start('version') @@ -25002,6 +25770,9 @@ def on_menu_close_tray(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25775 on_menu_close_tray') + self.main_win_obj.toggle_visibility() @@ -25019,6 +25790,9 @@ def on_menu_create_profile(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25795 on_menu_create_profile') + # Don't create profiles if nothing marked if not self.main_win_obj.video_index_marker_dict: @@ -25102,6 +25876,9 @@ def on_menu_custom_dl_all(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25881 on_menu_custom_dl_all') + # If additional custom download managers have been created, prompt the # user to choose one of them if self.check_custom_download_managers(): @@ -25142,6 +25919,9 @@ def on_menu_download_all(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25924 on_menu_download_all') + self.download_manager_start('real') @@ -25159,6 +25939,9 @@ def on_menu_export_db(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25944 on_menu_export_db') + self.export_from_db( [] ) @@ -25176,6 +25959,9 @@ def on_menu_general_options(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25964 on_menu_general_options') + config.OptionsEditWin(self, self.general_options_obj) @@ -25193,6 +25979,9 @@ def on_menu_go_website(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 25984 on_menu_go_website') + utils.open_file(self, __main__.__website__) @@ -25211,6 +26000,9 @@ def on_menu_hide_system(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26005 on_menu_hide_system') + # Update the IV if not self.main_win_obj.hide_system_menu_item.get_active(): self.toolbar_system_hide_flag = False @@ -25235,6 +26027,9 @@ def on_menu_import_db(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26034 on_menu_import_db') + self.import_into_db() @@ -25252,6 +26047,9 @@ def on_menu_import_yt(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26052 on_menu_import_yt') + wizwin.ImportYTWizWin(self) @@ -25269,6 +26067,9 @@ def on_menu_install_ffmpeg(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26072 on_menu_install_ffmpeg') + self.update_manager_start('ffmpeg') @@ -25286,6 +26087,9 @@ def on_menu_install_matplotlib(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26092 on_menu_install_matplotlib') + self.update_manager_start('matplotlib') @@ -25303,6 +26107,9 @@ def on_menu_install_streamlink(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26112 on_menu_install_streamlink') + self.update_manager_start('streamlink') @@ -25320,6 +26127,9 @@ def on_menu_live_preferences(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26132 on_menu_live_preferences') + config.SystemPrefWin(self, 'live') @@ -25337,6 +26147,9 @@ def on_menu_mark_all(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26152 on_menu_mark_all') + self.main_win_obj.video_index_set_marker() @@ -25354,6 +26167,9 @@ def on_menu_open_msys2(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26157 on_menu_open_msys2') + if 'PROGRAMFILES(X86)' in os.environ: utils.open_file(self, '..\\..\\..\\mingw64.exe') else: @@ -25380,6 +26196,9 @@ def on_menu_refresh_db(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26201 on_menu_refresh_db') + self.refresh_manager_start() @@ -25400,6 +26219,9 @@ def on_menu_reset_container(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26224 on_menu_reset_container') + # If the user needs to check/download channels/playlists first, then # tell them about it if not self.media_reset_container_dict: @@ -25473,6 +26295,9 @@ def on_menu_save_all(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26300 on_menu_save_all') + if not self.disable_load_save_flag: self.save_config() if not self.disable_load_save_flag: @@ -25503,6 +26328,9 @@ def on_menu_save_db(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26333 on_menu_save_db') + self.save_db() # Show a dialogue window for confirmation (unless file load/save has @@ -25530,6 +26358,9 @@ def on_menu_send_feedback(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26348 on_menu_send_feedback') + utils.open_file(self, __main__.__website_bugs__) @@ -25547,6 +26378,9 @@ def on_menu_show_hidden(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26383 on_menu_show_hidden') + for media_data_obj in self.container_reg_dict.values(): if isinstance(media_data_obj, media.Folder) \ @@ -25568,6 +26402,9 @@ def on_menu_show_install(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26407 on_menu_show_install') + # (This path assumes that the standard NSIS installation script was # used to install Tartube) utils.open_file( @@ -25590,6 +26427,9 @@ def on_menu_show_script(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26432 on_menu_show_script') + utils.open_file(self, self.script_parent_dir) @@ -25608,6 +26448,9 @@ def on_menu_stop_soon(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26453 on_menu_stop_soon') + # Sanity check if not self.download_manager_obj: return self.system_error( @@ -25634,6 +26477,9 @@ def on_menu_system_preferences(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26482 on_menu_system_preferences') + config.SystemPrefWin(self) @@ -25652,6 +26498,9 @@ def on_menu_test(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26503 on_menu_test') + # Add media data objects for testing: videos, channels, playlists and/ # or folders testing.add_test_media(self) @@ -25683,6 +26532,9 @@ def on_menu_test_code(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26537 on_menu_test_code') + result = testing.run_test_code(self) self.dialogue_manager_obj.show_simple_msg_dialogue( @@ -25707,6 +26559,9 @@ def on_menu_test_ytdl(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26564 on_menu_test_ytdl') + # Prompt the user for what should be tested dialogue_win = mainwin.TestCmdDialogue(self.main_win_obj) response = dialogue_win.run() @@ -25751,6 +26606,9 @@ def on_menu_tidy_up(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26611 on_menu_tidy_up') + # Prompt the user to specify which actions should be applied to # Tartube's data directory dialogue_win = mainwin.TidyDialogue(self.main_win_obj) @@ -25843,6 +26701,9 @@ def on_menu_tutorial(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26706 on_menu_tutorial') + wizwin.TutorialWizWin(self) @@ -25860,6 +26721,9 @@ def on_menu_unmark_all(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26726 on_menu_unmark_all') + self.main_win_obj.video_index_reset_marker() @@ -25878,6 +26742,9 @@ def on_menu_update_live(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26747 on_menu_update_live') + # Because livestream operations run silently in the background, when # the user goes to the trouble of clicking a menu item in the # main window's menu, tell them why nothing is happening @@ -25911,6 +26778,9 @@ def on_menu_update_ytdl(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26783 on_menu_update_ytdl') + self.update_manager_start('ytdl') @@ -25928,6 +26798,9 @@ def on_menu_quit(self, action, par): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26803 on_menu_quit') + self.stop() @@ -25956,6 +26829,9 @@ def reject_container_name(self, name, parent_obj, duplicate_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 26834 reject_container_name') + media_type = duplicate_obj.get_type() if not parent_obj: @@ -26280,6 +27156,9 @@ def set_bandwidth_default(self, value): the new value is applied to the next download job. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 27161 set_bandwidth_default') + if value < self.bandwidth_min or value > self.bandwidth_max: return self.system_error( 192, @@ -26397,6 +27276,11 @@ def toggle_classic_pending_flag(self): def set_catalogue_clickable_container_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'app 27281 set_catalogue_clickable_container_flag', + ) + if not flag: self.catalogue_clickable_container_flag = False else: @@ -26411,6 +27295,9 @@ def set_catalogue_clickable_container_flag(self, flag): def set_catalogue_mode(self, catalogue_mode, catalogue_mode_type): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 27300 set_catalogue_mode') + self.catalogue_mode = catalogue_mode self.catalogue_mode_type = catalogue_mode_type @@ -26428,6 +27315,9 @@ def set_catalogue_mode(self, catalogue_mode, catalogue_mode_type): def set_catalogue_show_nickname_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 27320 set_catalogue_show_nickname_flag') + if not flag: self.catalogue_show_nickname_flag = False else: @@ -26547,6 +27437,9 @@ def set_complex_index_flag(self, flag): def set_custom_bg(self, key, red, green, blue, alpha): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 27442 set_custom_bg') + self.custom_bg_table[key] = [ red, green, blue, alpha ] # Update the main window IV @@ -26555,6 +27448,9 @@ def set_custom_bg(self, key, red, green, blue, alpha): def reset_custom_bg(self, key): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 27453 reset_custom_bg') + self.custom_bg_table[key] = self.default_bg_table[key] # Update the main window IV @@ -26563,6 +27459,9 @@ def reset_custom_bg(self, key): def set_custom_invidious_mirror(self, value): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 27461 set_custom_invidious_mirror') + self.custom_invidious_mirror = value # The Video Catalogue must be redrawn to reset labels (but not when @@ -26578,6 +27477,9 @@ def set_custom_invidious_mirror(self, value): def reset_custom_invidious_mirror(self): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 27481 reset_custom_invidious_mirror') + self.custom_invidious_mirror = self.default_invidious_mirror # The Video Catalogue must be redrawn to reset labels (but not when @@ -26718,6 +27620,9 @@ def set_dialogue_yt_remind_flag(self, flag): def set_disable_dl_all_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 27625 set_disable_dl_all_flag') + if not flag: self.disable_dl_all_flag = False self.main_win_obj.enable_dl_all_buttons() @@ -27181,6 +28086,9 @@ def set_livestream_use_colour_flag(self, flag): def set_main_win_save_size_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28091 set_main_win_save_size_flag') + if not flag: self.main_win_save_size_flag = False self.main_win_save_width = self.main_win_width @@ -27195,6 +28103,9 @@ def set_main_win_save_size_flag(self, flag): def set_main_win_save_slider_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28108 set_main_win_save_slider_flag') + if not flag: self.main_win_save_slider_flag = False self.main_win_videos_slider_posn = self.paned_default_size @@ -27206,6 +28117,9 @@ def set_main_win_save_slider_flag(self, flag): def set_main_win_slider_reset_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28122 set_main_win_slider_reset_flag') + if not flag: self.main_win_slider_reset_flag = False else: @@ -27271,6 +28185,9 @@ def set_num_worker_default(self, value): increases the number of pages in the Output tab, if necessary. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28190 set_num_worker_default') + if value < self.num_worker_min or value > self.num_worker_max: return self.system_error( 193, @@ -27420,6 +28337,9 @@ def set_output_size_apply_flag(self, flag): def set_output_size_default(self, value): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28342 set_output_size_default') + if value < self.output_size_min or value > self.output_size_max: return self.system_error( 194, @@ -27445,6 +28365,9 @@ def reset_override_local(self): def set_progress_list_hide_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28370 set_progress_list_hide_flag') + if not flag: self.progress_list_hide_flag = False else: @@ -27457,6 +28380,9 @@ def set_progress_list_hide_flag(self, flag): def set_progress_list_remember_width_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28385 set_progress_list_remember_width_flag') + if not flag: self.progress_list_remember_width_flag = False self.progress_list_width_source = None @@ -27547,6 +28473,9 @@ def add_scheduled_list(self, scheduled_obj): def del_scheduled_list(self, data_list): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28478 del_scheduled_list') + scheduled_obj = data_list[0] edit_win = data_list[1] @@ -27562,6 +28491,9 @@ def move_scheduled_list(self, name, flag): """'flag' is False to move an item up the list, True to move it down the list.""" + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28496 move_scheduled_list') + for scheduled_obj in self.scheduled_list: if scheduled_obj.name == name: @@ -27686,6 +28618,9 @@ def set_show_newbie_dialogue_flag(self, flag): def set_show_pretty_dates_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28623 set_show_pretty_dates_flag') + if not flag: self.show_pretty_dates_flag = False else: @@ -27702,6 +28637,9 @@ def set_show_pretty_dates_flag(self, flag): def set_show_marker_in_index_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28642 set_show_marker_in_index_flag') + if not flag: self.show_marker_in_index_flag = False else: @@ -27715,6 +28653,9 @@ def set_show_marker_in_index_flag(self, flag): def set_show_small_icons_in_index_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28658 set_show_small_icons_in_index_flag') + if not flag: self.show_small_icons_in_index_flag = False else: @@ -27731,6 +28672,9 @@ def set_show_status_icon_flag(self, flag): Shows/hides the status icon in the system tray. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28677 set_show_status_icon_flag') + if not flag: self.show_status_icon_flag = False if self.status_icon_obj: @@ -27744,6 +28688,9 @@ def set_show_status_icon_flag(self, flag): def set_show_tooltips_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28693 set_show_tooltips_flag') + if not flag: self.show_tooltips_flag = False # (The True argument forces the Video Catalogue to be redrawn) @@ -27963,6 +28910,9 @@ def set_toolbar_hide_flag(self, flag): def set_toolbar_squeeze_flag(self, flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 28915 set_toolbar_squeeze_flag') + if not flag: self.toolbar_squeeze_flag = False else: @@ -28055,6 +29005,9 @@ def set_video_res_default(self, value): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('app 29010 set_video_res_default') + if not value in formats.VIDEO_RESOLUTION_DICT: return self.system_error( 195, @@ -28103,6 +29056,9 @@ def set_video_timestamps_replace_flag(self, flag): def set_ytdl_fork(self, value): + if DEBUG_FUNC_FLAG: + utils.debug_time('app 29061 set_ytdl_fork') + self.ytdl_fork = value # Update main window menu items diff --git a/tartube/mainwin.py b/tartube/mainwin.py index e2d4d0c..8f287b1 100644 --- a/tartube/mainwin.py +++ b/tartube/mainwin.py @@ -61,6 +61,10 @@ from gi.repository import Notify +# Debugging flag (calls utils.debug_time at the start of every function) +DEBUG_FUNC_FLAG = True + + # Classes class MainWin(Gtk.ApplicationWindow): @@ -92,6 +96,9 @@ class MainWin(Gtk.ApplicationWindow): def __init__(self, app_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 100 __init__') + super(MainWin, self).__init__( title=__main__.__packagename__.title(), application=app_obj @@ -931,6 +938,9 @@ def setup_pixbufs(self): by formats.py. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 942 setup_pixbufs') + # The default location for icons is ../icons # When installed via PyPI, the icons are moved to ../tartube/icons # When installed via a Debian/RPM package, the icons are moved to @@ -1094,6 +1104,9 @@ def setup_composite_pixbufs(self, icon_dir_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 1108 setup_composite_pixbufs') + for base in formats.LARGE_ICON_COMPOSITE_LIST: # Produce an image whose name (in self.icon_dict) is in the form @@ -1190,6 +1203,9 @@ def apply_pixbuf_overlay(self, icon_dir_path, base_pixbuf, name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 1207 apply_pixbuf_overlay') + overlay_pixbuf = GdkPixbuf.Pixbuf.new_from_file( os.path.abspath( os.path.join( @@ -1233,6 +1249,9 @@ def setup_bg_colour(self, bg_name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 1253 setup_bg_colour') + if bg_name in self.app_obj.custom_bg_table: mini_list = self.app_obj.custom_bg_table[bg_name] @@ -1276,6 +1295,9 @@ def setup_win(self): widgets. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 1299 setup_win') + # Set the default window size self.set_default_size( self.app_obj.main_win_width, @@ -1329,6 +1351,9 @@ def setup_grid(self): Sets up a Gtk.Grid on which all the main window's widgets are placed. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 1355 setup_grid') + self.grid = Gtk.Grid() self.add(self.grid) @@ -1340,6 +1365,9 @@ def setup_main_menubar(self): Sets up a Gtk.Menu at the top of the main window. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 1369 setup_main_menubar') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window menu starts here' ) @@ -1872,6 +1900,9 @@ def setup_main_toolbar(self): replacing the previous one, if it exists. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 1904 setup_main_toolbar') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window toolbar starts here' ) @@ -2168,6 +2199,9 @@ def setup_notebook(self): toolbar. Creates two tabs, the Videos tab and the Progress tab. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 2203 setup_notebook') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window tabs are defined here' ) @@ -2237,6 +2271,9 @@ def setup_videos_tab(self): Creates widgets for the Videos tab. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 2275 setup_videos_tab') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Videos tab' ) @@ -2905,6 +2942,9 @@ def setup_progress_tab(self): Creates widgets for the Progress tab. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 2946 setup_progress_tab') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Progress tab' ) @@ -3256,6 +3296,9 @@ def setup_classic_mode_tab(self): Creates widgets for the Classic Mode tab. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 3300 setup_classic_mode_tab') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Classic Mode tab' ) @@ -3993,6 +4036,9 @@ def setup_drag_drop_tab(self): Creates widgets for the Drag and Drop tab. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4040 setup_drag_drop_tab') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Drag and Drop tab' ) @@ -4098,6 +4144,9 @@ def setup_output_tab(self): Creates widgets for the Output tab. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4148 setup_output_tab') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Output tab' ) @@ -4165,6 +4214,9 @@ def setup_errors_tab(self): Creates widgets for the Errors/Warnings tab. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4218 setup_errors_tab') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Errors / Warnings tab' ) @@ -4433,6 +4485,9 @@ def desensitise_test_widgets(self): videos), so this function is called to just disable both widgets. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4489 desensitise_test_widgets') + if self.test_menu_item: self.test_menu_item.set_sensitive(False) if self.test_toolbutton: @@ -4447,6 +4502,9 @@ def disable_dl_all_buttons(self): Disables (desensitises) the 'Download all' buttons and menu items. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4506 disable_dl_all_buttons') + # This setting doesn't apply during an operation. The calling code # should have checked that mainapp.TartubeApp.disable_dl_all_flag is # True @@ -4476,6 +4534,9 @@ def disable_tooltips(self, update_catalogue_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4538 disable_tooltips') + # Update the Video Index. Using a dummy column makes the tooltips # invisible self.video_index_treeview.set_tooltip_column(-1) @@ -4504,6 +4565,9 @@ def enable_dl_all_buttons(self): Enables (sensitises) the 'Download all' buttons and menu items. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4569 enable_dl_all_buttons') + # This setting doesn't apply during an operation. The calling code # should have checked that mainapp.TartubeApp.disable_dl_all_flag is # False @@ -4532,6 +4596,9 @@ def enable_tooltips(self, update_catalogue_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4600 enable_tooltips') + # Update the Video Index self.video_index_treeview.set_tooltip_column( self.video_index_tooltip_column, @@ -4571,6 +4638,9 @@ def force_invisible(self): or the user will be in big trouble. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4642 force_invisible') + self.set_visible(False) @@ -4591,6 +4661,9 @@ def hide_progress_bar(self, skip_check_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4665 hide_progress_bar') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Videos tab' ) @@ -4716,6 +4789,9 @@ def notify_desktop(self, title=None, msg=None, icon_path=None, url=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4793 notify_desktop') + # Desktop notifications don't work on MS Windows/MacOS if mainapp.HAVE_NOTIFY_FLAG: @@ -4771,6 +4847,9 @@ def redraw_main_toolbar(self): value of the flag. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4851 redraw_main_toolbar') + if self.app_obj.toolbar_hide_flag: # Toolbar is not visible return @@ -4794,6 +4873,9 @@ def reset_sliders(self): Resets paned sliders in various tabs to their default positions. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4877 reset_sliders') + self.videos_paned.set_position( self.app_obj.paned_default_size, ) @@ -4821,6 +4903,9 @@ def resize_self(self, width, height): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4907 resize_self') + if width < 100: width = 100 if height < 100: @@ -4854,6 +4939,9 @@ def sensitise_check_dl_buttons(self, finish_flag, operation_type=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 4943 sensitise_check_dl_buttons') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Videos tab' ) @@ -5035,6 +5123,9 @@ def sensitise_operation_widgets(self, sens_flag, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5127 sensitise_operation_widgets') + self.system_prefs_menu_item.set_sensitive(sens_flag) self.gen_options_menu_item.set_sensitive(sens_flag) self.reset_container_menu_item.set_sensitive(sens_flag) @@ -5150,6 +5241,9 @@ def sensitise_progress_bar(self, sens_flag): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5245 sensitise_progress_bar') + self.check_media_button.set_sensitive(sens_flag) self.classic_clear_button.set_sensitive(sens_flag) self.classic_clear_dl_button.set_sensitive(sens_flag) @@ -5192,6 +5286,9 @@ def sensitise_widgets_if_database(self, sens_flag): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5290 sensitise_widgets_if_database') + # Menu items self.change_db_menu_item.set_sensitive(sens_flag) self.save_db_menu_item.set_sensitive(sens_flag) @@ -5350,6 +5447,9 @@ def show_progress_bar(self, operation_type): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5451 show_progress_bar') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Videos tab' ) @@ -5470,6 +5570,9 @@ def switch_profile(self, profile_name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5574 switch_profile') + if not profile_name in self.app_obj.profile_dict: return self.app_obj.system_error( @@ -5504,6 +5607,9 @@ def toggle_alt_limits_image(self, on_flag): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5611 toggle_alt_limits_image') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Progress tab' ) @@ -5538,6 +5644,9 @@ def toggle_visibility(self): clicked the status icon in the system tray). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5648 toggle_visibility') + if self.is_visible(): # Record the window's position, so its position can be restored @@ -5565,6 +5674,9 @@ def update_catalogue_filter_widgets(self): required. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5678 update_catalogue_filter_widgets') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Videos tab' ) @@ -5660,6 +5772,9 @@ def update_catalogue_sort_widgets(self): required, set the combobox to its correct state. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5776 update_catalogue_sort_widgets') + mode = self.app_obj.catalogue_sort_mode if mode == 'default': self.catalogue_sort_combo.set_active(0) @@ -5680,6 +5795,9 @@ def update_catalogue_reverse_sort_widgets(self): required, set the reverse sort button to its correct state. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5799 update_catalogue_reverse_sort_widgets') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Videos tab' ) @@ -5730,6 +5848,9 @@ def update_catalogue_thumb_widgets(self): the combobox. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5852 update_catalogue_thumb_widgets') + # (IV is in groups of two, in the form [translation, actual value]) self.catalogue_thumb_combo.set_active( int( @@ -5749,6 +5870,9 @@ def update_classic_mode_tab_update_banner(self): according to current settings. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5874 update_classic_mode_tab_update_banner') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Classic Mode tab' ) @@ -5800,6 +5924,9 @@ def update_menu(self): for example, see the code in mainapp.TartubeApp.load_db(). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5928 update_menu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window menu' ) @@ -5849,6 +5976,9 @@ def update_window_after_show_hide(self): the current setting of mainapp.TartubeApp.toolbar_system_hide_flag. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 5980 update_window_after_show_hide') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window toolbar' ) @@ -5925,6 +6055,9 @@ def update_progress_bar(self, text, count, total): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 6059 update_progress_bar') + if not self.progress_bar: return self.app_obj.system_error( 206, @@ -5955,6 +6088,9 @@ def update_free_space_msg(self, disk_space=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 6092 update_free_space_msg') + ignore_me = _( 'TRANSLATOR\'S NOTE: Main window\'s Videos tab' ) @@ -6020,6 +6156,9 @@ def video_index_auto_sort(self, treestore, row_iter1, row_iter2, data): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 6160 video_index_auto_sort') + # If auto-sorting is disabled temporarily, we can prevent the list # being sorted by returning -1 for all cases if self.video_index_no_sort_flag: @@ -6107,6 +6246,9 @@ def video_catalogue_generic_auto_sort(self, row1, row2, data, notify): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 6250 video_catalogue_generic_auto_sort') + return self.app_obj.video_compare(row1.video_obj, row2.video_obj) @@ -6134,6 +6276,9 @@ def video_catalogue_grid_auto_sort(self, gridbox1, gridbox2): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 6280 video_catalogue_grid_auto_sort') + return self.app_obj.video_compare( gridbox1.video_obj, gridbox2.video_obj, @@ -6158,6 +6303,9 @@ def video_index_popup_menu(self, event, dbid): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 6307 video_index_popup_menu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Video Index popup menu starts here. In' \ + ' the Videos tab, right-click any channel/playlist/folder' @@ -6860,6 +7008,9 @@ def video_catalogue_popup_menu(self, event, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 7012 video_catalogue_popup_menu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Video Catalogue popup menu starts here. In' \ + ' the Videos tab, right-click any video' @@ -7721,6 +7872,9 @@ def video_catalogue_multi_popup_menu(self, event, video_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 7876 video_catalogue_multi_popup_menu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Video Catalogue popup menu starts here. In' \ + ' the Videos tab, select two or more videos, then righ-click' \ @@ -8225,6 +8379,9 @@ def progress_list_popup_menu(self, event, item_id, dbid): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 8383 progress_list_popup_menu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Progress List popup menu starts here. In' \ + ' the Progress tab, in the list in the top half of the tab,' \ @@ -8445,6 +8602,9 @@ def results_list_popup_menu(self, event, path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 8606 results_list_popup_menu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Results List popup menu starts here. In' \ + ' the Progress tab, in the list in the bottom half of the tab,' \ @@ -8658,6 +8818,9 @@ def classic_popup_menu(self): shows a context-sensitive popup menu. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 8822 classic_popup_menu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Classic Mode popup menu starts here. In' \ + ' the Classic Mode tab, click the button in the top-right' \ @@ -8811,6 +8974,9 @@ def classic_progress_list_popup_menu(self, event, path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 8978 classic_progress_list_popup_menu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Classic Progress List popup menu starts' \ + ' here. In the Classic Mode tab, in the list in the bottom' \ @@ -9049,6 +9215,9 @@ def add_watch_video_menu_items(self, popup_menu, not_dl_flag, source_flag, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 9219 add_watch_video_menu_items') + ignore_me = _( 'TRANSLATOR\'S NOTE: Extra items for the popup menu in the' \ + ' Video Catalogue. In the videos tab, right-click any video' @@ -9191,6 +9360,9 @@ def custom_dl_popup_menu(self, media_data_list=[]): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 9364 custom_dl_popup_menu') + # Set up the popup menu popup_menu = self.custom_dl_popup_submenu(media_data_list) @@ -9226,6 +9398,9 @@ def custom_dl_popup_submenu(self, media_data_list=[]): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 9402 custom_dl_popup_submenu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Popup menu for the \'Custom download all\'' \ + ' button in the Videos tab (not always visible)' @@ -9311,6 +9486,9 @@ def delete_profile_popup_submenu(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 9490 delete_profile_popup_submenu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Extra items for the main window menu,' \ + ' can be found in Media > Profiles > Delete profile > ...' @@ -9360,6 +9538,9 @@ def switch_profile_popup_submenu(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 9542 switch_profile_popup_submenu') + # Set up the popup menu popup_menu = Gtk.Menu() @@ -9411,6 +9592,9 @@ def video_index_setup_contents_submenu(self, submenu, media_data_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 9596 video_index_setup_contents_submenu') + ignore_me = _( 'TRANSLATOR\'S NOTE: Extra items for the Video Index popup menu.' \ + ' In the Videos tab, right-click any channel/playlist/folder' @@ -9590,6 +9774,9 @@ def video_index_catalogue_reset(self, reselect_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 9778 video_index_catalogue_reset') + # Reset the Video Index and Video Catalogue self.video_index_reset() self.video_catalogue_reset() @@ -9612,6 +9799,9 @@ def video_index_reset(self): filled with new data. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 9803 video_index_reset') + # Reset IVs self.video_index_current_dbid = None if self.video_index_treeview: @@ -9793,6 +9983,9 @@ def video_index_populate(self): self.video_index_add_row(). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 9987 video_index_populate') + for dbid in self.app_obj.container_top_level_list: media_data_obj = self.app_obj.media_reg_dict[dbid] @@ -9831,6 +10024,9 @@ def video_index_setup_row(self, media_data_obj, parent_pointer=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10028 video_index_setup_row') + # Don't show a hidden folder, or any of its children if isinstance(media_data_obj, media.Folder) \ and media_data_obj.hidden_flag: @@ -9913,6 +10109,9 @@ def video_index_add_row(self, media_data_obj, no_select_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10113 video_index_add_row') + # Don't add a hidden folder, or any of its children if media_data_obj.is_hidden(): return @@ -10040,6 +10239,9 @@ def video_index_delete_row(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10243 video_index_delete_row') + # Videos can't be shown in the Video Index if isinstance(media_data_obj, media.Video): return self.app_obj.system_error( @@ -10094,6 +10296,9 @@ def video_index_select_row(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10300 video_index_select_row') + # Cannot select a hidden folder, or any of its children if isinstance(media_data_obj, media.Video) \ or media_data_obj.is_hidden(): @@ -10147,6 +10352,9 @@ def video_index_update_row_icon(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10356 video_index_update_row_icon') + # Videos can't be shown in the Video Index if isinstance(media_data_obj, media.Video): return self.app_obj.system_error( @@ -10199,6 +10407,9 @@ def video_index_update_row_text(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10411 video_index_update_row_text') + # Videos can't be shown in the Video Index if isinstance(media_data_obj, media.Video): return self.app_obj.system_error( @@ -10258,6 +10469,9 @@ def video_index_update_row_tooltip(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10473 video_index_update_row_tooltip') + # Videos can't be shown in the Video Index if isinstance(media_data_obj, media.Video): return self.app_obj.system_error( @@ -10320,6 +10534,9 @@ def video_index_get_icon(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10538 video_index_get_icon') + icon = None if not self.app_obj.show_small_icons_in_index_flag: @@ -10400,6 +10617,9 @@ def video_index_get_text(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10621 video_index_get_text') + text = utils.shorten_string( media_data_obj.nickname, self.short_string_max_len, @@ -10470,6 +10690,9 @@ def video_index_get_text_properties(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10694 video_index_get_text_properties') + style = Pango.Style.NORMAL weight = Pango.Weight.NORMAL underline = Pango.Underline.NONE @@ -10523,6 +10746,9 @@ def video_index_set_marker(self, dbid=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10750 video_index_set_marker') + old_size = len(self.video_index_marker_dict) container_list = [] @@ -10578,6 +10804,9 @@ def video_index_reset_marker(self, dbid=None): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10808 video_index_reset_marker') + old_size = len(self.video_index_marker_dict) if dbid is None: @@ -10636,6 +10865,9 @@ def video_catalogue_reset(self): with new data. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10869 video_catalogue_reset') + # If not called by self.setup_videos_tab()... if self.catalogue_frame.get_child(): self.catalogue_frame.remove(self.catalogue_frame.get_child()) @@ -10757,6 +10989,9 @@ def video_catalogue_redraw_all(self, dbid, page_num=1, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 10993 video_catalogue_redraw_all') + # If actually switching to a different channel/playlist/folder, or a # different page on the same channel/playlist/folder, must reset the # scrollbars later in the function @@ -10937,6 +11172,9 @@ def video_catalogue_update_video(self, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11176 video_catalogue_update_video') + app_obj = self.app_obj # Is the video's parent channel, playlist or folder the one that is @@ -11144,6 +11382,9 @@ def video_catalogue_insert_video(self, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11386 video_catalogue_insert_video') + # Create the new catalogue item if self.app_obj.catalogue_mode_type == 'simple': catalogue_item_obj = SimpleCatalogueItem(self, video_obj) @@ -11217,6 +11458,9 @@ def video_catalogue_retry_insert_items(self): (Not called when videos are arranged on a grid.) """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11462 video_catalogue_retry_insert_items') + if self.video_catalogue_temp_list: while self.video_catalogue_temp_list: @@ -11256,6 +11500,9 @@ def video_catalogue_delete_video(self, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11504 video_catalogue_delete_video') + # Is the video's parent channel, playlist or folder the one that is # currently selected in the Video Index? If not, the video is not # displayed in the Video Catalogue @@ -11406,6 +11653,9 @@ def video_catalogue_unselect_all(self): mainwin.GridCatalogueItem objects). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11657 video_catalogue_unselect_all') + if self.app_obj.catalogue_mode_type != 'grid': self.catalogue_listbox.unselect_all() @@ -11427,6 +11677,9 @@ def video_catalogue_force_resort(self): are resorted, then the Video Catalogue is redrawn. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11681 video_catalogue_force_resort') + if self.video_index_current_dbid is None: return @@ -11473,6 +11726,11 @@ def video_catalogue_grid_set_gridbox_width(self, width): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 11731 video_catalogue_grid_set_gridbox_width', + ) + # Sanity check: Once the minimum gridbox width for each thumbnail size # has been established, don't change it thumb_size = self.app_obj.thumb_size_custom @@ -11517,6 +11775,9 @@ def video_catalogue_grid_check_size(self): if necessary. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11779 video_catalogue_grid_check_size') + # When working out the grid's actual width, take into account small # gaps between each gridbox, and around the borders of other widgets thumb_size = self.app_obj.thumb_size_custom @@ -11584,6 +11845,9 @@ def video_catalogue_grid_check_expand(self): enabling or disabling its horizontal expansion flag). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11849 video_catalogue_grid_check_expand') + thumb_size = self.app_obj.thumb_size_custom # (Gridboxes never expand to fill the available space, if the minimum @@ -11633,6 +11897,9 @@ def video_catalogue_grid_attach_gridbox(self, wrapper_obj, x_pos, y_pos): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11901 video_catalogue_grid_attach_gridbox') + self.catalogue_grid.attach( wrapper_obj, x_pos, @@ -11663,6 +11930,9 @@ def video_catalogue_grid_rearrange(self): filling any gaps (if a gridboxes have been removed from the grid). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11934 video_catalogue_grid_rearrange') + # Each mainwin.CatalogueGridBox acts as a wrapper for a Gtk.Frame wrapper_list = [] @@ -11713,6 +11983,9 @@ def video_catalogue_grid_reset_sizes(self): so they can be calculated afresh the next time they are needed. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 11987 video_catalogue_grid_reset_sizes') + self.catalogue_grid_width_dict = {} for key in self.app_obj.thumb_size_dict: @@ -11747,6 +12020,9 @@ def video_catalogue_grid_select(self, catalogue_obj, select_type, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12024 video_catalogue_grid_select') + # (Sorting function for the code immediately below) def sort_by_grid_posn(obj1, obj2): @@ -11875,6 +12151,9 @@ def video_catalogue_grid_select_all(self): When the user presses CTRL+A, select all gridboxes in the grid. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12155 video_catalogue_grid_select_all') + for catalogue_item_obj in self.video_catalogue_dict.values(): catalogue_item_obj.do_select(True) @@ -11902,6 +12181,9 @@ def video_catalogue_grid_scroll_on_select(self, gridbox_obj, keyval, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12185 video_catalogue_grid_scroll_on_select') + # Get the GridCatalogueItem of the gridbox which intercepted the # keypress if not gridbox_obj.video_obj.dbid in self.video_catalogue_dict: @@ -12075,6 +12357,9 @@ def video_catalogue_toolbar_reset(self): or in case drawing the page takes a long time). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12361 video_catalogue_toolbar_reset') + self.catalogue_toolbar_current_page = 1 self.catalogue_toolbar_last_page = 1 @@ -12130,6 +12415,9 @@ def video_catalogue_toolbar_update(self, page_num, video_count): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12419 video_catalogue_toolbar_update') + self.catalogue_toolbar_current_page = page_num # If the page size is 0, then all videos are drawn on one page @@ -12229,6 +12517,9 @@ def video_catalogue_apply_filter(self): .catalogue_draw_undownloaded_flag and .catalogue_draw_blocked_flag. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12521 video_catalogue_apply_filter') + # Sanity check - something must be selected in the Video Index parent_obj = None if self.video_index_current_dbid is not None: @@ -12329,6 +12620,9 @@ def video_catalogue_cancel_filter(self): Catalogue. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12624 video_catalogue_cancel_filter') + # Reset IVs... self.video_catalogue_filtered_flag = False self.video_catalogue_filtered_list = [] @@ -12361,6 +12655,9 @@ def video_catalogue_show_date(self, page_num): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12659 video_catalogue_show_date') + # Sanity check - something must be selected in the Video Index parent_obj = None if self.video_index_current_dbid is not None: @@ -12398,6 +12695,9 @@ def video_catalogue_unshow_date(self): (De)sensitise widgets, as appropriate. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12699 video_catalogue_unshow_date') + # Sanity check - something must be selected in the Video Index parent_obj = None if self.video_index_current_dbid is not None: @@ -12437,6 +12737,9 @@ def progress_list_reset(self): Also resets related IVs. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12741 progress_list_reset') + # Reset widgets self.progress_list_liststore = Gtk.ListStore( int, int, str, @@ -12476,6 +12779,9 @@ def progress_list_init(self, download_list_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12783 progress_list_init') + # For each download item object, add a row to the treeview, and store # the download item's .dbid IV so that # self.progress_list_receive_dl_stats() can update the correct row @@ -12506,6 +12812,9 @@ def progress_list_add_row(self, item_id, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12816 progress_list_add_row') + # Prepare the icon if isinstance(media_data_obj, media.Channel): pixbuf = self.pixbuf_dict['channel_small'] @@ -12592,6 +12901,9 @@ def progress_list_receive_dl_stats(self, download_item_obj, dl_stat_dict, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12905 progress_list_receive_dl_stats') + # Check that the Progress List actually has a row for the specified # downloads.DownloadItem object if not download_item_obj.item_id in self.progress_list_row_dict: @@ -12642,6 +12954,9 @@ def progress_list_display_dl_stats(self): function to display them. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 12958 progress_list_display_dl_stats') + # Import some objects from downloads.py (for convenience) dl_obj = self.app_obj.download_manager_obj # Import the contents of the IV (in case it gets updated during the @@ -12835,6 +13150,9 @@ def progress_list_check_hide_rows(self, force_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13154 progress_list_check_hide_rows') + current_time = time.time() hide_list = [] @@ -12863,6 +13181,9 @@ def progress_list_do_hide_row(self, item_id): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13185 progress_list_do_hide_row') + row_num = self.progress_list_row_dict[item_id] # Remove the row. Very rarely this generates a Python error (for @@ -12933,6 +13254,9 @@ def progress_list_update_video_name(self, download_item_obj, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13258 progress_list_update_video_name') + if download_item_obj.item_id in self.progress_list_row_dict \ and download_item_obj.media_data_obj == video_obj: @@ -12961,6 +13285,9 @@ def progress_list_get_column_widths(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13289 progress_list_get_column_widths') + if self.progress_list_treeview is None: return None, None @@ -12993,6 +13320,9 @@ def progress_list_get_rolling_average(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13324 progress_list_get_rolling_average') + # Import some objects from downloads.py (for convenience) dl_list_obj = self.app_obj.download_manager_obj.download_list_obj @@ -13037,6 +13367,9 @@ def progress_list_reset_rolling_average(self): Also resets the Gtk.Label. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13371 progress_list_reset_rolling_average') + self.progress_list_average_speed_dict = {} self.progress_update_label.set_markup('') @@ -13052,6 +13385,9 @@ def results_list_reset(self): refilled. (There are no IVs to reset.) """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13389 results_list_reset') + # Reset widgets self.results_list_liststore = Gtk.ListStore( int, str, @@ -13103,6 +13439,9 @@ def results_list_add_row(self, download_item_obj, video_obj, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13443 results_list_add_row') + # Prepare the icons if video_obj.live_mode == 1: if not video_obj.live_debut_flag: @@ -13223,6 +13562,9 @@ def results_list_update_row(self): object. Then update the Video Catalogue and the Progress List. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13566 results_list_update_row') + new_temp_list = [] while self.results_list_temp_list: @@ -13398,6 +13740,9 @@ def results_list_update_row_on_delete(self, dbid): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13744 results_list_update_row_on_delete') + if dbid in self.results_list_row_dict: row_num = self.results_list_row_dict[dbid] @@ -13443,6 +13788,9 @@ def results_list_update_tooltip(self, video_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13792 results_list_update_tooltip') + if video_obj.dbid in self.results_list_row_dict: # Update the corresponding row in the Results List @@ -13480,6 +13828,9 @@ def results_list_get_column_widths(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13832 results_list_get_column_widths') + if self.results_list_treeview is None: return None, None @@ -13505,6 +13856,9 @@ def classic_mode_tab_add_dest_dir(self): in the Classic Mode tab. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13860 classic_mode_tab_add_dest_dir') + # Reset the contents of the combobox self.classic_dest_dir_liststore = Gtk.ListStore(str) for string in self.app_obj.classic_dir_list: @@ -13529,6 +13883,9 @@ def classic_mode_tab_add_row(self, dummy_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13887 classic_mode_tab_add_row') + # Prepare the new row in the treeview row_list = [] @@ -13578,6 +13935,9 @@ def classic_mode_tab_move_row(self, up_flag): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 13939 classic_mode_tab_move_row') + selection = self.classic_progress_treeview.get_selection() (model, path_list) = selection.get_selected_rows() if not path_list: @@ -13641,6 +14001,9 @@ def classic_mode_tab_remove_rows(self, dbid_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14005 classic_mode_tab_remove_rows') + # (Import IVs for convenience) manager_obj = self.app_obj.download_manager_obj @@ -13686,6 +14049,9 @@ def classic_mode_tab_add_urls(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14053 classic_mode_tab_add_urls') + # Get the specified download destination tree_iter = self.classic_dest_dir_combo.get_active_iter() model = self.classic_dest_dir_combo.get_model() @@ -13847,6 +14213,9 @@ def classic_mode_tab_insert_url(self, url, options_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14217 classic_mode_tab_insert_url') + # Sanity check if url is None \ or not utils.check_url(url) \ @@ -13888,6 +14257,9 @@ def classic_mode_tab_update_textbuffer(self, text): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14261 classic_mode_tab_update_textbuffer') + # (Prevent an infinite loop by using this flag) self.classic_auto_copy_check_flag = True self.classic_textbuffer.set_text(text) @@ -13934,6 +14306,9 @@ def classic_mode_tab_create_dummy_video(self, url, dest_dir, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14310 classic_mode_tab_create_dummy_video') + self.classic_media_total += 1 new_obj = media.Video( @@ -13985,6 +14360,9 @@ def classic_mode_tab_extract_pending_urls(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14364 classic_mode_tab_extract_pending_urls') + # Extract a list of URLs from the textview url_string = self.classic_textbuffer.get_text( self.classic_textbuffer.get_iter_at_mark(self.classic_mark_start), @@ -14038,6 +14416,9 @@ def classic_mode_tab_restore_urls(self, url_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14420 classic_mode_tab_restore_urls') + self.classic_textbuffer.set_text('\n'.join(url_list)) @@ -14050,6 +14431,9 @@ def classic_mode_tab_find_row_iter(self, dbid): specified data for the dummy media.Video object. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14435 classic_mode_tab_find_row_iter') + for row in self.classic_progress_liststore: if self.classic_progress_liststore[row.iter][0] == dbid: return row.iter @@ -14081,6 +14465,9 @@ def classic_mode_tab_receive_dl_stats(self, download_item_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14469 classic_mode_tab_receive_dl_stats') + # Temporarily store the dictionary of download statistics if not download_item_obj.item_id in self.classic_temp_dict: new_dl_stat_dict = {} @@ -14104,6 +14491,9 @@ def classic_mode_tab_display_dl_stats(self): a download operation launched from the Classic Mode tab. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14495 classic_mode_tab_display_dl_stats') + # Import the contents of the IV (in case it gets updated during the # call to this function), and use the imported copy temp_dict = self.classic_temp_dict @@ -14227,6 +14617,9 @@ def classic_mode_tab_timer_callback(self): the Classic Progress List. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14621 classic_mode_tab_timer_callback') + # If the user manually empties the textview, don't re-paste whatever # is currently in the clipboard clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) @@ -14264,6 +14657,9 @@ def classic_mode_tab_start_download(self): List. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14661 classic_mode_tab_start_download') + if self.app_obj.download_manager_obj: # Download already in progress @@ -14314,6 +14710,9 @@ def classic_mode_tab_get_column_widths(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14714 classic_mode_tab_get_column_widths') + if self.classic_progress_treeview is None: return None, None @@ -14344,6 +14743,9 @@ def drag_drop_grid_empty(self): already exists). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14747 drag_drop_grid_empty') + # If not called by self.setup_videos_tab()... if self.drag_drop_frame.get_child(): self.drag_drop_frame.remove(self.drag_drop_frame.get_child()) @@ -14373,6 +14775,9 @@ def drag_drop_grid_reset(self): for everything else, we just call this function to reset the grid. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14779 drag_drop_grid_reset') + # If not called by self.setup_videos_tab()... if self.drag_drop_frame.get_child(): self.drag_drop_frame.remove(self.drag_drop_frame.get_child()) @@ -14478,6 +14883,9 @@ def drag_drop_add_dropzone(self): Adds a new dropzone to the Drag and Drop tab's grid to accommodate it. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14887 drag_drop_add_dropzone') + if len(self.drag_drop_dict) >= self.drag_drop_max: return self.app_obj.system_error( 225, @@ -14545,6 +14953,9 @@ def output_tab_setup_pages(self): mainapp.TartubeApp.num_worker_default). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 14957 output_tab_setup_pages') + # The first page in the Output tab's notebook shows a summary of what # the threads created by downloads.py are doing if not self.output_tab_summary_flag \ @@ -14591,6 +15002,9 @@ def output_tab_add_page(self, summary_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15006 output_tab_add_page') + # Each page (except the summary page) corresponds to a single # downloads.DownloadWorker object. The page number matches the # worker's .worker_id. The first worker is numbered #1 @@ -14703,6 +15117,9 @@ def output_tab_set_textview_css(self, css_string): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15121 output_tab_set_textview_css') + style_provider = Gtk.CssProvider() style_provider.load_from_data(bytes(css_string.encode())) Gtk.StyleContext.add_provider_for_screen( @@ -14733,6 +15150,9 @@ def output_tab_write_stdout(self, page_num, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15154 output_tab_write_stdout') + GObject.timeout_add( 0, self.output_tab_write, @@ -14760,6 +15180,9 @@ def output_tab_write_stderr(self, page_num, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15184 output_tab_write_stderr') + GObject.timeout_add( 0, self.output_tab_write, @@ -14787,6 +15210,9 @@ def output_tab_write_system_cmd(self, page_num, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15214 output_tab_write_system_cmd') + GObject.timeout_add( 0, self.output_tab_write, @@ -14818,6 +15244,9 @@ def output_tab_write(self, page_num, msg, msg_type): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15248 output_tab_write') + # Add the text to the textview. STDERR messages and system commands are # displayed in a different colour # (Note that the summary page is not necessarily visible) @@ -14883,6 +15312,9 @@ def output_tab_update_page_size(self): textview, and remove the oldest remaining lines, if necessary. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15316 output_tab_update_page_size') + if self.app_obj.output_size_apply_flag: for page_num in self.output_textview_dict: @@ -14919,6 +15351,9 @@ def output_tab_do_autoscroll(self, textview, rect, scrolled): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15355 output_tab_do_autoscroll') + adj = scrolled.get_vadjustment() adj.set_value(adj.get_upper() - adj.get_page_size()) @@ -14938,6 +15373,9 @@ def output_tab_scroll_visible_page(self, page_num): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15377 output_tab_scroll_visible_page') + if page_num in self.output_textview_dict: textview = self.output_textview_dict[page_num] @@ -14959,6 +15397,9 @@ def output_tab_show_first_page(self): tab, if it's open). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15401 output_tab_show_first_page') + self.notebook.set_current_page(self.notebook_tab_dict['output']) if not self.output_tab_summary_flag: self.output_notebook.set_current_page(0) @@ -14976,6 +15417,9 @@ def output_tab_reset_pages(self): allowed). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15421 output_tab_reset_pages') + for textview in self.output_textview_dict.values(): textbuffer = textview.get_buffer() textbuffer.set_text('') @@ -14994,6 +15438,9 @@ def errors_list_reset(self): making error/warning messages visible or not, depending on settings. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15442 errors_list_reset') + ignore_me = _( 'TRANSLATOR\'S NOTE: Extra items for the Errors/Warnings tab' ) @@ -15126,6 +15573,9 @@ def errors_list_add_operation_msg(self, media_data_obj, last_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15577 errors_list_add_operation_msg') + if last_flag and media_data_obj.error_list: error_list = [ media_data_obj.error_list[-1] ] else: @@ -15202,6 +15652,9 @@ def errors_list_prepare_operation_row(self, media_data_obj, msg_type, msg, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15656 errors_list_prepare_operation_row') + # Prepare the mini-dictionary to be added to the IV mini_dict = {} @@ -15294,6 +15747,9 @@ def errors_list_add_system_msg(self, error_type, error_code, msg): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15751 errors_list_add_system_msg') + # Create a new row for every error and warning message # Use the same time on each time_str = datetime.datetime.today().strftime('%x %X') @@ -15370,6 +15826,9 @@ def errors_list_insert_row(self, mini_dict): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15830 errors_list_insert_row') + # Emergency fallback - if the error is generated before the # Errors/Warnings tab has been set up, do nothing (this will avoid # an infinite cycle of raised exceptions) @@ -15528,6 +15987,9 @@ def errors_list_refresh_label(self, reset_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 15991 errors_list_refresh_label') + error_count = 0 warning_count = 0 @@ -15564,6 +16026,9 @@ def errors_list_apply_filter(self): Applies the filter. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16030 errors_list_apply_filter') + # Set IVs once, so that multiple calls to self.errors_list_insert_row() # can use them self.error_list_filter_flag = True @@ -15592,6 +16057,9 @@ def errors_list_cancel_filter(self): Applies the filter. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16061 errors_list_cancel_filter') + # Reset IVs... self.error_list_filter_flag = False self.error_list_filter_text = None @@ -15626,6 +16094,9 @@ def on_video_index_add_classic(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16098 on_video_index_add_classic') + if isinstance(media_data_obj, media.Folder) \ or not media_data_obj.source: return self.app_obj.system_error( @@ -15657,6 +16128,9 @@ def on_video_index_add_to_scheduled(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16132 on_video_index_add_to_scheduled') + ignore_me = _( 'TRANSLATOR\'S NOTE: Dialogue window, generated by a popup menu.' \ + ' In the Videos tab, right-click a channel and select' \ @@ -15724,6 +16198,9 @@ def on_video_index_apply_options(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16202 on_video_index_apply_options') + if self.app_obj.current_manager_obj \ or media_data_obj.options_obj\ or ( @@ -15809,6 +16286,9 @@ def on_video_index_check(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16290 on_video_index_check') + download_manager_obj = self.app_obj.download_manager_obj if ( @@ -15879,6 +16359,9 @@ def on_video_index_convert_container(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16363 on_video_index_convert_container') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 229, @@ -15903,6 +16386,9 @@ def on_video_index_custom_dl(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16390 on_video_index_custom_dl') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 230, @@ -15945,6 +16431,9 @@ def on_video_index_delete_container(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16435 on_video_index_delete_container') + self.app_obj.delete_container(media_data_obj) @@ -15964,6 +16453,9 @@ def on_video_index_dl_no_db(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16457 on_video_index_dl_no_db') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 231, @@ -16002,6 +16494,9 @@ def on_video_index_dl_disable(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16498 on_video_index_dl_disable') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 232, @@ -16041,6 +16536,9 @@ def on_video_index_dl_sim(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16540 on_video_index_dl_sim') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 233, @@ -16079,6 +16577,9 @@ def on_video_index_download(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16581 on_video_index_download') + download_manager_obj = self.app_obj.download_manager_obj if __main__.__pkg_no_download_flag__ \ @@ -16159,6 +16660,9 @@ def on_video_index_drag_data_received(self, treeview, drag_context, x, y, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16664 on_video_index_drag_data_received') + # Must override the usual Gtk handler treeview.stop_emission('drag_data_received') # Import the treeview's sorted model (for convenience) @@ -16248,6 +16752,9 @@ def on_video_index_drag_drop(self, treeview, drag_context, x, y, time): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16756 on_video_index_drag_drop') + # Must override the usual Gtk handler treeview.stop_emission('drag_drop') @@ -16273,6 +16780,9 @@ def on_video_index_edit_options(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16784 on_video_index_edit_options') + if self.app_obj.current_manager_obj or not media_data_obj.options_obj: return self.app_obj.system_error( 235, @@ -16300,6 +16810,9 @@ def on_video_index_empty_folder(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16814 on_video_index_empty_folder') + # The True flag tells the function to empty the container, rather than # delete it self.app_obj.delete_container(media_data_obj, True) @@ -16321,6 +16834,9 @@ def on_video_index_export(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16838 on_video_index_export') + self.app_obj.export_from_db( [media_data_obj] ) @@ -16339,6 +16855,9 @@ def on_video_index_hide_folder(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16859 on_video_index_hide_folder') + self.app_obj.mark_folder_hidden(media_data_obj, True) @@ -16360,6 +16879,9 @@ def on_video_index_insert_videos(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16883 on_video_index_insert_videos') + # (Code adapated from mainapp.TartubeApp.on_menu_add_video() ) dialogue_win = InsertVideoDialogue(self, media_data_obj) @@ -16439,6 +16961,9 @@ def on_video_index_mark_archived(self, menu_item, media_data_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16965 on_video_index_mark_archived') + self.app_obj.mark_container_archived( media_data_obj, True, @@ -16467,6 +16992,9 @@ def on_video_index_mark_not_archived(self, menu_item, media_data_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 16996 on_video_index_mark_not_archived') + self.app_obj.mark_container_archived( media_data_obj, False, @@ -16490,6 +17018,9 @@ def on_video_index_mark_bookmark(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17022 on_video_index_mark_bookmark') + # In earlier versions of Tartube, this action could take a very long # time (perhaps hours) count = len(media_data_obj.child_list) @@ -16540,6 +17071,9 @@ def on_video_index_mark_not_bookmark(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17075 on_video_index_mark_not_bookmark') + # In earlier versions of Tartube, this action could take a very long # time (perhaps hours) count = len(media_data_obj.child_list) @@ -16595,6 +17129,9 @@ def on_video_index_mark_favourite(self, menu_item, media_data_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17133 on_video_index_mark_favourite') + self.app_obj.mark_container_favourite( media_data_obj, True, @@ -16623,6 +17160,9 @@ def on_video_index_mark_not_favourite(self, menu_item, media_data_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17164 on_video_index_mark_not_favourite') + self.app_obj.mark_container_favourite( media_data_obj, False, @@ -16645,6 +17185,9 @@ def on_video_index_mark_missing(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17189 on_video_index_mark_missing') + if isinstance(media_data_obj, media.Video) \ or isinstance(media_data_obj, media.Folder): return self.app_obj.system_error( @@ -16672,6 +17215,9 @@ def on_video_index_mark_not_missing(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17219 on_video_index_mark_not_missing') + if isinstance(media_data_obj, media.Video) \ or ( isinstance(media_data_obj, media.Folder) \ @@ -16707,6 +17253,9 @@ def on_video_index_mark_new(self, menu_item, media_data_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17257 on_video_index_mark_new') + self.app_obj.mark_container_new( media_data_obj, True, @@ -16735,6 +17284,9 @@ def on_video_index_mark_not_new(self, menu_item, media_data_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17288 on_video_index_mark_not_new') + self.app_obj.mark_container_new( media_data_obj, False, @@ -16758,6 +17310,9 @@ def on_video_index_mark_waiting(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17314 on_video_index_mark_waiting') + # In earlier versions of Tartube, this action could take a very long # time (perhaps hours) count = len(media_data_obj.child_list) @@ -16808,6 +17363,9 @@ def on_video_index_mark_not_waiting(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17367 on_video_index_mark_not_waiting') + # In earlier versions of Tartube, this action could take a very long # time (perhaps hours) count = len(media_data_obj.child_list) @@ -16858,6 +17416,9 @@ def on_video_index_move_to_top(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17420 on_video_index_move_to_top') + self.app_obj.move_container_to_top(media_data_obj) @@ -16876,6 +17437,9 @@ def on_video_index_recent_videos_time(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17441 on_video_index_recent_videos_time') + # Show the dialogue window dialogue_win = RecentVideosDialogue(self, media_data_obj) dialogue_win.run() @@ -16907,6 +17471,9 @@ def on_video_index_refresh(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17475 on_video_index_refresh') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 238, @@ -16933,6 +17500,9 @@ def on_video_index_remove_options(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17504 on_video_index_remove_options') + if self.app_obj.current_manager_obj \ or not media_data_obj.options_obj: return self.app_obj.system_error( @@ -16959,6 +17529,9 @@ def on_video_index_remove_videos(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17533 on_video_index_remove_videos') + for child_obj in media_data_obj.child_list: if isinstance(child_obj, media.Video): self.app_obj.delete_video(child_obj) @@ -16980,6 +17553,9 @@ def on_video_index_rename_location(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17557 on_video_index_rename_location') + self.app_obj.rename_container(media_data_obj) @@ -16998,6 +17574,9 @@ def on_video_index_right_click(self, treeview, event): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17578 on_video_index_right_click') + if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3: # If the user right-clicked on empty space, the call to @@ -17039,6 +17618,9 @@ def on_video_index_selection_changed(self, selection): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17622 on_video_index_selection_changed') + (model, tree_iter) = selection.get_selected() if tree_iter is not None: if not model.iter_is_valid(tree_iter): @@ -17099,6 +17681,9 @@ def on_video_index_marker(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17685 on_video_index_marker') + # (Using self.video_index_treestore) tree_ref = self.video_index_row_dict[media_data_obj.dbid] tree_path = tree_ref.get_path() @@ -17139,6 +17724,9 @@ def on_video_index_marker_toggled(self, renderer_toggle, sorted_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17728 on_video_index_marker_toggled') + # (Using self.video_index_sortmodel) sorted_iter = self.video_index_sortmodel.get_iter(sorted_path) dbid = self.video_index_sortmodel[sorted_iter][0] @@ -17202,6 +17790,9 @@ def on_video_index_set_destination(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17794 on_video_index_set_destination') + ignore_me = _( 'TRANSLATOR\'S NOTE: Dialogue window, generated by a popup menu.' \ + ' In the Videos tab, right-click a channel and select' \ @@ -17291,6 +17882,9 @@ def on_video_index_set_nickname(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17886 on_video_index_set_nickname') + if isinstance(media_data_obj, media.Video): return self.app_obj.system_error( 241, @@ -17333,6 +17927,9 @@ def on_video_index_set_url(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17931 on_video_index_set_url') + if isinstance(media_data_obj, media.Video): return self.app_obj.system_error( 242, @@ -17387,6 +17984,9 @@ def on_video_index_show_destination(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 17988 on_video_index_show_destination') + if media_data_obj.external_dir is not None: other_obj = media_data_obj else: @@ -17414,6 +18014,9 @@ def on_video_index_show_location(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18018 on_video_index_show_location') + path = media_data_obj.get_default_dir(self.app_obj) utils.open_file(self.app_obj, path) @@ -17433,6 +18036,9 @@ def on_video_index_show_properties(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18040 on_video_index_show_properties') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 244, @@ -17461,6 +18067,9 @@ def on_video_index_show_system_cmd(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18071 on_video_index_show_system_cmd') + # Show the dialogue window dialogue_win = SystemCmdDialogue(self, media_data_obj) dialogue_win.run() @@ -17482,6 +18091,9 @@ def on_video_index_tidy(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18095 on_video_index_tidy') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 245, @@ -17578,6 +18190,9 @@ def on_video_catalogue_add_classic(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18194 on_video_catalogue_add_classic') + if media_data_obj.source: utils.add_links_to_textview( @@ -17603,6 +18218,9 @@ def on_video_catalogue_add_classic_multi(self, menu_item, media_data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18222 on_video_catalogue_add_classic_multi') + source_list = [] for media_data_obj in media_data_list: if media_data_obj.source: @@ -17634,6 +18252,9 @@ def on_video_catalogue_apply_options(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18256 on_video_catalogue_apply_options') + if self.app_obj.current_manager_obj or media_data_obj.options_obj: return self.app_obj.system_error( 246, @@ -17712,6 +18333,9 @@ def on_video_catalogue_check(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18337 on_video_catalogue_check') + download_manager_obj = self.app_obj.download_manager_obj if ( @@ -17774,6 +18398,9 @@ def on_video_catalogue_check_multi(self, menu_item, media_data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18402 on_video_catalogue_check_multi') + download_manager_obj = self.app_obj.download_manager_obj if ( @@ -17840,6 +18467,9 @@ def on_video_catalogue_custom_dl(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18471 on_video_catalogue_custom_dl') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 249, @@ -17881,6 +18511,9 @@ def on_video_catalogue_custom_dl_multi(self, menu_item, media_data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18515 on_video_catalogue_custom_dl_multi') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 250, @@ -17925,6 +18558,9 @@ def on_video_catalogue_delete_video(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18562 on_video_catalogue_delete_video') + if self.app_obj.show_delete_video_dialogue_flag: # Prompt the user for confirmation @@ -17978,6 +18614,9 @@ def on_video_catalogue_delete_video_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18618 on_video_catalogue_delete_video_multi') + if self.app_obj.show_delete_video_dialogue_flag: # Prompt the user for confirmation @@ -18036,6 +18675,9 @@ def on_video_catalogue_dl_and_watch(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18679 on_video_catalogue_dl_and_watch') + # Can't download the video if it has no source, or if an update/ # refresh/process operation has started since the popup menu was # created @@ -18068,6 +18710,9 @@ def on_video_catalogue_dl_and_watch_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18714 on_video_catalogue_dl_and_watch_multi') + # Only download videos which have a source URL mod_list = [] for media_data_obj in media_data_list: @@ -18107,6 +18752,9 @@ def on_video_catalogue_download(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18756 on_video_catalogue_download') + download_manager_obj = self.app_obj.download_manager_obj if ( @@ -18173,6 +18821,9 @@ def on_video_catalogue_download_multi(self, menu_item, media_data_list, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18825 on_video_catalogue_download_multi') + download_manager_obj = self.app_obj.download_manager_obj if ( @@ -18240,6 +18891,9 @@ def on_video_catalogue_edit_options(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18895 on_video_catalogue_edit_options') + if self.app_obj.current_manager_obj or not media_data_obj.options_obj: return self.app_obj.system_error( 253, @@ -18268,6 +18922,9 @@ def on_video_catalogue_enforce_check(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18926 on_video_catalogue_enforce_check') + # (Don't allow the user to change the setting of # media.Video.dl_sim_flag if the video is in a channel or playlist, # since media.Channel.dl_sim_flag or media.Playlist.dl_sim_flag @@ -18306,6 +18963,9 @@ def on_video_catalogue_fetch_formats(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18967 on_video_catalogue_fetch_formats') + # Can't start an info operation if any type of operation has started # since the popup menu was created if media_data_obj.source \ @@ -18333,6 +18993,9 @@ def on_video_catalogue_fetch_subs(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 18997 on_video_catalogue_fetch_subs') + # Can't start an info operation if any type of operation has started # since the popup menu was created if media_data_obj.source \ @@ -18362,6 +19025,11 @@ def on_video_catalogue_finalise_livestream(self, menu_item, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 19029 on_video_catalogue_finalise_livestream', + ) + expect_path = media_data_obj.get_actual_path(self.app_obj) part_path = expect_path + '.part' self.app_obj.move_file_or_directory(part_path, expect_path) @@ -18395,6 +19063,11 @@ def on_video_catalogue_finalise_livestream_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 19067 on_video_catalogue_finalise_livestream_multi', + ) + for media_data_obj in media_data_list: expect_path = media_data_obj.get_actual_path(self.app_obj) @@ -18434,6 +19107,9 @@ def on_video_catalogue_livestream_toggle(self, menu_item, media_data_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 19111 on_video_catalogue_livestream_toggle') + # Update the IV if action == 'notify': if not media_data_obj.dbid \ @@ -18489,6 +19165,9 @@ def on_video_catalogue_mark_temp_dl(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 19169 on_video_catalogue_mark_temp_dl') + # Can't mark the video for download if it has no source, or if an # update/refresh/tidy/process operation has started since the popup # menu was created @@ -18531,6 +19210,9 @@ def on_video_catalogue_mark_temp_dl_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 19214 on_video_catalogue_mark_temp_dl_multi') + # Only download videos which have a source URL mod_list = [] for media_data_obj in media_data_list: @@ -18582,6 +19264,9 @@ def on_video_catalogue_not_livestream(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 19268 on_video_catalogue_not_livestream') + # Update the video self.app_obj.mark_video_live( media_data_obj, @@ -18611,6 +19296,11 @@ def on_video_catalogue_not_livestream_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 19300 on_video_catalogue_not_livestream_multi', + ) + for media_data_obj in media_data_list: if media_data_obj.live_mode: self.app_obj.mark_video_live( @@ -18637,6 +19327,9 @@ def on_video_catalogue_output_override(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 19331 on_video_catalogue_output_override') + # Prompt the user dialogue_win = OutputOverrideDialogue(self, media_data_obj) response = dialogue_win.run() @@ -18745,6 +19438,11 @@ def on_video_catalogue_page_entry_activated(self, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 19442 on_video_catalogue_page_entry_activated', + ) + page_num = utils.strip_whitespace(entry.get_text()) if self.video_index_current_dbid is None \ @@ -18782,6 +19480,9 @@ def on_video_catalogue_process_clip(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 19484 on_video_catalogue_process_clip') + # Prompt the user dialogue_win = PrepareClipDialogue(self, media_data_obj) response = dialogue_win.run() @@ -18932,6 +19633,11 @@ def on_video_catalogue_process_clip_classic_mode(self, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 19637 on_video_catalogue_process_clip_classic_mode', + ) + # Prompt the user dialogue_win = PrepareClipDialogue(self, media_data_obj) response = dialogue_win.run() @@ -19157,6 +19863,9 @@ def on_video_catalogue_process_ffmpeg(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 19867 on_video_catalogue_process_ffmpeg') + # Can't start a process operation if another operation has started # since the popup menu was created, or if the video hasn't been # downloaded @@ -19188,6 +19897,11 @@ def on_video_catalogue_process_ffmpeg_multi(self, menu_item, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 19901 on_video_catalogue_process_ffmpeg_multi', + ) + ignore_me = _( 'TRANSLATOR\'S NOTE: Dialogue window, generated by a popup menu.' \ + ' In the Videos tab, right-click a video and select' \ @@ -19245,6 +19959,9 @@ def on_video_catalogue_process_slice(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 19963 on_video_catalogue_process_slice') + # Prompt the user for start/stop times dialogue_win = PrepareSliceDialogue(self, media_data_obj) response = dialogue_win.run() @@ -19372,6 +20089,9 @@ def on_video_catalogue_re_download(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20093 on_video_catalogue_re_download') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 255, @@ -19404,6 +20124,9 @@ def on_video_catalogue_reload_metadata(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20128 on_video_catalogue_reload_metadata') + ignore_me = _( 'TRANSLATOR\'S NOTE: Dialogue window, generated by a popup menu.' \ + ' In the Videos tab, right-click a video and select' \ @@ -19475,6 +20198,11 @@ def on_video_catalogue_reload_metadata_multi(self, menu_item, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20202 on_video_catalogue_reload_metadata_multi', + ) + if self.app_obj.current_manager_obj: return @@ -19538,6 +20266,9 @@ def on_video_catalogue_remove_options(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20270 on_video_catalogue_remove_options') + if self.app_obj.current_manager_obj or not media_data_obj.options_obj: return self.app_obj.system_error( 257, @@ -19561,6 +20292,11 @@ def on_video_catalogue_size_entry_activated(self, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20296 on_video_catalogue_size_entry_activated', + ) + size = utils.strip_whitespace(entry.get_text()) if size.isdigit() and int(size) > 0: @@ -19596,6 +20332,9 @@ def on_video_catalogue_show_location(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20336 on_video_catalogue_show_location') + parent_obj = media_data_obj.parent_obj other_obj = self.app_obj.media_reg_dict[parent_obj.master_dbid] path = other_obj.get_actual_dir(self.app_obj) @@ -19619,6 +20358,11 @@ def on_video_catalogue_show_location_multi(self, menu_item, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20362 on_video_catalogue_show_location_multi', + ) + path_list = [] for media_data_obj in media_data_list: @@ -19647,6 +20391,9 @@ def on_video_catalogue_show_properties(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20395 on_video_catalogue_show_properties') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 258, @@ -19672,6 +20419,11 @@ def on_video_catalogue_show_properties_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20423 on_video_catalogue_show_properties_multi', + ) + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 259, @@ -19701,6 +20453,9 @@ def on_video_catalogue_show_system_cmd(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20457 on_video_catalogue_show_system_cmd') + # Show the dialogue window dialogue_win = SystemCmdDialogue(self, media_data_obj) dialogue_win.run() @@ -19719,6 +20474,9 @@ def on_video_catalogue_sort_combo_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20478 on_video_catalogue_sort_combo_changed') + tree_iter = self.catalogue_sort_combo.get_active_iter() model = self.catalogue_sort_combo.get_model() self.app_obj.set_catalogue_sort_mode(model[tree_iter][1]) @@ -19747,6 +20505,11 @@ def on_video_catalogue_thumb_combo_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20509 on_video_catalogue_thumb_combo_changed', + ) + tree_iter = self.catalogue_thumb_combo.get_active_iter() model = self.catalogue_thumb_combo.get_model() self.app_obj.set_thumb_size_custom(model[tree_iter][1]) @@ -19787,6 +20550,9 @@ def on_video_catalogue_temp_dl(self, menu_item, media_data_obj, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20554 on_video_catalogue_temp_dl') + # Can't download the video if it has no source, or if an update/ # refresh/tidy/process operation has started since the popup menu was # created @@ -19846,6 +20612,9 @@ def on_video_catalogue_temp_dl_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20616 on_video_catalogue_temp_dl_multi') + # Only download videos which have a source URL mod_list = [] for media_data_obj in media_data_list: @@ -19912,6 +20681,9 @@ def on_video_catalogue_test_dl(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20685 on_video_catalogue_test_dl') + # Can't start an info operation if any type of operation has started # since the popup menu was created if not self.app_obj.current_manager_obj: @@ -19960,6 +20732,11 @@ def on_video_catalogue_toggle_archived_video(self, menu_item, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20736 on_video_catalogue_toggle_archived_video', + ) + if not media_data_obj.archive_flag: media_data_obj.set_archive_flag(True) else: @@ -19990,6 +20767,11 @@ def on_video_catalogue_toggle_archived_video_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20771 on_video_catalogue_toggle_archived_video_multi', + ) + for media_data_obj in media_data_list: media_data_obj.set_archive_flag(archived_flag) GObject.timeout_add( @@ -20017,6 +20799,11 @@ def on_video_catalogue_toggle_bookmark_video(self, menu_item, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20803 on_video_catalogue_toggle_bookmark_video', + ) + if not media_data_obj.bookmark_flag: self.app_obj.mark_video_bookmark(media_data_obj, True) else: @@ -20041,6 +20828,11 @@ def on_video_catalogue_toggle_bookmark_video_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20832 on_video_catalogue_toggle_bookmark_video_multi', + ) + for media_data_obj in media_data_list: self.app_obj.mark_video_bookmark(media_data_obj, bookmark_flag) @@ -20063,6 +20855,11 @@ def on_video_catalogue_toggle_favourite_video(self, menu_item, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20859 on_video_catalogue_toggle_favourite_video', + ) + if not media_data_obj.fav_flag: self.app_obj.mark_video_favourite(media_data_obj, True) else: @@ -20087,6 +20884,11 @@ def on_video_catalogue_toggle_favourite_video_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20888 on_video_catalogue_toggle_favourite_video_multi', + ) + for media_data_obj in media_data_list: self.app_obj.mark_video_favourite(media_data_obj, fav_flag) @@ -20109,6 +20911,11 @@ def on_video_catalogue_toggle_missing_video(self, menu_item, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20915 on_video_catalogue_toggle_missing_video', + ) + if not media_data_obj.missing_flag: self.app_obj.mark_video_missing(media_data_obj, True) else: @@ -20133,6 +20940,11 @@ def on_video_catalogue_toggle_missing_video_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20944 on_video_catalogue_toggle_missing_video_multi', + ) + for media_data_obj in media_data_list: self.app_obj.mark_video_missing(media_data_obj, missing_flag) @@ -20154,6 +20966,9 @@ def on_video_catalogue_toggle_new_video(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 20970 on_video_catalogue_toggle_new_video') + if not media_data_obj.new_flag: self.app_obj.mark_video_new(media_data_obj, True) else: @@ -20178,6 +20993,11 @@ def on_video_catalogue_toggle_new_video_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 20997 on_video_catalogue_toggle_new_video_multi', + ) + for media_data_obj in media_data_list: self.app_obj.mark_video_new(media_data_obj, new_flag) @@ -20200,6 +21020,11 @@ def on_video_catalogue_toggle_waiting_video(self, menu_item, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 21024 on_video_catalogue_toggle_waiting_video', + ) + if not media_data_obj.waiting_flag: self.app_obj.mark_video_waiting(media_data_obj, True) else: @@ -20224,6 +21049,11 @@ def on_video_catalogue_toggle_waiting_video_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 21053 on_video_catalogue_toggle_waiting_video_multi', + ) + for media_data_obj in media_data_list: self.app_obj.mark_video_waiting(media_data_obj, waiting_flag) @@ -20245,6 +21075,9 @@ def on_video_catalogue_watch_hooktube(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21079 on_video_catalogue_watch_hooktube') + # Launch the video utils.open_file( self.app_obj, @@ -20273,6 +21106,9 @@ def on_video_catalogue_watch_invidious(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21110 on_video_catalogue_watch_invidious') + # Launch the video utils.open_file( self.app_obj, @@ -20305,6 +21141,9 @@ def on_video_catalogue_watch_video(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21145 on_video_catalogue_watch_video') + # Launch the video self.app_obj.watch_video_in_player(media_data_obj) @@ -20331,6 +21170,9 @@ def on_video_catalogue_watch_video_multi(self, menu_item, media_data_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21174 on_video_catalogue_watch_video_multi') + # Only watch videos which are marked as downloaded for media_data_obj in media_data_list: if media_data_obj.dl_flag: @@ -20362,6 +21204,9 @@ def on_video_catalogue_watch_website(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21208 on_video_catalogue_watch_website') + # Launch the video utils.open_file(self.app_obj, media_data_obj.source) @@ -20388,6 +21233,11 @@ def on_video_catalogue_watch_website_multi(self, menu_item, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 21237 on_video_catalogue_watch_website_multi', + ) + # Only watch videos which have a source URL for media_data_obj in media_data_list: if media_data_obj.source is not None: @@ -20422,6 +21272,9 @@ def on_progress_list_dl_last(self, menu_item, download_item_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21276 on_progress_list_dl_last') + # Check that, since the popup menu was created, the media data object # hasn't been assigned a worker for this_worker_obj in self.app_obj.download_manager_obj.worker_list: @@ -20466,6 +21319,9 @@ def on_progress_list_dl_next(self, menu_item, download_item_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21323 on_progress_list_dl_next') + # Check that, since the popup menu was created, the media data object # hasn't been assigned a worker for this_worker_obj in self.app_obj.download_manager_obj.worker_list: @@ -20506,6 +21362,9 @@ def on_progress_list_right_click(self, treeview, event): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21366 on_progress_list_right_click') + if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3: # If the user right-clicked on empty space, the call to @@ -20547,6 +21406,9 @@ def on_progress_list_stop_all_soon(self, menu_item): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21410 on_progress_list_stop_all_soon') + # Check that, since the popup menu was created, the download operation # hasn't finished if not self.app_obj.download_manager_obj: @@ -20581,6 +21443,9 @@ def on_progress_list_stop_now(self, menu_item, download_item_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21447 on_progress_list_stop_now') + # Check that, since the popup menu was created, the video downloader # hasn't already finished checking/downloading the selected media # data object @@ -20622,6 +21487,9 @@ def on_progress_list_stop_soon(self, menu_item, download_item_obj, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21491 on_progress_list_stop_soon') + download_manager_obj = self.app_obj.download_manager_obj # Check that, since the popup menu was created, the video downloader @@ -20669,6 +21537,9 @@ def on_progress_list_watch_hooktube(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21541 on_progress_list_watch_hooktube') + if isinstance(media_data_obj, media.Video): # Launch the video @@ -20700,6 +21571,9 @@ def on_progress_list_watch_invidious(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21575 on_progress_list_watch_invidious') + if isinstance(media_data_obj, media.Video): # Launch the video @@ -20733,6 +21607,9 @@ def on_progress_list_watch_website(self, menu_item, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21611 on_progress_list_watch_website') + if isinstance(media_data_obj, media.Video) \ and media_data_obj.source: @@ -20756,6 +21633,9 @@ def on_results_list_delete_video(self, menu_item, media_data_obj, path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21637 on_results_list_delete_video') + # Delete the video self.app_obj.delete_video(media_data_obj, True) @@ -20788,6 +21668,9 @@ def on_results_list_drag_data_get(self, treeview, drag_context, data, info, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21672 on_results_list_drag_data_get') + # Get the selected media.Video object(s) video_list = self.get_selected_videos_in_treeview( self.results_list_treeview, @@ -20818,6 +21701,9 @@ def on_results_list_right_click(self, treeview, event): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21705 on_results_list_right_click') + if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3: # If the user right-clicked on empty space, the call to @@ -20851,6 +21737,9 @@ def on_errors_list_clear(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21741 on_errors_list_clear') + self.error_list_buffer_list = [] self.errors_list_reset() @@ -20868,6 +21757,9 @@ def on_errors_list_copy(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21761 on_errors_list_copy') + # Based on code from self.on_errors_list_drag_data_get() # For each selected line, retrieve values from the three hidden columns text = '' @@ -20950,6 +21842,9 @@ def on_errors_list_drag_data_get(self, treeview, drag_context, data, info, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21846 on_errors_list_drag_data_get') + # For each selected line, retrieve values from the three hidden columns text = '' @@ -21021,6 +21916,9 @@ def on_classic_convert_combo_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21920 on_classic_convert_combo_changed') + tree_iter = self.classic_convert_combo.get_active_iter() model = self.classic_convert_combo.get_model() text = utils.strip_whitespace(model[tree_iter][0]) @@ -21050,6 +21948,9 @@ def on_classic_dest_dir_combo_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21952 on_classic_dest_dir_combo_changed') + tree_iter = self.classic_dest_dir_combo.get_active_iter() model = self.classic_dest_dir_combo.get_model() self.app_obj.set_classic_dir_previous(model[tree_iter][0]) @@ -21073,6 +21974,9 @@ def on_classic_format_combo_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 21978 on_classic_format_combo_changed') + ignore_me = _( 'TRANSLATOR\'S NOTE: Extra items for the \'Format\' drop-down' \ + ' box in the Classic Mode tab' @@ -21133,6 +22037,11 @@ def on_classic_livestream_checkbutton_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 22041 on_classic_livestream_checkbutton_toggled', + ) + self.app_obj.set_classic_livestream_flag(checkbutton.get_active()) @@ -21149,6 +22058,9 @@ def on_classic_menu_custom_dl_prefs(self, menu_item): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22062 on_classic_menu_custom_dl_prefs') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( @@ -21173,6 +22085,9 @@ def on_classic_menu_edit_options(self, menu_item): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22089 on_classic_menu_edit_options') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( @@ -21208,6 +22123,9 @@ def on_classic_menu_set_options(self, menu_item): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22127 on_classic_menu_set_options') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 262, @@ -21232,6 +22150,9 @@ def on_classic_menu_use_general_options(self, menu_item): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22154 on_classic_menu_use_general_options') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( @@ -21254,6 +22175,9 @@ def on_classic_menu_toggle_auto_copy(self, menu_item): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22179 on_classic_menu_toggle_auto_copy') + if not self.classic_auto_copy_flag: # Update IVs @@ -21287,6 +22211,9 @@ def on_classic_menu_toggle_custom_dl(self, menu_item): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22215 on_classic_menu_toggle_custom_dl') + ignore_me = _( 'TRANSLATOR\'S NOTE: Extra items for the buttons at the bottom' \ + ' of the Classic Mode tab' @@ -21330,6 +22257,9 @@ def on_classic_menu_toggle_one_click_dl(self, menu_item): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22261 on_classic_menu_toggle_one_click_dl') + # Update IVs if not self.classic_one_click_dl_flag: self.classic_one_click_dl_flag = True @@ -21350,6 +22280,9 @@ def on_classic_menu_toggle_remember_urls(self, menu_item): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22284 on_classic_menu_toggle_remember_urls') + self.app_obj.toggle_classic_pending_flag() @@ -21365,6 +22298,9 @@ def on_classic_menu_update_ytdl(self, menu_item): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22302 on_classic_menu_update_ytdl') + if self.app_obj.current_manager_obj: return self.app_obj.system_error( 265, @@ -21399,6 +22335,11 @@ def on_classic_progress_list_drag_data_get(self, treeview, drag_context, """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 22339 on_classic_progress_list_drag_data_get', + ) + # Get the selected dummy media.Video object(s) video_list = self.get_selected_videos_in_classic_treeview() @@ -21440,6 +22381,9 @@ def on_classic_progress_list_from_popup(self, menu_item, menu_item_type, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22385 on_classic_progress_list_from_popup') + # Re-direct the request to the button callbacks, supplying dummy # action/par arguments (which are ignored anyway) if menu_item_type == 'play': @@ -21478,6 +22422,9 @@ def on_classic_progress_list_get_cmd(self, menu_item, dummy_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22426 on_classic_progress_list_get_cmd') + # Generate the list of download options for the dummy media.Video # object options_parser_obj = options.OptionsParser(self.app_obj) @@ -21517,6 +22464,9 @@ def on_classic_progress_list_get_path(self, menu_item, dummy_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22468 on_classic_progress_list_get_path') + clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) clipboard.set_text(dummy_obj.dummy_path, -1) @@ -21537,6 +22487,9 @@ def on_classic_progress_list_get_url(self, menu_item, dummy_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22491 on_classic_progress_list_get_url') + clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) clipboard.set_text(dummy_obj.source, -1) @@ -21560,6 +22513,9 @@ def on_classic_progress_list_reinsert_url(self, menu_item, dummy_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22517 on_classic_progress_list_reinsert_url') + # (Import IVs for convenience) manager_obj = self.app_obj.download_manager_obj @@ -21621,6 +22577,9 @@ def on_classic_progress_list_right_click(self, treeview, event): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22581 on_classic_progress_list_right_click') + if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3: # If the user right-clicked on empty space, the call to @@ -21653,6 +22612,9 @@ def on_classic_resolution_combo_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22616 on_classic_resolution_combo_changed') + tree_iter = self.classic_resolution_combo.get_active_iter() model = self.classic_resolution_combo.get_model() text = utils.strip_whitespace(model[tree_iter][0]) @@ -21683,6 +22645,9 @@ def on_classic_sblock_checkbutton_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22649 on_classic_sblock_checkbutton_toggled') + self.app_obj.set_classic_sblock_flag(checkbutton.get_active()) @@ -21700,6 +22665,9 @@ def on_classic_textbuffer_changed(self, textbuffer): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22669 on_classic_textbuffer_changed') + if self.classic_one_click_dl_flag \ and not self.classic_auto_copy_check_flag: @@ -21729,6 +22697,9 @@ def on_classic_textview_paste(self, textview): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22701 on_classic_textview_paste') + # (Don't bother, if the URLs are going to be downloaded immediately) if not self.classic_one_click_dl_flag: @@ -21764,6 +22735,9 @@ def on_bandwidth_spinbutton_changed(self, spinbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22739 on_bandwidth_spinbutton_changed') + if self.bandwidth_checkbutton.get_active(): self.app_obj.set_bandwidth_default( int(self.bandwidth_spinbutton.get_value()) @@ -21784,6 +22758,9 @@ def on_bandwidth_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22762 on_bandwidth_checkbutton_changed') + if self.bandwidth_checkbutton.get_active(): self.app_obj.set_bandwidth_apply_flag(True) @@ -21814,6 +22791,9 @@ def on_custom_dl_menu_select(self, menu_item, media_data_list, uid): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22795 on_custom_dl_menu_select') + custom_dl_obj = self.app_obj.custom_dl_reg_dict[uid] if not custom_dl_obj.dl_by_video_flag \ @@ -21851,6 +22831,9 @@ def on_delete_event(self, widget, event): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22835 on_delete_event') + if self.app_obj.status_icon_obj \ and self.app_obj.show_status_icon_flag \ and self.app_obj.close_to_tray_flag \ @@ -21887,6 +22870,9 @@ def on_delete_profile_menu_select(self, menu_item, profile_name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22874 on_delete_profile_menu_select') + ignore_me = _( 'TRANSLATOR\'S NOTE: Dialogue window, generated by main window' \ + ' menu, Media > Profiles > Delete profile' @@ -21921,6 +22907,9 @@ def on_draw_blocked_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22911 on_draw_blocked_checkbutton_changed') + self.app_obj.set_catalogue_draw_blocked_flag(checkbutton.get_active()) # Redraw the Video Catalogue self.video_catalogue_redraw_all( @@ -21944,6 +22933,11 @@ def on_draw_downloaded_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 22937 on_draw_downloaded_checkbutton_changed', + ) + self.app_obj.set_catalogue_draw_downloaded_flag( checkbutton.get_active(), ) @@ -21969,6 +22963,9 @@ def on_draw_frame_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 22967 on_draw_frame_checkbutton_changed') + self.app_obj.set_catalogue_draw_frame_flag(checkbutton.get_active()) # (No need to redraw the Video Catalogue, just to enable/disable the # visible frame around each video) @@ -22000,6 +22997,9 @@ def on_draw_icons_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23001 on_draw_icons_checkbutton_changed') + self.app_obj.set_catalogue_draw_icons_flag(checkbutton.get_active()) # (No need to redraw the Video Catalogue, just to make the status icons # visible/invisible) @@ -22021,6 +23021,11 @@ def on_draw_undownloaded_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 23025 on_draw_undownloaded_checkbutton_changed', + ) + self.app_obj.set_catalogue_draw_undownloaded_flag( checkbutton.get_active(), ) @@ -22046,6 +23051,9 @@ def on_filter_comment_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23055 on_filter_comment_checkbutton_changed') + self.app_obj.set_catalogue_filter_comment_flag( checkbutton.get_active(), ) @@ -22069,6 +23077,9 @@ def on_filter_descrip_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23081 on_filter_descrip_checkbutton_changed') + self.app_obj.set_catalogue_filter_descrip_flag( checkbutton.get_active(), ) @@ -22092,6 +23103,9 @@ def on_filter_name_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23107 on_filter_name_checkbutton_changed') + self.app_obj.set_catalogue_filter_name_flag(checkbutton.get_active()) # (No need to redraw the Video Catalogue, just to make the status icons # visible/invisible @@ -22112,6 +23126,9 @@ def on_hide_finished_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23130 on_hide_finished_checkbutton_changed') + self.app_obj.set_progress_list_hide_flag(checkbutton.get_active()) @@ -22134,6 +23151,9 @@ def on_notebook_switch_page(self, notebook, box, page_num): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23155 on_notebook_switch_page') + self.visible_tab_num = page_num if page_num == self.notebook_tab_dict['output']: @@ -22179,6 +23199,9 @@ def on_notify_desktop_clicked(self, notification, action_name, notify_id, \ """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23203 on_notify_desktop_clicked') + utils.open_file(self.app_obj, url) # This callback isn't needed any more, so we don't need to retain a @@ -22203,6 +23226,9 @@ def on_notify_desktop_closed(self, notification, notify_id): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23230 on_notify_desktop_closed') + if notify_id in self.notify_desktop_dict: del self.notify_desktop_dict[notify_id] @@ -22221,6 +23247,9 @@ def on_num_worker_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23251 on_num_worker_checkbutton_changed') + if self.num_worker_checkbutton.get_active(): self.app_obj.set_num_worker_apply_flag(True) @@ -22247,6 +23276,9 @@ def on_num_worker_spinbutton_changed(self, spinbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23280 on_num_worker_spinbutton_changed') + if self.num_worker_checkbutton.get_active(): self.app_obj.set_num_worker_default( int(self.num_worker_spinbutton.get_value()) @@ -22265,6 +23297,11 @@ def on_operation_error_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 23301 on_operation_error_checkbutton_changed', + ) + self.app_obj.set_operation_error_show_flag(checkbutton.get_active()) self.errors_list_reset() @@ -22281,6 +23318,11 @@ def on_operation_warning_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 23322 on_operation_warning_checkbutton_changed', + ) + self.app_obj.set_operation_warning_show_flag(checkbutton.get_active()) self.errors_list_reset() @@ -22304,6 +23346,9 @@ def on_output_notebook_switch_page(self, notebook, box, page_num): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23350 on_output_notebook_switch_page') + # Output tab IVs number the first page as #1, and so on self.output_tab_scroll_visible_page(page_num + 1) @@ -22321,6 +23366,9 @@ def on_output_size_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23370 on_output_size_checkbutton_changed') + if self.output_size_checkbutton.get_active(): self.app_obj.set_output_size_apply_flag(True) @@ -22346,6 +23394,9 @@ def on_output_size_spinbutton_changed(self, spinbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23398 on_output_size_spinbutton_changed') + if self.output_size_checkbutton.get_active(): self.app_obj.set_output_size_default( int(self.output_size_spinbutton.get_value()) @@ -22369,6 +23420,9 @@ def on_paned_size_allocate(self, widget, rect): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23424 on_paned_size_allocate') + if self.paned_last_width is None \ or self.paned_last_width != rect.width: @@ -22395,6 +23449,11 @@ def on_reverse_results_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 23453 on_reverse_results_checkbutton_changed', + ) + self.app_obj.set_results_list_reverse_flag(checkbutton.get_active()) @@ -22413,6 +23472,9 @@ def on_switch_profile_menu_select(self, menu_item, profile_name): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23476 on_switch_profile_menu_select') + self.switch_profile(profile_name) @@ -22435,6 +23497,9 @@ def on_switch_view(self, menu_item, catalogue_mode, catalogue_mode_type): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23501 on_switch_view') + self.app_obj.set_catalogue_mode(catalogue_mode, catalogue_mode_type) @@ -22450,6 +23515,11 @@ def on_system_container_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 23519 on_system_container_checkbutton_changed', + ) + self.app_obj.set_system_msg_show_container_flag( checkbutton.get_active(), ) @@ -22473,6 +23543,9 @@ def on_system_date_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23547 on_system_date_checkbutton_changed') + self.app_obj.set_system_msg_show_date_flag(checkbutton.get_active()) long_column = self.errors_list_treeview.get_column(5) @@ -22498,6 +23571,9 @@ def on_system_error_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23575 on_system_error_checkbutton_changed') + self.app_obj.set_system_error_show_flag(checkbutton.get_active()) self.errors_list_reset() @@ -22514,6 +23590,11 @@ def on_system_multi_line_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 23594 on_system_multi_line_checkbutton_changed', + ) + self.app_obj.set_system_msg_show_multi_line_flag( checkbutton.get_active(), ) @@ -22541,6 +23622,9 @@ def on_system_video_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23626 on_system_video_checkbutton_changed') + self.app_obj.set_system_msg_show_video_flag(checkbutton.get_active()) name_column = self.errors_list_treeview.get_column(8) @@ -22562,6 +23646,9 @@ def on_system_warning_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23650 on_system_warning_checkbutton_changed') + self.app_obj.set_system_warning_show_flag(checkbutton.get_active()) self.errors_list_reset() @@ -22580,6 +23667,9 @@ def on_video_res_combobox_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23671 on_video_res_combobox_changed') + tree_iter = self.video_res_combobox.get_active_iter() model = self.video_res_combobox.get_model() self.app_obj.set_video_res_default(model[tree_iter][0]) @@ -22599,6 +23689,9 @@ def on_video_res_checkbutton_changed(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23693 on_video_res_checkbutton_changed') + self.app_obj.set_video_res_apply_flag( self.video_res_checkbutton.get_active(), ) @@ -22630,6 +23723,9 @@ def on_window_drag_data_received(self, widget, drag_context, x, y, data, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23727 on_window_drag_data_received') + # (Git #561) Ugly hack to bypass the issue described in # self.on_video_index_drag_data_received() if self.ignore_drag_context is not None \ @@ -22798,6 +23894,9 @@ def on_window_size_allocate(self, widget, rect): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23898 on_window_size_allocate') + if self.win_last_width is None \ or self.win_last_width != rect.width \ or self.win_last_height != rect.height: @@ -22852,6 +23951,9 @@ def get_media_drag_data_as_list(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 23955 get_media_drag_data_as_list') + return_list = [] # Full file path @@ -22914,6 +24016,9 @@ def get_selected_videos_in_treeview(self, treeview, column): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24020 get_selected_videos_in_treeview') + video_list = [] selection = treeview.get_selection() @@ -22950,6 +24055,11 @@ def get_selected_videos_in_classic_treeview(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time( + 'mwn 24059 get_selected_videos_in_classic_treeview', + ) + video_list = [] selection = self.classic_progress_treeview.get_selection() @@ -22989,6 +24099,9 @@ def get_take_a_while_msg(self, media_data_obj, count): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24103 get_take_a_while_msg') + media_type = media_data_obj.get_type() if media_type == 'channel': @@ -23043,6 +24156,9 @@ def get_video_drag_data(self, video_list, dummy_flag=False): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24160 get_video_drag_data') + text = '' for video_obj in video_list: @@ -23121,6 +24237,9 @@ def add_child_window(self, config_win_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24241 add_child_window') + # Check that the window isn't already in the list (unlikely, but check # anyway) if config_win_obj in self.config_win_list: @@ -23149,6 +24268,9 @@ def del_child_window(self, config_win_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24272 del_child_window') + # Update IVs # (Don't show an error if the window isn't in the list, as it's # conceivable this function might be called twice) @@ -23170,6 +24292,9 @@ def reset_video_catalogue_drag_list(self): is no longer required, so reset it. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24296 reset_video_catalogue_drag_list') + self.video_catalogue_drag_list = [] @@ -23180,6 +24305,9 @@ def set_previous_alt_dest_dbid(self, value): The specified value may be a .dbid, or None. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24309 set_previous_alt_dest_dbid') + self.previous_alt_dest_dbid = value @@ -23190,6 +24318,9 @@ def set_previous_external_dir(self, value): The specified value may be a full path to a directory, or None. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24322 set_previous_external_dir') + self.previous_external_dir = value @@ -23207,6 +24338,9 @@ def set_video_catalogue_drag_list(self, video_list): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24342 set_video_catalogue_drag_list') + self.video_catalogue_drag_list = video_list.copy() @@ -23238,6 +24372,9 @@ class SimpleCatalogueItem(object): def __init__(self, main_win_obj, video_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24376 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: This section specifies text used to' \ + ' display videos in the Videos tab. Videos are displayed in' \ @@ -23306,6 +24443,9 @@ def draw_widgets(self, catalogue_row): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24447 draw_widgets') + self.catalogue_row = catalogue_row event_box = Gtk.EventBox() @@ -23377,6 +24517,9 @@ def update_widgets(self): Sets the values displayed by each widget. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24521 update_widgets') + self.update_background() self.update_tooltips() self.update_status_images() @@ -23393,6 +24536,9 @@ def update_background(self): (but only when a video's livestream mode has changed). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24540 update_background') + if self.previous_live_mode != self.video_obj.live_mode: self.previous_live_mode = self.video_obj.live_mode @@ -23447,6 +24593,9 @@ def update_tooltips(self): Updates the tooltips for the Gtk.HBox that contains everything. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24597 update_tooltips') + if self.main_win_obj.app_obj.show_tooltips_flag: self.hbox.set_tooltip_text( self.video_obj.fetch_tooltip_text( @@ -23463,6 +24612,9 @@ def update_status_images(self): Updates the Gtk.Image widget to display the video's download status. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24616 update_status_images') + # Set the download status if self.video_obj.live_mode == 1: @@ -23604,6 +24756,9 @@ def update_video_name(self): Updates the Gtk.Label widget to display the video's current name. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24760 update_video_name') + # For videos whose name is unknown, display the URL, rather than the # usual '(video with no name)' string if not self.main_win_obj.app_obj.catalogue_show_nickname_flag: @@ -23659,6 +24814,9 @@ def update_container_name(self): playlist or folder. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24818 update_container_name') + if self.main_win_obj.app_obj.catalogue_mode != 'simple_show_parent': return @@ -23702,6 +24860,9 @@ def update_video_stats(self): duration/date information. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24864 update_video_stats') + if self.video_obj.live_mode: if not self.video_obj.live_debut_flag: @@ -23770,6 +24931,9 @@ def on_right_click_row(self, event_box, event): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24935 on_right_click_row') + if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3: self.main_win_obj.video_catalogue_popup_menu(event, self.video_obj) @@ -23803,6 +24967,9 @@ class ComplexCatalogueItem(object): def __init__(self, main_win_obj, video_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 24971 __init__') + # IV list - class objects # ----------------------- # The main window object @@ -23906,6 +25073,9 @@ def draw_widgets(self, catalogue_row): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 25077 draw_widgets') + # If the video's parent folder is a temporary folder, then we don't # need one row of widgets at all parent_obj = self.video_obj.parent_obj @@ -24274,6 +25444,9 @@ def update_widgets(self): Sets the values displayed by each widget. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 25448 update_widgets') + self.update_background() self.update_tooltips() self.update_thumb_image() @@ -24321,6 +25494,9 @@ def update_background(self): (but only when a video's livestream mode has changed). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 25498 update_background') + if self.previous_live_mode != self.video_obj.live_mode: self.previous_live_mode = self.video_obj.live_mode @@ -24375,6 +25551,9 @@ def update_tooltips(self): Updates the tooltips for the Gtk.Frame that contains everything. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 25555 update_tooltips') + if self.main_win_obj.app_obj.show_tooltips_flag: self.frame.set_tooltip_text( self.video_obj.fetch_tooltip_text( @@ -24392,6 +25571,9 @@ def update_thumb_image(self): available. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 25575 update_thumb_image') + # See if the video's thumbnail file has been downloaded thumb_flag = False if self.video_obj.file_name: @@ -24450,6 +25632,9 @@ def update_video_name(self): Updates the Gtk.Label widget to display the video's current name. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 25635 update_video_name') + # For videos whose name is unknown, display the URL, rather than the # usual '(video with no name)' string if not self.main_win_obj.app_obj.catalogue_show_nickname_flag: @@ -24505,6 +25690,9 @@ def update_status_images(self): error and warning settings. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 25694 update_status_images') + # Special case: don't display any images at all, if the flag is not # set if not self.main_win_obj.app_obj.catalogue_draw_icons_flag: @@ -24653,6 +25841,9 @@ def update_video_descrip(self): description. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 25845 update_video_descrip') + if self.main_win_obj.app_obj.catalogue_mode == 'complex_hide_parent' \ or self.main_win_obj.app_obj.catalogue_mode \ == 'complex_hide_parent_ext': @@ -24765,6 +25956,9 @@ def update_video_stats(self): For livestreams, instead displays livestream options. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 25960 update_video_stats') + # Import the main application (for convenience) app_obj = self.main_win_obj.app_obj @@ -24927,6 +26121,9 @@ def update_watch_player(self): external media player. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 26125 update_watch_player') + if self.video_obj.file_name: watch_text = ' Change theme.' \ @@ -31917,6 +33501,9 @@ def get_theme_dict(self): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 33505 get_theme_dict') + app_obj = self.parent_win_obj.app_obj themes_path = os.path.abspath( @@ -31974,6 +33561,9 @@ def on_combo_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 33565 on_combo_changed') + tree_iter = combo.get_active_iter() model = combo.get_model() theme_name = model[tree_iter][0] @@ -32006,6 +33596,9 @@ class CreateProfileDialogue(Gtk.Dialog): def __init__(self, main_win_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 33600 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Create profile\' dialogue starts here.' \ + ' In the main window menu, click Media > Profiles > Create' \ @@ -32128,6 +33721,9 @@ def on_entry_changed(self, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 33725 on_entry_changed') + name = entry.get_text() if name == '': self.profile_name = None @@ -32161,6 +33757,9 @@ class DeleteContainerDialogue(Gtk.Dialog): def __init__(self, main_win_obj, media_data_obj, empty_flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 33761 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Delete channel\' dialogue starts here.' \ + ' In the Videos tab, right-click a channel and select Delete' \ @@ -32430,6 +34029,9 @@ class DeleteDropZoneDialogue(Gtk.Dialog): def __init__(self, main_win_obj, options_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34033 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Delete dropzone\' dialogue starts here.' \ + ' In the Drag and Drop tab, click a delete button in the' \ @@ -32513,6 +34115,9 @@ def on_dropzone_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34119 on_dropzone_button_clicked') + self.del_dropzone_flag = True self.destroy() @@ -32529,6 +34134,9 @@ def on_both_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34138 on_both_button_clicked') + self.del_both_flag = True self.destroy() @@ -32555,6 +34163,9 @@ class DeleteVideoDialogue(Gtk.Dialog): def __init__(self, main_win_obj, media_list): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34167 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Delete videos\' dialogue starts here.' \ + ' In the Videos tab, right-click a video and select Delete video' @@ -32723,6 +34334,9 @@ class DuplicateVideoDialogue(Gtk.Dialog): def __init__(self, main_win_obj, duplicate_list): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34338 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Duplicate URLs\' dialogue starts here.' \ + ' In the main window toolbar, click the Video button. In the' \ @@ -32821,6 +34435,9 @@ class ExportDialogue(Gtk.Dialog): def __init__(self, main_win_obj, whole_flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34439 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Export from database\' dialogue starts' \ + ' here. In the main window menu, click Media > Export/Import' \ @@ -32999,6 +34616,9 @@ def on_combo_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34620 on_combo_changed') + tree_iter = combo.get_active_iter() model = combo.get_model() self.separator = model[tree_iter][0] @@ -33018,6 +34638,9 @@ def on_radiobutton_toggled(self, button, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34642 on_radiobutton_toggled') + if button.get_active(): combo.set_sensitive(True) else: @@ -33043,6 +34666,9 @@ class ExtractorCodeDialogue(Gtk.Dialog): def __init__(self, parent_win_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34670 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Type extractor code\' dialogue starts' \ + ' here. In the main window menu, click Edit > General download' \ @@ -33143,6 +34769,9 @@ def on_entry_activated(self, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34773 on_entry_activated') + value = entry.get_text() # (Unspecified extractor codes are stored as None, not empty strings) if value == '': @@ -33165,6 +34794,9 @@ def on_entry_changed(self, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34798 on_entry_changed') + value = entry.get_text() # (Unspecified extractor codes are stored as None, not empty strings) if value == '': @@ -33198,6 +34830,9 @@ class FormatsSubsDialogue(Gtk.Dialog): def __init__(self, main_win_obj, video_obj, info_type): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34834 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: Confirmation dialogue for fetching' \ + ' formats/subtitles. In the Videos tab, right-click a video' \ @@ -33301,6 +34936,9 @@ def on_apply_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34940 on_apply_button_clicked') + # Import the main application (for convenience) app_obj = self.main_win_obj.app_obj @@ -33343,6 +34981,9 @@ def on_general_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 34985 on_general_button_clicked') + # Import the main application (for convenience) app_obj = self.main_win_obj.app_obj @@ -33376,6 +35017,9 @@ def on_update_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35021 on_update_button_clicked') + # Import the main application (for convenience) app_obj = self.main_win_obj.app_obj @@ -33418,6 +35062,9 @@ class ImportDialogue(Gtk.Dialog): def __init__(self, main_win_obj, db_dict): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35066 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Import into database\' dialogue starts' \ + ' here. In the main window menu, click Media > Export/Import' \ @@ -33631,6 +35278,9 @@ def convert_to_list(self, db_dict, converted_list, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35282 convert_to_list') + # (Sorting function for the code immediately below) def sort_dict_by_name(this_dict): return this_dict['name'] @@ -33693,6 +35343,9 @@ def on_checkbutton_toggled(self, checkbutton, path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35347 on_checkbutton_toggled') + # The user has clicked on the checkbutton widget, so toggle the widget # itself self.liststore[path][0] = not self.liststore[path][0] @@ -33715,6 +35368,9 @@ def on_select_all_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35372 on_select_all_clicked') + for path in range(0, len(self.liststore)): self.liststore[path][0] = True @@ -33734,6 +35390,9 @@ def on_deselect_all_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35394 on_deselect_all_clicked') + for path in range(0, len(self.liststore)): self.liststore[path][0] = False @@ -33765,6 +35424,9 @@ class InsertVideoDialogue(Gtk.Dialog): def __init__(self, main_win_obj, parent_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35428 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Insert videos\' dialogue starts here.' \ + ' In the Videos tab, right-click a channel and select' \ @@ -33968,6 +35630,9 @@ def close(self, also_self, textview): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35634 close') + textview.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY) @@ -33986,6 +35651,9 @@ def on_checkbutton_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35655 on_checkbutton_toggled') + if not checkbutton.get_active() \ and self.clipboard_timer_id is not None: @@ -34010,6 +35678,9 @@ def on_window_drag_data_received(self, window, context, x, y, data, info, Handles drag-and-drop anywhere in the dialogue window. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35682 on_window_drag_data_received') + utils.add_links_to_textview_from_clipboard( self.main_win_obj.app_obj, self.textbuffer, @@ -34029,6 +35700,9 @@ def clipboard_timer_callback(self): the dialogue window's textview. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35704 clipboard_timer_callback') + utils.add_links_to_textview_from_clipboard( self.main_win_obj.app_obj, self.textbuffer, @@ -34063,6 +35737,9 @@ class MountDriveDialogue(Gtk.Dialog): def __init__(self, main_win_obj, unwriteable_flag=False): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35741 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Mount drive\' dialogue starts here.' \ + ' Visible on startup, if Tartube\'s data folder does not' \ @@ -34222,6 +35899,9 @@ def do_try_again(self): The user has selected 'I have mounted the drive, please try again'. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35903 do_try_again') + app_obj = self.main_win_obj.app_obj if os.path.exists(app_obj.data_dir): @@ -34253,6 +35933,9 @@ def do_select_dir(self): The user has selected 'Select a different data directory'. """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35937 do_select_dir') + if self.main_win_obj.app_obj.prompt_user_for_data_dir(): # New data directory selected @@ -34275,6 +35958,9 @@ def on_ok_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 35962 on_ok_button_clicked') + if self.radiobutton.get_active(): self.do_try_again() @@ -34313,6 +35999,9 @@ def on_cancel_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36003 on_cancel_button_clicked') + self.available_flag = False self.destroy() @@ -34330,6 +36019,9 @@ def on_radiobutton_toggled(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36023 on_radiobutton_toggled') + if button.get_active(): self.combo.set_sensitive(True) else: @@ -34355,6 +36047,9 @@ class MSYS2Dialogue(Gtk.Dialog): def __init__(self, main_win_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36051 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'MSYS2 terminal\' dialogue starts here.' \ + ' In the main window menu, click System > Open MSYS2 terminal' \ @@ -34449,6 +36144,9 @@ def on_checkbutton_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36148 on_checkbutton_toggled') + if checkbutton.get_active(): self.main_win_obj.app_obj.set_show_msys2_dialogue_flag(True) else: @@ -34477,6 +36175,9 @@ class NewbieDialogue(Gtk.Dialog): def __init__(self, main_win_obj, classic_mode_flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36179 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: Download failure dialogue starts here.' \ + ' Visible when the user tries to check/download videos, but' \ @@ -34659,6 +36360,9 @@ def on_change_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36364 on_change_button_clicked') + self.change_flag = True self.destroy() @@ -34675,6 +36379,9 @@ def on_checkbutton_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36383 on_checkbutton_toggled') + if checkbutton.get_active(): self.show_flag = True else: @@ -34693,6 +36400,9 @@ def on_config_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36404 on_config_button_clicked') + self.config_flag = True self.destroy() @@ -34709,6 +36419,9 @@ def on_issues_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36423 on_issues_button_clicked') + self.issues_flag = True self.destroy() @@ -34725,6 +36438,9 @@ def on_update_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36442 on_update_button_clicked') + self.update_flag = True self.destroy() @@ -34741,6 +36457,9 @@ def on_website_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36461 on_website_button_clicked') + self.website_flag = True self.destroy() @@ -34767,6 +36486,9 @@ class OutputOverrideDialogue(Gtk.Dialog): def __init__(self, main_win_obj, video_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36490 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Download with name\' and \'Re-download' \ + ' with name\' dialogue starts here. Right-click a video and' \ @@ -34850,6 +36572,9 @@ def on_entry_changed(self, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36576 on_entry_changed') + text = entry.get_text() if text == '' or text == self.video_obj.name: self.new_name = None @@ -34878,6 +36603,9 @@ class PrepareClipDialogue(Gtk.Dialog): def __init__(self, main_win_obj, video_obj=None): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 36607 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Create video clip\' dialogue starts' \ + ' here. In the Videos tab, right-click a video and select' \ @@ -35349,6 +37077,9 @@ def set_bold_button_text(self, button, text): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37081 set_bold_button_text') + for child in button.get_children(): child.set_label('' + text + '') child.set_use_markup(True) @@ -35362,6 +37093,9 @@ def update_treeview(self): config.VideoEditWin.setup_timestamps_tab_update_treeview(). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37097 update_treeview') + self.timestamp_liststore.clear() if self.video_obj is not None: @@ -35408,6 +37142,9 @@ def on_add_stamp_button_clicked(self, button, entry, entry2, entry3): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37146 on_add_stamp_button_clicked') + app_obj = self.main_win_obj.app_obj start_stamp = utils.strip_whitespace(entry.get_text()) @@ -35500,6 +37237,9 @@ def on_clear_stamp_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37241 on_clear_stamp_button_clicked') + if self.video_obj is not None: self.video_obj.reset_timestamps() else: @@ -35523,6 +37263,9 @@ def on_copy_stamp_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37267 on_copy_stamp_button_clicked') + # Open the dialogue window dialogue_win = AddStampDialogue( self, @@ -35579,6 +37322,9 @@ def on_delete_stamp_button_clicked(self, button, treeview): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37326 on_delete_stamp_button_clicked') + selection = treeview.get_selection() (model, path_list) = selection.get_selected_rows() if not path_list: @@ -35638,6 +37384,9 @@ def on_dl_all_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37388 on_dl_all_button_clicked') + self.dl_mode = 'multiple' if self.video_obj is not None: @@ -35662,6 +37411,9 @@ def on_dl_chapters_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37415 on_dl_chapters_button_clicked') + self.dl_mode = 'chapters' self.start_dl_flag = True self.close() @@ -35679,6 +37431,9 @@ def on_dl_marked_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37435 on_dl_marked_button_clicked') + self.dl_mode = 'multiple' self.stamp_list = [] @@ -35718,6 +37473,9 @@ def on_dl_single_button_clicked(self, button, entry, entry2, entry3): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37477 on_dl_single_button_clicked') + self.dl_mode = 'single' # (First entry is compulsory, others are optional; but timestamps must @@ -35755,6 +37513,9 @@ def on_extract_stamp_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37517 on_extract_stamp_button_clicked') + self.video_obj.extract_timestamps_from_descrip( self.main_win_obj.app_obj, ) @@ -35774,6 +37535,9 @@ def on_optional_entry_changed(self, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37539 on_optional_entry_changed') + text = entry.get_text() if text == '': self.classic_video_name = None @@ -35793,6 +37557,9 @@ def on_prefs_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37561 on_prefs_button_clicked') + # N.B. Destroy this window before opening the preferences window, or # the latter will be hidden behind the main window # N.B. If we don't destroy this window first, the preferences window is @@ -35813,6 +37580,9 @@ def on_radiobutton_toggled(self, radiobutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37584 on_radiobutton_toggled') + if radiobutton.get_active(): self.clip_mode = 'downloader' @@ -35843,6 +37613,9 @@ def on_radiobutton2_toggled(self, radiobutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37617 on_radiobutton2_toggled') + if radiobutton.get_active(): self.clip_mode = 'ffmpeg' @@ -35872,6 +37645,9 @@ def on_radiobutton3_toggled(self, radiobutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37649 on_radiobutton3_toggled') + if radiobutton.get_active(): self.clip_mode = 'create' self.dl_mode = None @@ -35899,6 +37675,9 @@ def on_select_all_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37679 on_select_all_button_clicked') + for path in range(0, len(self.timestamp_liststore)): self.timestamp_liststore[path][0] = True @@ -35915,6 +37694,9 @@ def on_select_none_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37698 on_select_none_button_clicked') + for path in range(0, len(self.timestamp_liststore)): self.timestamp_liststore[path][0] = False @@ -35935,6 +37717,9 @@ def on_start_entry_changed(self, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37721 on_start_entry_changed') + text = entry.get_text() if text == '': self.button.set_sensitive(False) @@ -35956,6 +37741,9 @@ def on_treeview_button_toggled(self, renderer_toggle, tree_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37745 on_treeview_button_toggled') + self.timestamp_liststore[tree_path][0] \ = not self.timestamp_liststore[tree_path][0] @@ -35972,6 +37760,9 @@ def on_url_entry_changed(self, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37764 on_url_entry_changed') + text = entry.get_text() if text == '': self.classic_url = None @@ -36000,6 +37791,9 @@ class PrepareSliceDialogue(Gtk.Dialog): def __init__(self, main_win_obj, video_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 37795 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Remove video slices\' dialogue starts' \ + ' here. In the Videos tab, right-click a video and select' \ @@ -36442,6 +38236,9 @@ def set_bold_button_text(self, button, text): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38240 set_bold_button_text') + for child in button.get_children(): child.set_label('' + text + '') child.set_use_markup(True) @@ -36455,6 +38252,9 @@ def update_treeview(self): config.VideoEditWin.setup_slices_tab_update_treeview(). """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 28256 update_treeview') + self.slice_liststore.clear() # Add each timestamp/title to the treeview, one row at a time @@ -36508,6 +38308,9 @@ def on_add_slice_button_clicked(self, button, combo, combo2, entry, """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38312 on_add_slice_button_clicked') + app_obj = self.main_win_obj.app_obj tree_iter = combo.get_active_iter() @@ -36594,6 +38397,9 @@ def on_clear_slice_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38401 on_clear_slice_button_clicked') + self.video_obj.reset_slices() self.update_treeview() @@ -36612,6 +38418,9 @@ def on_contact_sblock_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38422 on_contact_sblock_clicked') + utils.fetch_slice_data( self.main_win_obj.app_obj, self.video_obj, @@ -36636,6 +38445,9 @@ def on_delete_slice_button_clicked(self, button, treeview): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38449 on_delete_slice_button_clicked') + selection = treeview.get_selection() (model, path_list) = selection.get_selected_rows() if not path_list: @@ -36688,6 +38500,9 @@ def on_dl_all_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38504 on_dl_all_button_clicked') + self.dl_mode = 'multiple' self.slice_list = self.video_obj.slice_list.copy() @@ -36708,6 +38523,9 @@ def on_dl_marked_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38527 on_dl_marked_button_clicked') + self.dl_mode = 'multiple' self.slice_list = [] @@ -36738,6 +38556,9 @@ def on_dl_single_button_clicked(self, button, entry, entry2): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38560 on_dl_single_button_clicked') + self.dl_mode = 'single' # First entry is compulsory, second is optional @@ -36768,6 +38589,9 @@ def on_prefs_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38593 on_prefs_button_clicked') + # N.B. Destroy this window before opening the preferences window, or # the latter will be hidden behind the main window # N.B. If we don't destroy this window first, the preferences window is @@ -36788,6 +38612,9 @@ def on_radiobutton_toggled(self, radiobutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38616 on_radiobutton_toggled') + if radiobutton.get_active(): self.slice_mode = 'ffmpeg' @@ -36820,6 +38647,9 @@ def on_radiobutton2_toggled(self, radiobutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38651 on_radiobutton2_toggled') + if radiobutton.get_active(): self.slice_mode = 'create' self.dl_mode = None @@ -36853,6 +38683,9 @@ def on_select_all_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38687 on_select_all_button_clicked') + for path in range(0, len(self.slice_liststore)): self.slice_liststore[path][0] = True @@ -36869,6 +38702,9 @@ def on_select_none_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38706 on_select_none_button_clicked') + for path in range(0, len(self.slice_liststore)): self.slice_liststore[path][0] = False @@ -36889,6 +38725,9 @@ def on_start_entry_changed(self, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38729 on_start_entry_changed') + text = entry.get_text() if text == '': self.button.set_sensitive(False) @@ -36910,6 +38749,9 @@ def on_treeview_button_toggled(self, renderer_toggle, tree_path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38753 on_treeview_button_toggled') + self.slice_liststore[tree_path][0] \ = not self.slice_liststore[tree_path][0] @@ -36935,6 +38777,9 @@ class RecentVideosDialogue(Gtk.Dialog): def __init__(self, main_win_obj, media_data_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38781 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Set removal time\' dialogue starts here.' \ + ' In the Videos tab, right-click the \'Recent Videos\'' \ @@ -37042,6 +38887,9 @@ def on_radiobutton_toggled(self, radiobutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38891 on_radiobutton_toggled') + if radiobutton.get_active(): self.spinbutton.set_sensitive(False) else: @@ -37071,6 +38919,9 @@ class RemoveLockFileDialogue(Gtk.Dialog): def __init__(self, main_win_obj, switch_flag): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 38923 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Stale lockfile\' dialogue starts here.' \ + ' Visible on startup if the Tartube database file is protected' \ @@ -37192,6 +39043,9 @@ def on_yes_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39047 on_yes_button_clicked') + self.remove_flag = True self.destroy() @@ -37209,6 +39063,9 @@ def on_no_button_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39067 on_no_button_clicked') + self.remove_flag = False self.destroy() @@ -37235,6 +39092,9 @@ class RenameContainerDialogue(Gtk.Dialog): def __init__(self, main_win_obj, media_data_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39096 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Rename container\' dialogue starts here.' \ + ' In the Videos tab, right-click a channel and select' \ @@ -37330,6 +39190,9 @@ class ResetContainerDialogue(Gtk.Dialog): def __init__(self, main_win_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39194 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Create profile\' dialogue starts here.' \ + ' In the main window menu, click Media > Reset channel/' \ @@ -37534,6 +39397,9 @@ def on_checkbutton_toggled(self, checkbutton, path): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39401 on_checkbutton_toggled') + # The user has clicked on the checkbutton widget, so toggle the widget # itself self.liststore[path][0] = not self.liststore[path][0] @@ -37563,6 +39429,9 @@ def on_original_name_edited(self, widget, path, text): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39433 on_original_name_edited') + app_obj = self.main_win_obj.app_obj # Check the entered text is a valid name @@ -37610,6 +39479,9 @@ def on_select_all_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39483 on_select_all_clicked') + for path in range(0, len(self.liststore)): self.liststore[path][0] = True self.reset_dict[self.liststore[path][4]] = True @@ -37627,6 +39499,9 @@ def on_deselect_all_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39503 on_deselect_all_clicked') + for path in range(0, len(self.liststore)): self.liststore[path][0] = False self.reset_dict[self.liststore[path][4]] = False @@ -37658,6 +39533,9 @@ class ScheduledDialogue(Gtk.Dialog): def __init__(self, main_win_obj, media_data_obj, available_list): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39537 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Add to scheduled download\' dialogue' \ + ' starts here. In the Videos tab, right-click a channel and' \ @@ -37752,6 +39630,9 @@ def on_combo_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39634 on_combo_changed') + tree_iter = combo.get_active_iter() model = combo.get_model() self.choice = model[tree_iter][0] @@ -37779,6 +39660,9 @@ class SetDestinationDialogue(Gtk.Dialog): def __init__(self, main_win_obj, media_data_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 39664 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Set download destination\' dialogue' \ + ' starts here. In the Videos tab, right-click a channel and' \ @@ -38118,6 +40002,9 @@ def on_button_clicked(self, button, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40006 on_button_clicked') + # Import the main application (for convenience) app_obj = self.main_win_obj.app_obj @@ -38187,6 +40074,9 @@ def on_combo_changed(self, combo): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40078 on_combo_changed') + tree_iter = combo.get_active_iter() model = combo.get_model() dbid = model[tree_iter][1] @@ -38218,6 +40108,9 @@ def on_radiobutton_toggled(self, radiobutton, combo, button, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40112 on_radiobutton_toggled') + if radiobutton.get_active(): combo.set_sensitive(False) button.set_sensitive(False) @@ -38245,6 +40138,9 @@ def on_radiobutton2_toggled(self, radiobutton2, combo, button, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40142 on_radiobutton2_toggled') + if radiobutton2.get_active(): combo.set_sensitive(True) button.set_sensitive(False) @@ -38281,6 +40177,9 @@ def on_radiobutton3_toggled(self, radiobutton2, combo, button, entry): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40181 on_radiobutton3_toggled') + if radiobutton2.get_active(): combo.set_sensitive(False) button.set_sensitive(True) @@ -38319,6 +40218,9 @@ class SetNicknameDialogue(Gtk.Dialog): def __init__(self, main_win_obj, media_data_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40222 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Set nickname\' dialogue starts here.' \ + ' In the Videos tab, right-click a channel and select' \ @@ -38420,6 +40322,9 @@ class SetURLDialogue(Gtk.Dialog): def __init__(self, main_win_obj, media_data_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40326 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Set URL\' dialogue starts here.' \ + ' In the Videos tab, right-click a channel and select' \ @@ -38516,6 +40421,9 @@ class SystemCmdDialogue(Gtk.Dialog): def __init__(self, main_win_obj, media_data_obj): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40425 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Show system command\' dialogue starts' \ + ' here. In the Videos tab, right-click a channel and select' \ @@ -38630,6 +40538,9 @@ def update_textbuffer(self, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40542 update_textbuffer') + # Get the options.OptionsManager object that applies to this media # data object # (The manager might be specified by obj itself, or it might be @@ -38677,6 +40588,9 @@ def on_copy_clicked(self, button, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40592 on_copy_clicked') + # Obtain the system command used to download this media data object, # and display it in the textbuffer system_cmd = self.update_textbuffer(media_data_obj) @@ -38702,6 +40616,9 @@ def on_update_clicked(self, button, media_data_obj): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40620 on_update_clicked') + # Obtain the system command used to download this media data object, # and display it in the textbuffer self.update_textbuffer(media_data_obj) @@ -38731,6 +40648,9 @@ class TestCmdDialogue(Gtk.Dialog): def __init__(self, main_win_obj, source_url=None): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40652 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Test youtube-dl\' dialogue starts here.' \ + ' In the main window menu, click Operations > Test youtube-dl' @@ -38835,6 +40755,9 @@ class TidyDialogue(Gtk.Dialog): def __init__(self, main_win_obj, media_data_obj=None): + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40759 __init__') + ignore_me = _( 'TRANSLATOR\'S NOTE: \'Tidy up\' dialogue starts here.' \ + ' In the main window menu, click Operations > Tidy up files...' @@ -39056,6 +40979,9 @@ def on_checkbutton_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 40983 on_checkbutton_toggled') + if not checkbutton.get_active(): self.checkbutton2.set_active(False) self.checkbutton2.set_sensitive(False) @@ -39077,6 +41003,9 @@ def on_checkbutton4_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 41007 on_checkbutton4_toggled') + if not checkbutton.get_active(): self.checkbutton5.set_active(False) self.checkbutton5.set_sensitive(False) @@ -39098,6 +41027,9 @@ def on_checkbutton9_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 41031 on_checkbutton9_toggled') + if not checkbutton.get_active(): self.checkbutton10.set_sensitive(True) self.checkbutton11.set_sensitive(True) @@ -39125,6 +41057,9 @@ def on_checkbutton10_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 41061 on_checkbutton10_toggled') + if not checkbutton.get_active(): self.checkbutton11.set_sensitive(True) self.checkbutton12.set_sensitive(True) @@ -39149,6 +41084,9 @@ def on_checkbutton11_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 41088 on_checkbutton11_toggled') + if not checkbutton.get_active(): self.checkbutton12.set_sensitive(True) @@ -39170,6 +41108,9 @@ def on_checkbutton13_toggled(self, checkbutton): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 41112 on_checkbutton13_toggled') + if not checkbutton.get_active(): self.checkbutton14.set_sensitive(True) @@ -39199,6 +41140,9 @@ def on_select_all_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 41144 on_select_all_clicked') + self.checkbutton.set_active(True) self.checkbutton2.set_active(True) self.checkbutton3.set_active(True) @@ -39230,6 +41174,9 @@ def on_select_none_clicked(self, button): """ + if DEBUG_FUNC_FLAG: + utils.debug_time('mwn 41178 on_select_none_clicked') + self.checkbutton.set_active(False) self.checkbutton2.set_active(False) self.checkbutton3.set_active(False) diff --git a/tartube/tartube b/tartube/tartube index fc39b5d..37253ee 100644 --- a/tartube/tartube +++ b/tartube/tartube @@ -44,8 +44,8 @@ import mainapp # 'Global' variables __packagename__ = 'tartube' -__version__ = '2.4.433' -__date__ = '22 Nov 2023' +__version__ = '2.4.438' +__date__ = '29 Dec 2023' __copyright__ = 'Copyright \xa9 2019-2023 A S Lewis' __license__ = """ Copyright \xa9 2019-2023 A S Lewis. diff --git a/tartube/utils.py b/tartube/utils.py index 1f3b5db..dff5c1c 100644 --- a/tartube/utils.py +++ b/tartube/utils.py @@ -1485,6 +1485,34 @@ def convert_youtube_to_other(app_obj, url, custom_dl_obj=None): return url +def debug_time(msg): + + """Called by all functions in downloads.py, info.py, mainapp.py, + mainwin.py, refresh.py, tidy.py and updates.py. + + Writes the current time, and the name of the calling function to STDOUT, + e.g. '2020-01-16 08:55:06 ap 91 __init__'. + + Args: + + msg (str): The message to write + + """ + + # Uncomment this code to display the time with microseconds +# print(str(datetime.datetime.now().time()) + ' ' + msg) + + # Uncomment this code to display the time without microseconds + dt = datetime.datetime.now() + print(str(dt.replace(microsecond=0)) + ' ' + msg) + + # Uncomment this code to display the message, without a timestamp +# print(msg) + + # This line makes my IDE collapse functions nicely + return + + def disk_get_free_space(path, bytes_flag=False): """Can be called by anything.