Compare commits

..

No commits in common. "1a95d262381d68d0b1af423bce116c335eade8a5" and "a6bdeab60ca09c7741750cbc0081f411f3cdea3b" have entirely different histories.

4 changed files with 4 additions and 16 deletions

View File

@ -48,7 +48,7 @@ def list_fav_or_history(pg=None, search=None, scope=None, is_history_view=False)
for i in tracks_results:
play_track(track=i['track'], multi=True)
player_fw_storage.menu_ctx = list_fav_or_history
player_fw_storage.menu_ctx_args = [pg, search, scope, is_history_view]
player_fw_storage.menu_ctx_args = [pg]
elif len(select) > 1:
for i in select:
play_track(track=tracks_results[int(

View File

@ -49,7 +49,7 @@ def list_tracks(pg=None, search=None, tag=None, library=None):
for i in tracks_results:
play_track(track=i, multi=True)
player_fw_storage.menu_ctx = list_tracks
player_fw_storage.menu_ctx_args = [pg, search, tag, library]
player_fw_storage.menu_ctx_args = [pg]
elif select == 'Play all pages':
if tracks_count > 500:
yn = input('WARNING: you really want add more than 500 tracks? (y/[n] or number of tracks)\n').lower()

View File

@ -1,11 +1,10 @@
import src.fw_api
from src.utils import download_track, print_there, track_info_output, indices
from src.utils import download_track, print_there, track_info_output
from src.settings import get_config
from loguru import logger
from pyfzf.pyfzf import FzfPrompt
from shutil import get_terminal_size
from shlex import quote
from contextlib import suppress
import mpv
import time
import re
@ -146,12 +145,6 @@ def soft_volume_reduce():
@logger.catch
def player_menu(header='', storage={}):
for i in player.playlist_filenames:
count_same_tracks = indices(player.playlist_filenames, i)
while len(count_same_tracks) > 1:
with suppress(SystemError):
player.playlist_remove(count_same_tracks[-1])
count_same_tracks = indices(player.playlist_filenames, i)
player_fw_storage.storage.update(storage)
player.volume = get_config("mpv_volume")
global shuffle
@ -208,7 +201,7 @@ def player_menu(header='', storage={}):
src.fw_api.favorite_track(
player_fw_storage.storage.get(track_url_to_uuid())['id'])
elif select == 'Add more tracks':
player_fw_storage.menu_ctx(*player_fw_storage.menu_ctx_args)
player_fw_storage.menu_ctx(pg=player_fw_storage.menu_ctx_args[0])
elif select == 'Hide artist':
track = player_fw_storage.storage.get(track_url_to_uuid())
player.playlist_remove('current')

View File

@ -78,8 +78,3 @@ def track_info_output(track):
output.append('Failed get related')
output = '\n'.join(output)
os.system(f'less <<EOF\n{output}\nEOF')
def indices(lst, item):
'''https://ao.phreedom.club/questions/5419204/index-of-duplicates-items-in-a-python-list'''
return [i for i, x in enumerate(lst) if x == item]