From 1e4004329c9740d4aff4a8cb02eea67bc9167afb Mon Sep 17 00:00:00 2001 From: GeoffreyCoulaud Date: Sun, 4 Jun 2023 22:51:54 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20New=20Heroic=20source=20-=20Fixed?= =?UTF-8?q?=20wrong=20`installed`=20key,=20shoud=20be=20`is=5Finstalled`?= =?UTF-8?q?=20-=20Log=20warnings=20on=20invalid=20games=20found=20in=20lib?= =?UTF-8?q?rary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/importer/sources/heroic_source.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/importer/sources/heroic_source.py b/src/importer/sources/heroic_source.py index 61400d6..3ce0973 100644 --- a/src/importer/sources/heroic_source.py +++ b/src/importer/sources/heroic_source.py @@ -58,7 +58,7 @@ class HeroicSourceIterator(SourceIterator): """Helper method used to build a Game from a Heroic library entry""" # Skip games that are not installed - if not entry["installed"]: + if not entry["is_installed"]: return None # Build game @@ -96,17 +96,19 @@ class HeroicSourceIterator(SourceIterator): if not shared.schema.get_boolean("heroic-import-" + sub_source["service"]): continue # Load games from JSON + file = self.source.location.joinpath(*sub_source["path"]) try: - file = self.source.location.joinpath(*sub_source["path"]) library = json.load(file.open())["library"] except (JSONDecodeError, OSError, KeyError): # Invalid library.json file, skip it + logging.warning("Couldn't open Heroic file: %s", str(file)) continue for entry in library: try: game = self.game_from_library_entry(entry) except KeyError: # Skip invalid games + logging.warning("Invalid Heroic game skipped in %s", str(file)) continue yield game @@ -154,7 +156,7 @@ class HeroicWindowsSource(HeroicSource, WindowsSource): executable_format = "start heroic://launch/{app_name}" @property - @replaced_by_schema_key("heroic-windows-location") + @replaced_by_schema_key("heroic-location") @replaced_by_env_path("appdata", "heroic/") def location(self) -> Path: raise FileNotFoundError()