def start_clean_kodi_library(self): if not self.scan_in_progress and not self.clean_in_progress: LOG.debug('Start Kodi library clean') self.clean_in_progress = True # Set as in progress (avoid wait "started" callback it comes late) self.clean_awaiting = False common.clean_library(False, get_library_path()) else: self.clean_awaiting = True
def start_update_kodi_library(self): if not self.scan_in_progress and not self.clean_in_progress: common.debug('Start Kodi library scan') self.scan_in_progress = True # Set as in progress (avoid wait "started" callback it comes late) self.scan_awaiting = False # Update only the library elements in the add-on export folder # for faster processing (on Kodi 18.x) with a large library common.scan_library(makeLegalFilename(xbmc.translatePath(get_library_path()))) else: self.scan_awaiting = True
def clear_library(self, show_prg_dialog=True): """ Delete all exported items to the library :param show_prg_dialog: if True, will be show a progress dialog window """ LOG.info('Start deleting exported library items') # This will clear all the add-on library data, to prevents possible inconsistencies when for some reason # such as improper use of the add-on, unexpected error or other has broken the library database data or files with ui.ProgressDialog(show_prg_dialog, common.get_local_string(30245), max_value=3) as progress_dlg: progress_dlg.perform_step() progress_dlg.set_wait_message() G.SHARED_DB.purge_library() for folder_name in [FOLDER_NAME_MOVIES, FOLDER_NAME_SHOWS]: progress_dlg.perform_step() progress_dlg.set_wait_message() section_root_dir = common.join_folders_paths( get_library_path(), folder_name) common.delete_folder_contents(section_root_dir, delete_subfolders=True) # Clean the Kodi library database common.clean_library(show_prg_dialog, get_library_path())
def _execute_job(self, job_handler, job_data, list_errors): if not job_data: # No metadata or unexpected job case return try: job_handler(job_data, get_library_path()) except Exception as exc: # pylint: disable=broad-except import traceback LOG.error(traceback.format_exc()) LOG.error('{} of {} ({}) failed', job_handler.__name__, job_data['videoid'], job_data['title']) list_errors.append({ 'title': job_data['title'], 'error': f'{type(exc).__name__}: {exc}' })
def _execute_job(self, job_handler, job_data, list_errors): if not job_data: # No metadata or unexpected job case return try: job_handler(job_data, get_library_path()) except Exception as exc: # pylint: disable=broad-except import traceback common.error(G.py2_decode(traceback.format_exc(), 'latin-1')) common.error('{} of {} ({}) failed', job_handler.__name__, job_data['videoid'], job_data['title']) list_errors.append({ 'title': job_data['title'], 'error': '{}: {}'.format(type(exc).__name__, exc) })