mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-28 08:31:28 +00:00
soft volume reduce before shutdown player
This commit is contained in:
parent
610fc8f1f3
commit
17229d48b8
|
@ -2,7 +2,7 @@ from src.fw_api import current_instance, get_radios, post_radio_session, get_tra
|
|||
from src.fw_libraries import libraries
|
||||
from src.fw_tags import list_tags
|
||||
from src.utils import download_track, track_info_output
|
||||
from src.mpv_control import player, track_url_to_uuid, player_fw_storage
|
||||
from src.mpv_control import player, track_url_to_uuid, player_fw_storage, soft_volume_reduce
|
||||
from src.settings import get_config
|
||||
from pyfzf.pyfzf import FzfPrompt
|
||||
from loguru import logger
|
||||
|
@ -160,6 +160,7 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non
|
|||
except:
|
||||
logger.exception('Error stopping Thread radio generator')
|
||||
pass
|
||||
soft_volume_reduce()
|
||||
player.playlist_clear()
|
||||
player.stop()
|
||||
player_fw_storage.storage = {}
|
||||
|
|
|
@ -115,6 +115,12 @@ def universal_observer(_name, value):
|
|||
time.sleep(1)
|
||||
|
||||
|
||||
def soft_volume_reduce():
|
||||
while player.volume > 10:
|
||||
player.volume = player.volume - 1
|
||||
time.sleep(0.050)
|
||||
|
||||
|
||||
@logger.catch
|
||||
def player_menu(header='', storage={}):
|
||||
player_fw_storage.storage.update(storage)
|
||||
|
@ -159,6 +165,7 @@ def player_menu(header='', storage={}):
|
|||
src.fw_api.hide_content(
|
||||
{'target': {'id': track.get('artist').get('id'), 'type': 'artist'}})
|
||||
elif select == 'Exit':
|
||||
soft_volume_reduce()
|
||||
player.playlist_clear()
|
||||
player.stop()
|
||||
player_fw_storage.storage = {}
|
||||
|
|
Loading…
Reference in a new issue