mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-05 23:03:00 +00:00
30 lines
857 B
Python
30 lines
857 B
Python
from src.fw_api import select_instance
|
|
from src.fw_radios import list_radios
|
|
import json, sys
|
|
from loguru import logger
|
|
from pyfzf.pyfzf import FzfPrompt
|
|
|
|
fzf = FzfPrompt()
|
|
|
|
def main():
|
|
logger.remove()
|
|
logger.add(sys.stderr, filter='src.fw_api')
|
|
logger.add(sys.stderr, filter='src.fw_radios')
|
|
while True:
|
|
menu = ('Radios', 'Switch instance' )
|
|
ids = fzf.prompt(menu)
|
|
|
|
selected = ids[0]
|
|
if selected == 'Radios':
|
|
list_radios()
|
|
if selected == 'Switch instance':
|
|
with open('config.json', 'rt') as f:
|
|
conf = json.loads(f.read())
|
|
list_instances = conf.get('public_list_instances')
|
|
instance = fzf.prompt(list_instances, '--header \'Select instance\'')[0]
|
|
select_instance(instance)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|