✨ New Heroic source
- Fixed wrong `installed` key, shoud be `is_installed` - Log warnings on invalid games found in library
This commit is contained in:
@@ -58,7 +58,7 @@ class HeroicSourceIterator(SourceIterator):
|
|||||||
"""Helper method used to build a Game from a Heroic library entry"""
|
"""Helper method used to build a Game from a Heroic library entry"""
|
||||||
|
|
||||||
# Skip games that are not installed
|
# Skip games that are not installed
|
||||||
if not entry["installed"]:
|
if not entry["is_installed"]:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Build game
|
# Build game
|
||||||
@@ -96,17 +96,19 @@ class HeroicSourceIterator(SourceIterator):
|
|||||||
if not shared.schema.get_boolean("heroic-import-" + sub_source["service"]):
|
if not shared.schema.get_boolean("heroic-import-" + sub_source["service"]):
|
||||||
continue
|
continue
|
||||||
# Load games from JSON
|
# Load games from JSON
|
||||||
|
file = self.source.location.joinpath(*sub_source["path"])
|
||||||
try:
|
try:
|
||||||
file = self.source.location.joinpath(*sub_source["path"])
|
|
||||||
library = json.load(file.open())["library"]
|
library = json.load(file.open())["library"]
|
||||||
except (JSONDecodeError, OSError, KeyError):
|
except (JSONDecodeError, OSError, KeyError):
|
||||||
# Invalid library.json file, skip it
|
# Invalid library.json file, skip it
|
||||||
|
logging.warning("Couldn't open Heroic file: %s", str(file))
|
||||||
continue
|
continue
|
||||||
for entry in library:
|
for entry in library:
|
||||||
try:
|
try:
|
||||||
game = self.game_from_library_entry(entry)
|
game = self.game_from_library_entry(entry)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# Skip invalid games
|
# Skip invalid games
|
||||||
|
logging.warning("Invalid Heroic game skipped in %s", str(file))
|
||||||
continue
|
continue
|
||||||
yield game
|
yield game
|
||||||
|
|
||||||
@@ -154,7 +156,7 @@ class HeroicWindowsSource(HeroicSource, WindowsSource):
|
|||||||
executable_format = "start heroic://launch/{app_name}"
|
executable_format = "start heroic://launch/{app_name}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@replaced_by_schema_key("heroic-windows-location")
|
@replaced_by_schema_key("heroic-location")
|
||||||
@replaced_by_env_path("appdata", "heroic/")
|
@replaced_by_env_path("appdata", "heroic/")
|
||||||
def location(self) -> Path:
|
def location(self) -> Path:
|
||||||
raise FileNotFoundError()
|
raise FileNotFoundError()
|
||||||
|
|||||||
Reference in New Issue
Block a user