def scan_for_unknown_apps(cls, platforms=[StoreTypeEnum.PLAY_STORE, StoreTypeEnum.APP_STORE], auto_update=True): apps = AppInfo.get_unknown() all_apps = [] for app in apps: if StoreTypeEnum.PLAY_STORE in platforms: # Search the Play Store, this update any matched items in the database play_store_apps = AppInfoPopulate.play_store_search(term=app.name, update=auto_update) # Only if the first app is an exact match if len(play_store_apps) > 0: first_app = play_store_apps[0] if first_app.get('name') == app.name: # we have a match # Nothing to do this has already probably merged pass all_apps += play_store_apps if StoreTypeEnum.APP_STORE in platforms: # Search the App Store # This will update any matched items in the database app_store_apps = AppInfoPopulate.app_store_search(term=app.name, update=auto_update) print app_store_apps if len(app_store_apps) > 0: first_app = app_store_apps[0] if first_app.get('name') == app.name: # we have a match # Nothing to do this has already probably merged pass all_apps += app_store_apps return all_apps