1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-29 13:57:13 +08:00

Fix: [ALAS] search by emulator type first, which is more trustworthy

This commit is contained in:
LmeSzinc
2026-03-28 19:07:47 +08:00
parent 960db91be9
commit 5c9b955d24

View File

@@ -181,6 +181,20 @@ class PlatformBase(Connection, EmulatorManagerBase):
logger.info(f'Found emulator instance: {instance}')
return instance
# search by emulator type first, which is the easiest setting for user to setup, so more trustworthy
# Multiple instances in given serial, name and path, search by emulator
if emulator:
search_args['type'] = emulator
select = instances.select(**search_args)
if select.count == 0:
logger.warning(f'No emulator instances with {search_args}, type invalid')
search_args.pop('type')
elif select.count == 1:
instance = select[0]
logger.hr('Emulator instance', level=2)
logger.info(f'Found emulator instance: {instance}')
return instance
# Multiple instances in given serial, search by name
if name:
search_args['name'] = name
@@ -207,19 +221,6 @@ class PlatformBase(Connection, EmulatorManagerBase):
logger.info(f'Found emulator instance: {instance}')
return instance
# Multiple instances in given serial, name and path, search by emulator
if emulator:
search_args['type'] = emulator
select = instances.select(**search_args)
if select.count == 0:
logger.warning(f'No emulator instances with {search_args}, type invalid')
search_args.pop('type')
elif select.count == 1:
instance = select[0]
logger.hr('Emulator instance', level=2)
logger.info(f'Found emulator instance: {instance}')
return instance
# Still too many instances, search from running emulators
running = remove_duplicated_path(list(self.iter_running_emulator()))
logger.info('Running emulators')