Now dump new instances in config

This commit is contained in:
localhost_frssoft 2023-06-06 00:51:54 +03:00
parent 982e5f5a87
commit 11dba2648d
2 changed files with 8 additions and 0 deletions

View file

@ -83,6 +83,7 @@ def main():
new_ins_count = len(settings.get_new_funkwhale_servers()) new_ins_count = len(settings.get_new_funkwhale_servers())
list_instances = conf.get( list_instances = conf.get(
'public_list_instances') + public_server_list_instances 'public_list_instances') + public_server_list_instances
settings.set_config('public_list_instances', list_instances)
instance = fzf.prompt(list_instances, instance = fzf.prompt(list_instances,
'--header='+quote(f'Select instance\nServer instances: +{new_ins_count}'))[0] '--header='+quote(f'Select instance\nServer instances: +{new_ins_count}'))[0]
current_instance.select_instance(instance) current_instance.select_instance(instance)

View file

@ -90,6 +90,13 @@ def get_config(key):
return loaded_config.get(key) return loaded_config.get(key)
def set_config(key, value):
'''set value new value config by key'''
read_conf = check_config()
with open(conf_file, 'wt') as f:
read_conf[key] = value
f.write(json.dumps(read_conf, indent=4))
@logger.catch @logger.catch
def get_new_funkwhale_servers(): def get_new_funkwhale_servers():
# Uses official API network.funkwhale.audio for getting new instances # Uses official API network.funkwhale.audio for getting new instances