mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-15 00:39:20 +02:00
More verbose info about instance
This commit is contained in:
parent
17229d48b8
commit
d39a86a2a9
|
@ -34,18 +34,28 @@ def main():
|
||||||
'Favorites',
|
'Favorites',
|
||||||
'Recently listened',
|
'Recently listened',
|
||||||
'Search',
|
'Search',
|
||||||
|
'About instance',
|
||||||
'Switch instance']
|
'Switch instance']
|
||||||
try:
|
try:
|
||||||
ins_settings = get_instance_settings()
|
ins_settings, ins_nodeinfo = get_instance_settings()
|
||||||
for i in ins_settings:
|
for i in ins_settings:
|
||||||
if i.get('name') == 'support_message':
|
if i.get('name') == 'support_message':
|
||||||
support_message = i.get('value')
|
support_message = i.get('value')
|
||||||
if i.get('name') == 'name':
|
if i.get('name') == 'name':
|
||||||
instance_title = i.get('value')
|
instance_title = i.get('value')
|
||||||
main_menu_header = quote(f'''{instance_title}'''.strip())
|
instance_stats = []
|
||||||
except:
|
for k, v in ins_nodeinfo['metadata']['library'].items():
|
||||||
|
if k == 'anonymousCanListen' and v == False:
|
||||||
|
instance_stats.append(f'!!! {k}: {v} !!!')
|
||||||
|
continue
|
||||||
|
instance_stats.append(f'{k}: {v}')
|
||||||
|
instance_stats.append(ins_nodeinfo['software']['version'])
|
||||||
|
instance_stats = '\n'.join(instance_stats)
|
||||||
|
|
||||||
|
main_menu_header = quote(f'''{instance_title}\n{instance_stats}'''.strip())
|
||||||
|
except Exception as E:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
main_menu_header = quote(f'''Connection failed'''.strip())
|
main_menu_header = quote(f'''Connection failed: {E}'''.strip())
|
||||||
menu = ['Switch instance']
|
menu = ['Switch instance']
|
||||||
|
|
||||||
if not current_instance.s.headers.get('Authorization'):
|
if not current_instance.s.headers.get('Authorization'):
|
||||||
|
@ -114,6 +124,18 @@ Insert token from "Access token" here''')
|
||||||
print('Support instance message:')
|
print('Support instance message:')
|
||||||
print(support_message)
|
print(support_message)
|
||||||
input()
|
input()
|
||||||
|
if selected == 'About instance':
|
||||||
|
for i in ins_settings:
|
||||||
|
k, v = i.get('verbose_name'), i.get('value')
|
||||||
|
print(f'{k}: {v}')
|
||||||
|
print('|||||Some stats:')
|
||||||
|
for k, v in ins_nodeinfo['metadata']['usage'].items():
|
||||||
|
print(f'{k}: {v}')
|
||||||
|
for k, v in ins_nodeinfo['metadata']['library'].items():
|
||||||
|
print(f'{k}: {v}')
|
||||||
|
for k, v in ins_nodeinfo['usage'].items():
|
||||||
|
print(f'{k}: {v}')
|
||||||
|
input()
|
||||||
if selected == 'Player':
|
if selected == 'Player':
|
||||||
src.mpv_control.player_menu(
|
src.mpv_control.player_menu(
|
||||||
storage=src.mpv_control.player_fw_storage.storage)
|
storage=src.mpv_control.player_fw_storage.storage)
|
||||||
|
|
|
@ -72,7 +72,9 @@ def get_me():
|
||||||
def get_instance_settings():
|
def get_instance_settings():
|
||||||
r = current_instance.s.get(
|
r = current_instance.s.get(
|
||||||
f'https://{current_instance.instance}/api/v1/instance/settings')
|
f'https://{current_instance.instance}/api/v1/instance/settings')
|
||||||
return r.json()
|
r_node = current_instance.s.get(
|
||||||
|
f'https://{current_instance.instance}/api/v1/instance/nodeinfo/2.0/')
|
||||||
|
return r.json(), r_node.json()
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
|
|
Loading…
Reference in New Issue