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

View file

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