~fixed GOG and EA Scanners

~GOG picks up more games
~EA no longer picks up DLC's
This commit is contained in:
Roy 2024-10-25 15:20:16 -07:00 committed by GitHub
parent d4c725e87e
commit b3333347af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -840,6 +840,9 @@ else:
# EA App Game Scanner # EA App Game Scanner
# EA App Game Scanner
def get_ea_app_game_info(installed_games, game_directory_path): def get_ea_app_game_info(installed_games, game_directory_path):
game_dict = {} game_dict = {}
for game in installed_games: for game in installed_games:
@ -848,10 +851,8 @@ def get_ea_app_game_info(installed_games, game_directory_path):
ea_ids = None ea_ids = None
game_name = None game_name = None
for content_id in xml_root.iter('contentID'): for content_id in xml_root.iter('contentID'):
if ea_ids is None: ea_ids = content_id.text
ea_ids = content_id.text break # Exit the loop after the first ID is found
else:
ea_ids = ea_ids + ',' + content_id.text
for game_title in xml_root.iter('gameTitle'): for game_title in xml_root.iter('gameTitle'):
if game_name is None: if game_name is None:
game_name = game_title.text game_name = game_title.text
@ -885,11 +886,12 @@ else:
#Gog Galaxy Scanner #Gog Galaxy Scanner
# Gog Galaxy Scanner
def getGogGameInfo(filePath): def getGogGameInfo(filePath):
# Check if the file contains any GOG entries # Check if the file contains any GOG entries
with open(filePath, 'r') as file: with open(filePath, 'r') as file:
if "GOG.com" not in file.read(): if "GOG.com" not in file.read():
print("No GOG entries found in the registry file. Skipping GOG Galaxy Games Scanner.") decky_plugin.logger.info("No GOG entries found in the registry file. Skipping GOG Galaxy Games Scanner.")
return {} return {}
# If GOG entries exist, parse the registry file # If GOG entries exist, parse the registry file
@ -903,47 +905,36 @@ def getGogGameInfo(filePath):
start_menu_link = None start_menu_link = None
gog_entry = False gog_entry = False
for line in file: for line in file:
if "GOG.com" in line: split_line = line.split("=")
gog_entry = True if len(split_line) > 1:
if gog_entry: if "gameid" in line.lower():
split_line = line.split("=") game_id = re.findall(r'\"(.+?)\"', split_line[1])
if len(split_line) > 1: if game_id:
if "gameID" in line: game_id = game_id[0]
game_id = re.findall(r'\"(.+?)\"', split_line[1]) if "gamename" in line.lower():
if game_id: game_name = re.findall(r'\"(.+?)\"', split_line[1])
game_id = game_id[0] if game_name:
if "gameName" in line: game_name = bytes(game_name[0], 'utf-8').decode('unicode_escape')
game_name = re.findall(r'\"(.+?)\"', split_line[1]) game_name = game_name.replace('!22', '')
if game_name: if "exe" in line.lower() and not "unins000.exe" in line.lower():
game_name = bytes(game_name[0], 'utf-8').decode('unicode_escape') exe_path = re.findall(r'\"(.+?)\"', split_line[1])
game_name = game_name.replace('!22', '') if exe_path:
if "exe" in line and not "unins000.exe" in line: exe_path = exe_path[0].replace('\\\\', '\\')
exe_path = re.findall(r'\"(.+?)\"', split_line[1]) if "dependson" in line.lower():
if exe_path: depends_on = re.findall(r'\"(.+?)\"', split_line[1])
exe_path = exe_path[0].replace('\\\\', '\\') if depends_on:
if "dependsOn" in line: depends_on = depends_on[0]
depends_on = re.findall(r'\"(.+?)\"', split_line[1]) if "launchcommand" in line.lower():
if depends_on: launch_command = re.findall(r'\"(.+?)\"', split_line[1])
depends_on = depends_on[0] if launch_command:
if "launchCommand" in line: launch_command = launch_command[0]
launch_command = re.findall(r'\"(.+?)\"\s*$', split_line[1]) if game_id and game_name and launch_command:
if launch_command: game_dict[game_name] = {'id': game_id, 'exe': exe_path}
# Remove leading and trailing whitespace from the path game_id = None
path = launch_command[0].strip() game_name = None
# Reconstruct the launch command with the cleaned path exe_path = None
launch_command = f"\"{path}\"" depends_on = None
if "startMenuLink" in line: launch_command = None
start_menu_link = re.findall(r'\"(.+?)\"', split_line[1])
if start_menu_link:
start_menu_link = start_menu_link[0]
if game_id and game_name and launch_command and start_menu_link and 'GOG.com' in start_menu_link:
game_dict[game_name] = {'id': game_id, 'exe': exe_path}
game_id = None
game_name = None
exe_path = None
depends_on = None
launch_command = None
start_menu_link = None
return game_dict return game_dict