From 21a0108a8233db7ad52dec8d50c5158724d02d2c Mon Sep 17 00:00:00 2001 From: imonlinux <39863321+imonlinux@users.noreply.github.com> Date: Fri, 10 Oct 2025 19:36:23 -0700 Subject: [PATCH] Indentation Bug mpv_player.py --- linux_voice_assistant/mpv_player.py | 63 +---------------------------- 1 file changed, 2 insertions(+), 61 deletions(-) diff --git a/linux_voice_assistant/mpv_player.py b/linux_voice_assistant/mpv_player.py index 5f40af7..a0a3186 100644 --- a/linux_voice_assistant/mpv_player.py +++ b/linux_voice_assistant/mpv_player.py @@ -53,12 +53,7 @@ def _select_backend( device: Optional[str], env_ao: Optional[str], ) -> Tuple[Optional[str], Optional[str]]: - """ - Decide and apply (ao, audio-device) after probing candidates in order. - - Returns: - (ao, audio_device) — the values successfully applied (or (None, None)). - """ + """Decide and apply (ao, audio-device) after probing candidates.""" ao: Optional[str] = None norm: Optional[str] = None @@ -164,58 +159,4 @@ class MpvMediaPlayer: def play( self, url: Union[str, Sequence[str], bytes], - done_callback: Optional[Callable[[], None]] = None, - stop_first: bool = False, - ) -> None: - """Begin playback of one or more URLs. Sequential playlist supported.""" - if stop_first: - try: - self.stop() - except Exception: - _LOGGER.debug("stop_first=True: stop() raised, continuing", exc_info=True) - - with self._done_callback_lock: - self._done_callback = done_callback - - # Normalize input to playlist list - if isinstance(url, (list, tuple)): - self._playlist = list(url) - elif isinstance(url, bytes): - try: - self._playlist = [url.decode("utf-8")] - except Exception: - self._playlist = [url.decode(errors="ignore")] - elif isinstance(url, str): - self._playlist = [url] - else: - _LOGGER.error("mpv play() expected str/seq/bytes, got %r", type(url)) - self._run_done_callback() - return - - if not self._playlist: - _LOGGER.error("Empty playlist; nothing to play") - self._run_done_callback() - return - - next_url = self._playlist.pop(0) - self._play_single(next_url) - - def _play_single(self, url: str) -> None: - """Internal: play one track.""" - _LOGGER.debug("Playing %s", url) - try: - self.player["mute"] = "no" - except Exception: - _LOGGER.debug("Failed to unmute before playback", exc_info=True) - - self.is_playing = True - try: - self.player.play(url) - self._arm_watchdog() - except Exception: - self.is_playing = False - _LOGGER.exception("mpv failed to play %r", url, exc_info=True) - self._run_done_callback() - - def pause(self) -> None: - try: + done_callback: Optional[Callable[[], None]()]()_