mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 15:59:21 +02:00
Like button (optional configurable)
This commit is contained in:
parent
93380080d0
commit
327dae09da
|
@ -10,7 +10,7 @@ fzf = FzfPrompt()
|
|||
player = mpv.MPV()
|
||||
player.ytdl = False # Prevent attempts load track with yt-dlp
|
||||
player.prefetch_playlist = get_config('prefetch_playlist') # Fast loading next track, but high network traffic
|
||||
|
||||
show_like_button = get_config('show_like_button')
|
||||
|
||||
def set_http_header(headers=[]):
|
||||
player.http_header_fields = headers
|
||||
|
@ -20,7 +20,13 @@ def set_http_header(headers=[]):
|
|||
def player_menu(header=None, storage={}):
|
||||
while True:
|
||||
try:
|
||||
select = fzf.prompt(('Next', 'Prev', 'Pause', 'Download', 'Info', 'Hide artist', 'Exit'), f"--header=\'{header}\'")[0]
|
||||
player_items_menu = ['Next', 'Prev', 'Pause',
|
||||
'Download', 'Info']
|
||||
if show_like_button:
|
||||
player_items_menu.append('Like')
|
||||
player_items_menu.extend(['Hide artist', 'Exit'])
|
||||
|
||||
select = fzf.prompt(player_items_menu, f"--header=\'{header}\'")[0]
|
||||
if select == 'Next':
|
||||
player.playlist_next()
|
||||
elif select == 'Prev':
|
||||
|
@ -46,6 +52,8 @@ def player_menu(header=None, storage={}):
|
|||
if key and isinstance(key, str):
|
||||
print(i + ': ' + key)
|
||||
input()
|
||||
elif select == 'Like':
|
||||
src.fw_api.favorite_track(storage.get(player.filename).get('id'))
|
||||
elif select == 'Hide artist':
|
||||
track = storage.get(player.filename)
|
||||
src.fw_api.hide_content({'target': {'id': track.get('artist').get('id'), 'type': 'artist'}})
|
||||
|
|
|
@ -38,7 +38,8 @@ default_conf = {
|
|||
"funkwhale.gegeweb.eu",
|
||||
"shitnoise.monster"
|
||||
],
|
||||
'prefetch_playlist': True
|
||||
'prefetch_playlist': True,
|
||||
'show_like_button': True
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue