Skip to content

Commit 5fdaf09

Browse files
authored
BUGFIX
SkyEye did not work with API keys
1 parent 5e7cdfd commit 5fdaf09

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

extensions/skyeye/extension.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ def __init__(self, server, config):
4040
if self.process:
4141
self.log.info(f" => {self.name}: Running SkyEye server detected.")
4242

43+
def get_config(self) -> str:
44+
return os.path.expandvars(utils.format_string(
45+
self.config.get('config', f'{self.server.instance.home}\\Config\\SkyEye.yaml'),
46+
server=self.server)
47+
)
48+
4349
def load_config(self) -> Optional[dict]:
44-
path = os.path.expandvars(self.config['config'])
50+
path = self.get_config()
4551
if not os.path.exists(path):
4652
base_config = os.path.join(os.path.dirname(self.get_exe_path()), "config.yaml")
4753
if not os.path.exists(base_config):
@@ -137,7 +143,7 @@ async def prepare(self) -> bool:
137143
if srs:
138144
srs_port = srs.config.get('port', srs.locals['Server Settings']['SERVER_PORT'])
139145
dirty |= self._maybe_update_config('srs-server-address', f"localhost:{srs_port}")
140-
if self.config['coalition'] == 'blue':
146+
if self.config.get('coalition', 'blue') == 'blue':
141147
dirty |= self._maybe_update_config(
142148
'srs-eam-password',
143149
srs.locals['External AWACS Mode Settings']['EXTERNAL_AWACS_MODE_BLUE_PASSWORD']
@@ -163,7 +169,7 @@ async def prepare(self) -> bool:
163169
# grpc-password is not supported yet
164170

165171
if dirty:
166-
with open(os.path.expandvars(self.config['config']), mode='w', encoding='utf-8') as outfile:
172+
with open(self.get_config(), mode='w', encoding='utf-8') as outfile:
167173
yaml.dump(self.locals, outfile)
168174
return await super().prepare()
169175

@@ -176,9 +182,11 @@ def run_subprocess():
176182
out = subprocess.PIPE if self.config.get('debug', False) else subprocess.DEVNULL
177183
args = [
178184
self.get_exe_path(),
179-
'--config-file', os.path.expandvars(self.config['config']),
180-
'--whisper-model', 'whisper.bin'
185+
'--config-file', self.get_config()
181186
]
187+
if self.locals.get('recognizer', 'openai-whisper-local') == 'openai-whisper-local':
188+
args.extend(['--whisper-model', 'whisper.bin'])
189+
182190
self.log.debug("Launching {}".format(' '.join(args)))
183191
proc = subprocess.Popen(
184192
args, cwd=os.path.dirname(self.get_exe_path()), stdout=out, stderr=subprocess.STDOUT, close_fds=True

0 commit comments

Comments
 (0)