From 11dba2648d1aaed8dffad960818516aba9aa1e43 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Tue, 6 Jun 2023 00:51:54 +0300 Subject: [PATCH] Now dump new instances in config --- funkwhale_cli.py | 1 + src/settings.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/funkwhale_cli.py b/funkwhale_cli.py index c7988c0..fdf05d3 100755 --- a/funkwhale_cli.py +++ b/funkwhale_cli.py @@ -83,6 +83,7 @@ def main(): new_ins_count = len(settings.get_new_funkwhale_servers()) list_instances = conf.get( 'public_list_instances') + public_server_list_instances + settings.set_config('public_list_instances', list_instances) instance = fzf.prompt(list_instances, '--header='+quote(f'Select instance\nServer instances: +{new_ins_count}'))[0] current_instance.select_instance(instance) diff --git a/src/settings.py b/src/settings.py index e52de66..1c71577 100644 --- a/src/settings.py +++ b/src/settings.py @@ -90,6 +90,13 @@ def get_config(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 def get_new_funkwhale_servers(): # Uses official API network.funkwhale.audio for getting new instances