Add linting scripts and pipeline (#201)
* Add linting scripts and pipeline
This commit is contained in:
1 parent
5b1d3b75e2
commit
1fc29241b4
24 files changed
+525
-310
No files matched your search
@@ -1,11 +1,11 @@
|
||||
import logging
|
||||
import threading
|
||||
from typing import Optional, Callable
|
||||
from typing import Callable, Optional
|
||||
|
||||
import mpv
|
||||
|
||||
from .base import AudioPlayer
|
||||
from .state import PlayerState
|
||||
from linux_voice_assistant.player.base import AudioPlayer
|
||||
from linux_voice_assistant.player.state import PlayerState
|
||||
|
||||
|
||||
class LibMpvPlayer(AudioPlayer):
|
||||
@@ -24,8 +24,8 @@ class LibMpvPlayer(AudioPlayer):
|
||||
self._state_lock = threading.Lock()
|
||||
|
||||
# Volume handling
|
||||
self._user_volume: float = 100.0 # 0.0 – 100.0
|
||||
self._duck_factor: float = 1.0 # 0.0 – 1.0
|
||||
self._user_volume: float = 100.0 # 0.0 – 100.0
|
||||
self._duck_factor: float = 1.0 # 0.0 – 1.0
|
||||
|
||||
# mpv setup
|
||||
self._mpv = mpv.MPV(
|
||||
@@ -146,11 +146,11 @@ class LibMpvPlayer(AudioPlayer):
|
||||
# The reason is an integer constant (see mpv.END_FILE_REASON_*)
|
||||
end_file_data = event.data
|
||||
reason = getattr(end_file_data, "reason", -1) if end_file_data else -1
|
||||
|
||||
|
||||
# mpv END_FILE_REASON constants:
|
||||
# 0 = eof (end of file), 1 = stop, 2 = abort, 3 = quit, 4 = error
|
||||
is_eof = (reason == 0)
|
||||
|
||||
is_eof = reason == 0
|
||||
|
||||
self._log.debug(
|
||||
"_on_end_file: reason=%s (is_eof=%s), state=%s, has_callback=%s",
|
||||
reason,
|
||||
@@ -158,7 +158,7 @@ class LibMpvPlayer(AudioPlayer):
|
||||
self._state,
|
||||
self._done_callback is not None,
|
||||
)
|
||||
|
||||
|
||||
# Only process "eof" (reason=0) events as actual track completion.
|
||||
# Other reasons are from track changes, stops, or errors.
|
||||
if not is_eof:
|
||||
@@ -196,4 +196,4 @@ class LibMpvPlayer(AudioPlayer):
|
||||
|
||||
def _set_state(self, new_state: PlayerState) -> None:
|
||||
"""Update internal player state."""
|
||||
self._state = new_state
|
||||
self._state = new_state
|
||||
Reference in new issue
Block a user