mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 07:21:28 +00:00
Compare commits
2 commits
a6bdeab60c
...
1a95d26238
Author | SHA1 | Date | |
---|---|---|---|
localhost_frssoft | 1a95d26238 | ||
localhost_frssoft | a5c5984880 |
|
@ -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]
|
||||
player_fw_storage.menu_ctx_args = [pg, search, scope, is_history_view]
|
||||
elif len(select) > 1:
|
||||
for i in select:
|
||||
play_track(track=tracks_results[int(
|
||||
|
|
|
@ -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]
|
||||
player_fw_storage.menu_ctx_args = [pg, search, tag, library]
|
||||
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()
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import src.fw_api
|
||||
from src.utils import download_track, print_there, track_info_output
|
||||
from src.utils import download_track, print_there, track_info_output, indices
|
||||
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
|
||||
|
@ -145,6 +146,12 @@ 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
|
||||
|
@ -201,7 +208,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(pg=player_fw_storage.menu_ctx_args[0])
|
||||
player_fw_storage.menu_ctx(*player_fw_storage.menu_ctx_args)
|
||||
elif select == 'Hide artist':
|
||||
track = player_fw_storage.storage.get(track_url_to_uuid())
|
||||
player.playlist_remove('current')
|
||||
|
|
|
@ -78,3 +78,8 @@ 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]
|
||||
|
|
Loading…
Reference in a new issue