mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-30 03:56:02 +08:00
Fix: [ALAS] search by emulator type first, which is more trustworthy
This commit is contained in:
@@ -181,6 +181,20 @@ class PlatformBase(Connection, EmulatorManagerBase):
|
|||||||
logger.info(f'Found emulator instance: {instance}')
|
logger.info(f'Found emulator instance: {instance}')
|
||||||
return 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
|
# Multiple instances in given serial, search by name
|
||||||
if name:
|
if name:
|
||||||
search_args['name'] = name
|
search_args['name'] = name
|
||||||
@@ -207,19 +221,6 @@ class PlatformBase(Connection, EmulatorManagerBase):
|
|||||||
logger.info(f'Found emulator instance: {instance}')
|
logger.info(f'Found emulator instance: {instance}')
|
||||||
return 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
|
# Still too many instances, search from running emulators
|
||||||
running = remove_duplicated_path(list(self.iter_running_emulator()))
|
running = remove_duplicated_path(list(self.iter_running_emulator()))
|
||||||
logger.info('Running emulators')
|
logger.info('Running emulators')
|
||||||
|
|||||||
Reference in New Issue
Block a user