def __destroy(self): config.save() new_dirs = set(get_scan_dirs()) gone_dirs = set(self.current_scan_dirs) - new_dirs if new_dirs - set(self.current_scan_dirs): print_d("Library paths have been added, re-scanning...") scan_library(app.library, force=False) elif gone_dirs: copool.add(app.librarian.remove_roots, gone_dirs)
def plugin_on_changed(self, songs): song = songs[0] current_location = song("~filename") file_split = os.path.splitext(current_location) file_extension = file_split[1] psbl_new_location = os.path.abspath( os.path.expanduser((Pattern(self.config_get(self.CFG_PAT_PLAYING, self.DEFAULT_PAT)) % song) + file_extension)) if(not(psbl_new_location == re.sub(" \\([0-9]+\\)$", "", file_split[0]) + file_extension)): dirname = os.path.dirname(psbl_new_location) if not os.path.exists(dirname): os.makedirs(dirname) if os.path.isfile(psbl_new_location): num_to_use = 1 start_with = os.path.splitext( os.path.basename(psbl_new_location))[0] length_chk = len(start_with) + 2 for f in sorted(os.listdir(dirname)): if f.startswith(start_with): temporary = f[length_chk:] if temporary[:temporary.find(")")] == str(num_to_use): num_to_use += 1 psbl_new_location = os.path.join(dirname, start_with + " (" + str(num_to_use) + ")" + file_extension) try: shutil.move(current_location, os.path.normpath(psbl_new_location)) self.removeEmptyDirs(os.path.dirname(current_location)) scan_library(app.library, False) except Exception:
def __destroy(self): config.write(const.CONFIG) if self.current_scan_dirs != get_scan_dirs(): scan_library(app.library, force=False)
def reload_cb(button): scan_library(app.library, force=True)
def refresh_cb(button): scan_library(app.library, force=False)
def _refresh(app): scan_library(app.library, False)
def __destroy(self): config.save() if self.current_scan_dirs != get_scan_dirs(): scan_library(app.library, force=False)
def __rebuild(self, activator, force): scan_library(self.__library, force)
def __destroy(self): config.save() if self.current_scan_dirs != get_scan_dirs(): print_d("Library paths have changed, re-scanning...") scan_library(app.library, force=False)