From fbf076660d6eaabb2b2b2c0bb69956c738037486 Mon Sep 17 00:00:00 2001 From: GeoffreyCoulaud Date: Sat, 22 Jul 2023 00:04:02 +0200 Subject: [PATCH] Better heroic store file parsing --- src/importer/sources/heroic_source.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/importer/sources/heroic_source.py b/src/importer/sources/heroic_source.py index acd16f5..73461e8 100644 --- a/src/importer/sources/heroic_source.py +++ b/src/importer/sources/heroic_source.py @@ -307,11 +307,14 @@ class HeroicSourceIterable(SourceIterable): # Get the hidden app names try: store = path_json_load(self.source.config_location["store_config.json"]) - if "hidden" in store["games"].keys(): - self.hidden_app_names = { - game["appName"] for game in store["games"]["hidden"] - } - except (OSError, JSONDecodeError, KeyError, TypeError) as error: + self.hidden_app_names = { + app_name + for game in store["games"]["hidden"] + if (app_name := game.get("appName")) is not None + } + except KeyError: + logging.warning('No ["games"]["hidden"] key in Heroic store file') + except (OSError, JSONDecodeError, TypeError) as error: logging.error("Invalid Heroic store file", exc_info=error) raise InvalidStoreFileError() from error