def create_backup_file_list(self): ''' creates a list of the items to back-up ''' kodi_folder = self.kodi_location() backup_candidates = [] for setting, location in LOCATIONS.iteritems(): if self.s[setting]: # if the user is backing up guisettings.xml, then call for the settings to be saved using # custom method if setting == 'backup_guisettings': log('Trying to backup guisettings, running xbmc.saveSettings') try: xbmc.saveSettings() except Exception as e: log('xbmc.saveSetting failed') log(type(e).__name__) log(e.args) log(traceback.format_exc()) path = location.format(kodi_folder=kodi_folder) size = self.calculate_byte_size(path) backup_candidates.append((path, size)) return backup_candidates
def create_backup_file_list(self): """ creates a list of the items to back-up """ kodi_folder = self.kodi_location() backup_candidates = [] locations = list(deepcopy(LOCATIONS).items()) if self.settings_dict['backup_autofs']: # expand autofs files locations = [(setting, destination_file) for setting, destination_file in locations if setting != 'backup_autofs'] locations += [('backup_autofs', destination_file) for destination_file in AUTOFS_DEST_FILES] for setting, location in locations: if self.settings_dict[setting]: # if the user is backing up guisettings.xml, then call for the settings to be saved using # custom method if setting == 'backup_guisettings': log('Trying to backup guisettings, running xbmc.saveSettings') try: xbmc.saveSettings() except Exception as e: log('xbmc.saveSetting failed') log(type(e).__name__) log(e.args) log(traceback.format_exc()) path = location.format(kodi_folder=kodi_folder) size = self.calculate_byte_size(path) backup_candidates.append((path, size)) return backup_candidates