mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-24 02:49:19 +02:00
Compare commits
No commits in common. "24acce9523def4840451d46c517ee63b174d120f" and "3c545cc9917d880dca8df10ad8b1b6fe67d7dd67" have entirely different histories.
24acce9523
...
3c545cc991
14
.icon.txt
14
.icon.txt
|
@ -1,14 +0,0 @@
|
||||||
.'''... ..''''.
|
|
||||||
'''''''......'''''''
|
|
||||||
''''''''''''''.
|
|
||||||
.''''.
|
|
||||||
.''.
|
|
||||||
.''.
|
|
||||||
:u, 'uu .uu. .uu. :u' .uu
|
|
||||||
.oo oo, uo;'';oo. .oo uo,
|
|
||||||
:o; uo;. .,oo ;ou
|
|
||||||
:o:. uo;'......';oo ;o:
|
|
||||||
.ou,. ,oooo; .,uo.
|
|
||||||
:o:,.. ..':ou
|
|
||||||
oou:;;;;:uoo
|
|
||||||
'uu'
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from src.fw_api import current_instance, get_instance_settings, get_node_info
|
from src.fw_api import current_instance, get_instance_settings
|
||||||
from src.fw_radios import list_radios
|
from src.fw_radios import list_radios
|
||||||
from src.fw_artists import list_artists
|
from src.fw_artists import list_artists
|
||||||
from src.fw_albums import list_albums
|
from src.fw_albums import list_albums
|
||||||
|
@ -13,15 +13,10 @@ import src.mpv_control
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from shlex import quote
|
from shlex import quote
|
||||||
from shutil import get_terminal_size
|
|
||||||
from pyfzf.pyfzf import FzfPrompt
|
from pyfzf.pyfzf import FzfPrompt
|
||||||
|
|
||||||
fzf = FzfPrompt()
|
fzf = FzfPrompt()
|
||||||
|
|
||||||
os.system('clear')
|
|
||||||
if get_terminal_size().columns > 32:
|
|
||||||
print('\n\n')
|
|
||||||
os.system('cat .icon.txt')
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
@ -39,9 +34,12 @@ def main():
|
||||||
'About instance',
|
'About instance',
|
||||||
'Switch instance']
|
'Switch instance']
|
||||||
try:
|
try:
|
||||||
ins_nodeinfo = get_node_info()
|
ins_settings, ins_nodeinfo = get_instance_settings()
|
||||||
support_message = ins_nodeinfo['metadata']['instanceSupportMessage']
|
for i in ins_settings:
|
||||||
instance_title = ins_nodeinfo['metadata']['nodeName']
|
if i.get('name') == 'support_message':
|
||||||
|
support_message = i.get('value')
|
||||||
|
if i.get('name') == 'name':
|
||||||
|
instance_title = i.get('value')
|
||||||
instance_stats = []
|
instance_stats = []
|
||||||
for k, v in ins_nodeinfo['metadata']['library'].items():
|
for k, v in ins_nodeinfo['metadata']['library'].items():
|
||||||
if k == 'anonymousCanListen' and v == False and not current_instance.s.headers.get('Authorization'):
|
if k == 'anonymousCanListen' and v == False and not current_instance.s.headers.get('Authorization'):
|
||||||
|
@ -132,7 +130,6 @@ Insert token from "Access token" here''')
|
||||||
if selected == 'Donate':
|
if selected == 'Donate':
|
||||||
os.system(f'less <<EOF\nSupport instance message:\n{support_message}\nEOF')
|
os.system(f'less <<EOF\nSupport instance message:\n{support_message}\nEOF')
|
||||||
if selected == 'About instance':
|
if selected == 'About instance':
|
||||||
ins_settings = get_instance_settings()
|
|
||||||
about_instance_info = []
|
about_instance_info = []
|
||||||
for i in ins_settings:
|
for i in ins_settings:
|
||||||
k, v = i.get('verbose_name'), i.get('value')
|
k, v = i.get('verbose_name'), i.get('value')
|
||||||
|
|
|
@ -62,7 +62,6 @@ def get_me():
|
||||||
if not current_instance.token:
|
if not current_instance.token:
|
||||||
return
|
return
|
||||||
r = current_instance.s.get(f'https://{current_instance.instance}/api/v1/users/me')
|
r = current_instance.s.get(f'https://{current_instance.instance}/api/v1/users/me')
|
||||||
r.raise_for_status()
|
|
||||||
resp = r.json()
|
resp = r.json()
|
||||||
current_instance.listen_token = resp['tokens']['listen']
|
current_instance.listen_token = resp['tokens']['listen']
|
||||||
return resp
|
return resp
|
||||||
|
@ -71,14 +70,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(
|
||||||
|
|
||||||
|
|
||||||
def get_node_info():
|
|
||||||
r = current_instance.s.get(
|
|
||||||
f'https://{current_instance.instance}/api/v1/instance/nodeinfo/2.0/')
|
f'https://{current_instance.instance}/api/v1/instance/nodeinfo/2.0/')
|
||||||
r.raise_for_status()
|
return r.json(), r_node.json()
|
||||||
return r.json()
|
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
|
|
Loading…
Reference in New Issue