barebones shuffle button (cycle shuffle no work)

This commit is contained in:
localhost_frssoft 2023-06-15 17:43:36 +03:00
parent 38212d29b4
commit 96ce0dfb50
1 changed files with 14 additions and 4 deletions

View File

@ -23,6 +23,7 @@ player.volume = get_config('mpv_volume')
player.prefetch_playlist = get_config('prefetch_playlist')
show_like_button = get_config('show_like_button')
track_activity_history = get_config('track_activity_history')
shuffle = False
class player_fw_storage:
@ -126,14 +127,19 @@ def soft_volume_reduce():
def player_menu(header='', storage={}):
player_fw_storage.storage.update(storage)
player.volume = get_config("mpv_volume")
global shuffle
while True:
try:
player_items_menu = ['Next', 'Prev', 'Pause',
'Download', 'Info']
'Shuffle', 'Download', 'Info']
if player.pause:
player_items_menu[2] = 'Play'
else:
player_items_menu[2] = 'Pause'
if shuffle:
player_items_menu[3] = 'Unshuffle'
else:
player_items_menu[3] = 'Shuffle'
if show_like_button:
player_items_menu.append('Like')
player_items_menu.extend(['Hide artist', 'Exit'])
@ -152,10 +158,14 @@ def player_menu(header='', storage={}):
elif select == 'Prev':
player.playlist_prev()
elif select in ('Pause', 'Play'):
if player.pause:
player.pause = False
player.cycle('pause')
elif select in ('Shuffle', 'Unshuffle'):
if shuffle:
shuffle = False
player.playlist_unshuffle()
else:
player.pause = True
shuffle = True
player.playlist_shuffle()
elif select == 'Download':
name_downloaded = download_track(player.stream_open_filename)
elif select == 'Info':