mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-05 14:53:02 +00:00
gzipped API reqests; more logger catchers; fix play all albums in main menu
This commit is contained in:
parent
fe51810a43
commit
3b8d67cbf8
@ -10,14 +10,18 @@ fzf = FzfPrompt()
|
||||
def list_albums(albums=None, pg=None):
|
||||
albums_next = None
|
||||
albums_prev = None
|
||||
play_artist_albums = False
|
||||
if not albums:
|
||||
albums = get_albums(pg=pg)
|
||||
albums_next = albums.get('next')
|
||||
albums_prev = albums.get('previous')
|
||||
albums_results = albums.get('results')
|
||||
else:
|
||||
play_artist_albums = True
|
||||
albums_results = albums
|
||||
view = ['Play all']
|
||||
view = []
|
||||
if play_artist_albums:
|
||||
view.append('Play all')
|
||||
if albums_next:
|
||||
view.append('Next page')
|
||||
if albums_prev:
|
||||
|
@ -11,10 +11,12 @@ token = auth.get(instance)
|
||||
|
||||
if token:
|
||||
s.headers.update({
|
||||
"Authorization": "Bearer " + token
|
||||
"Authorization": "Bearer " + token,
|
||||
"Accept-encoding": 'gzip'
|
||||
})
|
||||
set_http_header(['Authorization: ' + 'Bearer ' + token])
|
||||
else:
|
||||
s.headers.update({"Accept-encoding": 'gzip'})
|
||||
s.get(f'https://{instance}/') # Get cookies from unauthorized instance for working some functionality (radios)
|
||||
set_http_header()
|
||||
|
||||
@ -25,12 +27,14 @@ def select_instance(new_instance=None):
|
||||
with open('.auth.json', 'rt') as f:
|
||||
auth = json.loads(f.read())
|
||||
new_token = auth.get(instance)
|
||||
s.headers.update({"Authorization": None})
|
||||
s.headers.update({"Authorization": None,
|
||||
"Accept-encoding": 'gzip'})
|
||||
set_http_header()
|
||||
if new_token:
|
||||
s.get(f'https://{instance}')
|
||||
s.headers.update({
|
||||
"Authorization": "Bearer " + new_token
|
||||
"Authorization": "Bearer " + new_token,
|
||||
"Accept-encoding": 'gzip'
|
||||
})
|
||||
player.http_header_fields = ['Authorization: ' + 'Bearer ' + new_token]
|
||||
set_http_header(['Authorization: ' + 'Bearer ' + token])
|
||||
|
@ -71,6 +71,8 @@ def radio_generator(radio_session_id):
|
||||
|
||||
radio_event_gen = threading.Event()
|
||||
|
||||
|
||||
@logger.catch
|
||||
def radio_load(id_radio=None, type_radio='custom', name=None, related_object=None):
|
||||
requested_radio = {
|
||||
'custom_radio': id_radio,
|
||||
|
@ -19,7 +19,7 @@ player = mpv.MPV(log_handler=mpv_log, ytdl=False,
|
||||
def set_http_header(headers=[]):
|
||||
player.http_header_fields = headers
|
||||
|
||||
|
||||
@logger.catch
|
||||
def player_menu(header=None, storage={}):
|
||||
while True:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user