From 32f2526159573182115991fd42aae4d13fcc51ce Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Thu, 20 Jan 2022 04:46:29 -0500 Subject: [PATCH 1/3] Init logger --- plugin/steam_search.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/steam_search.py b/plugin/steam_search.py index 75444d7..663b88c 100644 --- a/plugin/steam_search.py +++ b/plugin/steam_search.py @@ -9,6 +9,7 @@ class SteamSearch(Flox): def query(self, query): + self.logger try: self._steam = Steam(self.settings.get('steam_path', '')) if self.settings.get('steam_path') is None or self.settings.get('steam_path') == '': From cb14393f5b8f73556547c7ed6491d11f65e71e50 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Thu, 20 Jan 2022 04:47:19 -0500 Subject: [PATCH 2/3] Log manifest errors --- plugin/helper.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/plugin/helper.py b/plugin/helper.py index 34ba8b5..3760e0d 100644 --- a/plugin/helper.py +++ b/plugin/helper.py @@ -1,4 +1,5 @@ from pathlib import Path +import logging import winreg as reg from winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE @@ -15,6 +16,8 @@ LIBRARY_HERO_SUFFIX = '_library_hero' STEAMAPPS_FOLDER = 'steamapps' +logger = logging.getLogger(__name__) + class SteamExecutableNotFound(Exception): def __init__(self, path) -> None: @@ -63,7 +66,7 @@ def libraries(self): try: library_folders = vdf.load(open(libraries_manifest_path, 'r', encoding='utf-8', errors='ignore')) except FileNotFoundError: - pass + logging.warning(f'Could not find Steam libraries manifest ("libraryfolders.vdf") at: {libraries_manifest_path}') else: if library_folders.get('libraryfolders'): libraries_key = 'libraryfolders' @@ -93,12 +96,20 @@ def __repr__(self): def games(self): games = [] for manifest in self._library_path.joinpath(STEAMAPPS_FOLDER).glob('*.acf'): + logger.debug(f'Found manifest: {manifest}') try: - _game_manifest = vdf.load(open(manifest, 'r', encoding='utf-8', errors='ignore')) + with open(manifest, 'r', encoding='utf-8', errors='ignore') as f: + raw_manifest = f.read() + _game_manifest = vdf.loads(raw_manifest) game = SteamGame(_game_manifest["AppState"]["appid"], _game_manifest["AppState"]["name"], _game_manifest["AppState"]["installdir"], self._steam_path, self._library_path) except FileNotFoundError: - pass + logging.warning(f'Could not find game manifest ("{manifest}")') + continue except SyntaxError: + logging.warning(f'Could not parse game manifest ("{manifest}")') + continue + except KeyError: + logging.warning(f'Unable to parse game manifest ("{manifest}")\n{raw_manifest}') continue else: games.append(game) From 4f44aed5bdb8663c82360afd88b94e3ae5d31165 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Thu, 20 Jan 2022 04:47:32 -0500 Subject: [PATCH 3/3] Bump version --- plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.json b/plugin.json index 917c37f..1e40bdf 100644 --- a/plugin.json +++ b/plugin.json @@ -4,7 +4,7 @@ "Name": "Steam Search", "Description": "Search and launch your Steam Game library", "Author": "Garulf", - "Version": "3.1.0", + "Version": "3.2.0", "Language": "python", "Website": "https://github.com/Garulf/Steam-Search", "IcoPath": "plugin\\icon\\steam-icon.png",