From b651ad205f4198d6983facb3a517f98cb4d82f3c Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Wed, 13 Sep 2023 17:20:07 +0200 Subject: [PATCH] respect sea cfg and confirmed plugged device --- frappyman.py | 25 +++++++++++++------------ seaman.py | 7 +++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/frappyman.py b/frappyman.py index f84f678..061a958 100644 --- a/frappyman.py +++ b/frappyman.py @@ -242,26 +242,27 @@ class FrappyManager(ServiceManager): def cfg_from_sea(self, ins): sea = SeaManager() sea.get_info() - cfgs = sea.get_cfg(ins, 'sea').split('/') + cfgs, confirmed = sea.get_cfg(ins, 'sea', True) + cfgs = cfgs.split('/') result = {} - def check_cfg_file(self, cfg, allcfg, stick=''): - if cfg in allcfg: - return cfg - if cfg + stick in allcfg: - return cfg + stick - return cfg + '?' + def check_cfg_file(cfg, allcfg): + if cfg is 'none': + return '' + return cfg if cfg in allcfg else cfg + '?' - if cfgs[0]: - result['main'] = check_cfg_file(cfgs[0], self.all_cfg(ins, 'main')) + allmain = self.all_cfg(ins, 'main') allsticks = self.all_cfg(ins, 'stick') + if cfgs[0]: + result['main'] = check_cfg_file(cfgs[0], allmain) if len(cfgs) > 1: stick = cfgs[1] if stick: - if stick + 'stick' in allsticks: - cfg = stick + 'stick' - result['stick'] = check_cfg_file(cfg, allsticks) + if stick not in allsticks and stick in allmain: + stick += 'stick' + result['stick'] = check_cfg_file(stick, allsticks) addons = [check_cfg_file(a) for a in cfgs[2:]] if addons: result['addons'] = ','.join(addons) + result['confirmed'] = confirmed return result diff --git a/seaman.py b/seaman.py index e5b54ad..31c06b8 100644 --- a/seaman.py +++ b/seaman.py @@ -111,7 +111,7 @@ class SeaManager(ServiceManager): os.system('cp %s ./' % sea_server_src) return start_dir, env - def get_cfg(self, ins, service): + def get_cfg(self, ins, service, addconfirmed=False): """return cfg info about running programs, if relevant return samenv name @@ -145,9 +145,8 @@ class SeaManager(ServiceManager): confirmed = dev if not result[-1]: result.pop() - if confirmed and confirmed != result[0]: - result[0] = '?' - return '/'.join(result) + result = '/'.join(result) + return (result, confirmed) if addconfirmed else result except Exception as e: return repr(e)