openwebrx-clone/owrx/config/commands.py

31 lines
871 B
Python
Raw Permalink Normal View History

2021-04-26 17:27:12 +00:00
from owrx.admin.commands import Command
from owrx.config import Config
from owrx.bookmarks import Bookmarks
class MigrateCommand(Command):
# these keys have been moved to openwebrx.conf
blacklisted_keys = [
"temporary_directory",
"web_port",
"aprs_symbols_path",
]
2021-04-26 17:27:12 +00:00
def run(self, args):
print("Migrating configuration...")
config = Config.get()
# a key that is set will end up in the DynamicConfig, so this will transfer everything there
for key, value in config.items():
if key not in MigrateCommand.blacklisted_keys:
config[key] = value
2021-04-26 17:27:12 +00:00
config.store()
print("Migrating bookmarks...")
# bookmarks just need to be saved
b = Bookmarks.getSharedInstance()
b.getBookmarks()
b.store()
print("Migration complete!")