Merge branch 'main' into Volume-Persistence-Across-Restarts
This commit is contained in:
1 file changed
+5
-4
@@ -3,6 +3,7 @@ import logging
|
|||||||
from typing import Union, List, Callable, Optional
|
from typing import Union, List, Callable, Optional
|
||||||
|
|
||||||
from .player.libmpv import LibMpvPlayer
|
from .player.libmpv import LibMpvPlayer
|
||||||
|
from .player.state import PlayerState
|
||||||
|
|
||||||
|
|
||||||
class MpvMediaPlayer:
|
class MpvMediaPlayer:
|
||||||
@@ -39,12 +40,12 @@ class MpvMediaPlayer:
|
|||||||
self._log.debug("Received URL list, using first entry")
|
self._log.debug("Received URL list, using first entry")
|
||||||
url = url[0]
|
url = url[0]
|
||||||
|
|
||||||
# Track is changing
|
# Track is changing - only stop for replacement if actually playing
|
||||||
if self._done_callback is not None:
|
if self._done_callback is not None:
|
||||||
|
if self._player.state() != PlayerState.IDLE:
|
||||||
self._log.debug(
|
self._log.debug(
|
||||||
"Stopping active playback before starting new media"
|
"Stopping active playback before starting new media"
|
||||||
)
|
)
|
||||||
# Not self.stop() → this would call done_callback
|
|
||||||
self._player.stop(for_replacement=True)
|
self._player.stop(for_replacement=True)
|
||||||
self._done_callback = None
|
self._done_callback = None
|
||||||
|
|
||||||
@@ -87,7 +88,7 @@ class MpvMediaPlayer:
|
|||||||
Set playback volume.
|
Set playback volume.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
volume: Volume in percent (0.0–100.0).
|
volume: Volume in percent (0.0-100.0).
|
||||||
"""
|
"""
|
||||||
self._log.debug("set_volume(volume=%.2f)", volume)
|
self._log.debug("set_volume(volume=%.2f)", volume)
|
||||||
self._player.set_volume(volume)
|
self._player.set_volume(volume)
|
||||||
@@ -97,7 +98,7 @@ class MpvMediaPlayer:
|
|||||||
Temporarily reduce volume.
|
Temporarily reduce volume.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
factor: Volume multiplier (0.0–1.0).
|
factor: Volume multiplier (0.0-1.0).
|
||||||
"""
|
"""
|
||||||
self._log.debug("duck(factor=%.2f)", factor)
|
self._log.debug("duck(factor=%.2f)", factor)
|
||||||
self._player.duck(factor)
|
self._player.duck(factor)
|
||||||
|
|||||||
Reference in new issue
Block a user