mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-12-23 13:53:33 +02:00
Some content curation (optional)
This commit is contained in:
parent
3b8d67cbf8
commit
e07a672466
3 changed files with 28 additions and 3 deletions
|
@ -40,7 +40,7 @@ def main():
|
|||
If You want sign in, please visit:
|
||||
https://{instance}/settings/applications/new
|
||||
And fill Name funkwhale-cli
|
||||
Scopes: mark Read
|
||||
Scopes: Read (only listen music), Write (optional)
|
||||
|
||||
Insert token from "Access token" here''')
|
||||
register_token = input()
|
||||
|
|
|
@ -105,6 +105,28 @@ def list_libraries(page=None, page_size=None, q=None, scope='all'):
|
|||
return r.json()
|
||||
|
||||
|
||||
@logger.catch
|
||||
def favorite_track(track_id):
|
||||
r = s.post(f'https://{instance}/api/v1/favorites/tracks', json={'track': int(track_id)})
|
||||
r.raise_for_status()
|
||||
return r.json
|
||||
|
||||
|
||||
@logger.catch
|
||||
def unfavorite_track(track_id):
|
||||
r = s.post(f'https://{instance}/api/v1/favorites/tracks/delete', json={'track': int(track_id)})
|
||||
r.raise_for_status()
|
||||
return r.json
|
||||
|
||||
|
||||
@logger.catch
|
||||
def hide_content(content):
|
||||
'''This function hide content (write permission)'''
|
||||
r = s.post(f'https://{instance}/api/v1/moderation/content-filters/', json=content)
|
||||
r.raise_for_status()
|
||||
return r.json
|
||||
|
||||
|
||||
# [FunkWhale radios]
|
||||
def get_radios():
|
||||
r = s.get(f'https://{instance}/api/v1/radios/radios/')
|
||||
|
@ -124,4 +146,3 @@ def get_track_radio(radio_session):
|
|||
except:
|
||||
logger.exception('Radio: get next track failed')
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import src.fw_api
|
||||
from src.utils import download_track
|
||||
from loguru import logger
|
||||
from pyfzf.pyfzf import FzfPrompt
|
||||
|
@ -23,7 +24,7 @@ def set_http_header(headers=[]):
|
|||
def player_menu(header=None, storage={}):
|
||||
while True:
|
||||
try:
|
||||
select = fzf.prompt(('Next', 'Prev', 'Pause', 'Download', 'Info', 'Exit'), f"--header=\'{header}\'")[0]
|
||||
select = fzf.prompt(('Next', 'Prev', 'Pause', 'Download', 'Info', 'Hide artist', 'Exit'), f"--header=\'{header}\'")[0]
|
||||
if select == 'Next':
|
||||
player.playlist_next()
|
||||
elif select == 'Prev':
|
||||
|
@ -49,6 +50,9 @@ def player_menu(header=None, storage={}):
|
|||
if key and isinstance(key, str):
|
||||
print(i + ': ' + key)
|
||||
input()
|
||||
elif select == 'Hide artist':
|
||||
track = storage.get(player.filename)
|
||||
src.fw_api.hide_content({'target': {'id': track.get('artist').get('id'), 'type': 'artist'}})
|
||||
elif select == 'Exit':
|
||||
player.playlist_clear()
|
||||
player.stop()
|
||||
|
|
Loading…
Reference in a new issue