def setUp(self): self.audio = dummy_audio.create_proxy() self.backend = actor.LocalBackend.start(config=self.config, audio=self.audio).proxy() self.core = core.Core.start(audio=self.audio, backends=[self.backend], config=self.config).proxy() self.library = self.backend.library self.storage = storage.LocalStorageProvider(self.config) self.storage.load()
def run(self, args, config): media_dir = pathlib.Path(config["local"]["media_dir"]).resolve() library = storage.LocalStorageProvider(config) file_mtimes = self._find_files( media_dir=media_dir, follow_symlinks=config["local"]["scan_follow_symlinks"], ) files_to_update, files_in_library = self._check_tracks_in_library( media_dir=media_dir, file_mtimes=file_mtimes, library=library, force_rescan=args.force, force_selected=[ pathlib.Path(path).resolve().as_posix() for path in args.force_selected ], ) files_to_update.update( self._find_files_to_scan( media_dir=media_dir, file_mtimes=file_mtimes, files_in_library=files_in_library, included_file_exts=[ file_ext.lower() for file_ext in config["local"]["included_file_extensions"] ], excluded_file_exts=[ file_ext.lower() for file_ext in config["local"]["excluded_file_extensions"] ], )) logger.info( f"Found {len(files_to_update)} tracks which need to be updated") self._scan_metadata( media_dir=media_dir, file_mtimes=file_mtimes, files=files_to_update, library=library, timeout=config["local"]["scan_timeout"], flush_threshold=config["local"]["scan_flush_threshold"], limit=args.limit, ) library.close() return 0
def run(self, args, config): library = storage.LocalStorageProvider(config) prompt = "Are you sure you want to clear the library? [y/N] " if input(prompt).lower() != "y": print("Clearing library aborted") return 0 if library.clear(): print("Library successfully cleared") return 0 print("Unable to clear library") return 1
def run(self, args, config): media_dir = pathlib.Path(config["local"]["media_dir"]).resolve() library = storage.LocalStorageProvider(config) file_mtimes = self._find_files( media_dir=media_dir, follow_symlinks=config["local"]["scan_follow_symlinks"], ) files_to_update, files_in_library = self._check_tracks_in_library( media_dir=media_dir, file_mtimes=file_mtimes, library=library, force_rescan=args.force, ) files_to_update.update( self._find_files_to_scan( media_dir=media_dir, file_mtimes=file_mtimes, files_in_library=files_in_library, excluded_file_exts=[ file_ext.lower() for file_ext in config["local"]["excluded_file_extensions"] ], ) ) self._scan_metadata( media_dir=media_dir, file_mtimes=file_mtimes, files=files_to_update, library=library, timeout=config["local"]["scan_timeout"], flush_threshold=config["local"]["scan_flush_threshold"], limit=args.limit, ) library.close() return 0