mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-24 01:39:20 +02:00
Compare commits
No commits in common. "9ec77975e5fef89a3189fd61d56865b3cd8df798" and "add2ef572cf44eddbaaf656883c4c5e4378bb9a3" have entirely different histories.
9ec77975e5
...
add2ef572c
|
@ -11,7 +11,8 @@ from src.fw_recents import list_fav_or_history
|
|||
import src.settings as settings
|
||||
import src.mpv_control
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from shlex import quote
|
||||
from loguru import logger
|
||||
from pyfzf.pyfzf import FzfPrompt
|
||||
|
@ -89,7 +90,7 @@ def main():
|
|||
print('Input url:')
|
||||
returned_obj = federate_search_by_url(input())
|
||||
logger.info(str(returned_obj))
|
||||
|
||||
|
||||
if selected == 'Switch instance':
|
||||
with open('config.json', 'rt') as f:
|
||||
conf = json.loads(f.read())
|
||||
|
@ -103,10 +104,10 @@ def main():
|
|||
current_instance.select_instance(instance)
|
||||
if selected == 'Sign in':
|
||||
print(f'''
|
||||
If You want sign in, please visit:
|
||||
If You want sign in, please visit:
|
||||
https://{instance}/settings/applications/new
|
||||
And fill Name funkwhale-cli
|
||||
Scopes: Read, Write (optional): write:favorites write:listenings write:filters
|
||||
Scopes: Read, Write (optional): write:favorites write:listenings write:filters
|
||||
|
||||
Insert token from "Access token" here''')
|
||||
register_token = input()
|
||||
|
@ -121,22 +122,21 @@ Insert token from "Access token" here''')
|
|||
|
||||
current_instance.select_instance(instance)
|
||||
if selected == 'Donate':
|
||||
os.system(f'less <<EOF\nSupport instance message:\n{support_message}')
|
||||
print('Support instance message:')
|
||||
print(support_message)
|
||||
input()
|
||||
if selected == 'About instance':
|
||||
about_instance_info = []
|
||||
for i in ins_settings:
|
||||
k, v = i.get('verbose_name'), i.get('value')
|
||||
about_instance_info.append(f'{k}: {v}')
|
||||
about_instance_info.append('|||||Some stats:')
|
||||
print(f'{k}: {v}')
|
||||
print('|||||Some stats:')
|
||||
for k, v in ins_nodeinfo['metadata']['usage'].items():
|
||||
about_instance_info.append(f'{k}: {v}')
|
||||
print(f'{k}: {v}')
|
||||
for k, v in ins_nodeinfo['metadata']['library'].items():
|
||||
about_instance_info.append(f'{k}: {v}')
|
||||
print(f'{k}: {v}')
|
||||
for k, v in ins_nodeinfo['usage'].items():
|
||||
about_instance_info.append(f'{k}: {v}')
|
||||
about_instance_info = '\n'.join(about_instance_info)
|
||||
os.system(f'less <<EOF\n{about_instance_info}')
|
||||
del about_instance_info
|
||||
print(f'{k}: {v}')
|
||||
input()
|
||||
if selected == 'Player':
|
||||
src.mpv_control.player_menu(
|
||||
storage=src.mpv_control.player_fw_storage.storage)
|
||||
|
|
|
@ -35,6 +35,7 @@ class current_instance:
|
|||
token = auth.get(instance)
|
||||
listen_token = None
|
||||
|
||||
|
||||
@logger.catch
|
||||
def select_instance(new_instance=None):
|
||||
current_instance.instance = new_instance
|
||||
|
@ -54,7 +55,7 @@ if current_instance.token:
|
|||
else:
|
||||
# Get cookies from unauthorized instance for working some functionality (radios)
|
||||
current_instance.s.get(f'https://{current_instance.instance}/')
|
||||
|
||||
|
||||
|
||||
@logger.catch
|
||||
def get_me():
|
||||
|
@ -64,7 +65,7 @@ def get_me():
|
|||
r = current_instance.s.get(f'https://{current_instance.instance}/api/v1/users/me')
|
||||
resp = r.json()
|
||||
current_instance.listen_token = resp['tokens']['listen']
|
||||
return resp
|
||||
return resp
|
||||
|
||||
|
||||
def get_instance_settings():
|
||||
|
@ -76,7 +77,7 @@ def get_instance_settings():
|
|||
|
||||
|
||||
@logger.catch
|
||||
def get_audio_file(track_uuid, listen_url=False, download=False,
|
||||
def get_audio_file(track_uuid, listen_url=False, download=False,
|
||||
external_transcoding=get_config('external_transcoder_http_proxy_path'),
|
||||
transcoding=get_config('enable_server_transcoding'), to='ogg'):
|
||||
params = {
|
||||
|
|
Loading…
Reference in New Issue