filter_path = FilterStr(params.single_value('filter_path'))
filter_tags = FilterStr(params.single_value('filter_tags'))
if self.server.player.empty or filter_path or filter_tags:
- self.server.player.load_files(filter_path, filter_tags)
+ self.server.player.load_files_and_start(filter_path, filter_tags)
current_file, unused_tags = None, set()
with DbConn() as conn:
if self.server.player.current_file_digest:
def __init__(self) -> None:
self.last_update = PlayerUpdateId('')
- self.load_files()
self._mpv: Optional[MPV] = None
self._kill_queue: Queue = Queue()
self._monitoring_kill = False
+ self.load_files_and_start()
def _monitor_kill(self) -> None:
"""Properly enforce mpv shutdown from direct interaction with mpv
Thread(target=kill_on_queue_get, daemon=True).start()
- def load_files(self,
- filter_path: FilterStr = FilterStr(''),
- filter_tags: FilterStr = FilterStr('')
- ) -> None:
- """Collect files in PATH_DOWNLOADS DB-known and of legal extension."""
+ def load_files_and_start(self,
+ filter_path: FilterStr = FilterStr(''),
+ filter_tags: FilterStr = FilterStr('')
+ ) -> None:
+ """Collect filtered files into playlist, start player."""
with DbConn() as conn:
known_files = {
f.full_path: f for f
and p.suffix[1:] in LEGAL_EXTENSIONS]
shuffle(self.files)
self._idx = 0
+ self._start_mpv()
def _signal_update(self) -> None:
self.last_update = PlayerUpdateId(f'{self._idx}:{time()}')