mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 20:39:20 +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 = mpv.MPV()
|
||||||
player.ytdl = False # Prevent attempts load track with yt-dlp
|
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
|
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=[]):
|
def set_http_header(headers=[]):
|
||||||
player.http_header_fields = headers
|
player.http_header_fields = headers
|
||||||
|
@ -20,7 +20,13 @@ def set_http_header(headers=[]):
|
||||||
def player_menu(header=None, storage={}):
|
def player_menu(header=None, storage={}):
|
||||||
while True:
|
while True:
|
||||||
try:
|
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':
|
if select == 'Next':
|
||||||
player.playlist_next()
|
player.playlist_next()
|
||||||
elif select == 'Prev':
|
elif select == 'Prev':
|
||||||
|
@ -46,6 +52,8 @@ def player_menu(header=None, storage={}):
|
||||||
if key and isinstance(key, str):
|
if key and isinstance(key, str):
|
||||||
print(i + ': ' + key)
|
print(i + ': ' + key)
|
||||||
input()
|
input()
|
||||||
|
elif select == 'Like':
|
||||||
|
src.fw_api.favorite_track(storage.get(player.filename).get('id'))
|
||||||
elif select == 'Hide artist':
|
elif select == 'Hide artist':
|
||||||
track = storage.get(player.filename)
|
track = storage.get(player.filename)
|
||||||
src.fw_api.hide_content({'target': {'id': track.get('artist').get('id'), 'type': 'artist'}})
|
src.fw_api.hide_content({'target': {'id': track.get('artist').get('id'), 'type': 'artist'}})
|
||||||
|
|
|
@ -38,7 +38,8 @@ default_conf = {
|
||||||
"funkwhale.gegeweb.eu",
|
"funkwhale.gegeweb.eu",
|
||||||
"shitnoise.monster"
|
"shitnoise.monster"
|
||||||
],
|
],
|
||||||
'prefetch_playlist': True
|
'prefetch_playlist': True,
|
||||||
|
'show_like_button': True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue