This commit is contained in:
kramo
2023-08-17 14:29:04 +02:00
parent a4a929c965
commit 91f4e05abe
7 changed files with 16 additions and 18 deletions

View File

@@ -43,6 +43,7 @@ Cartridges is a simple game launcher written in Python using GTK4 and Libadwaita
- Bottles - Bottles
- itch - itch
- Legendary - Legendary
- RetroArch
- Flatpak - Flatpak
- Hiding games - Hiding games
- Searching and sorting by title, date added and last played - Searching and sorting by title, date added and last played

View File

@@ -115,8 +115,8 @@ class SubSourceIterable(Iterable):
} }
game = Game(values) game = Game(values)
# Get the image path from the heroic cache # Get the image path from the Heroic cache
# Filenames are derived from the URL that heroic used to get the file # Filenames are derived from the URL that Heroic used to get the file
uri: str = entry["art_square"] + self.image_uri_params uri: str = entry["art_square"] + self.image_uri_params
digest = sha256(uri.encode()).hexdigest() digest = sha256(uri.encode()).hexdigest()
image_path = self.source.locations.config.root / "images-cache" / digest image_path = self.source.locations.config.root / "images-cache" / digest
@@ -221,13 +221,10 @@ class LegendaryIterable(StoreSubSourceIterable):
@cached_property @cached_property
def installed_path(self) -> Path: def installed_path(self) -> Path:
""" """Get the right path depending on the Heroic version"""
Get the right path depending on the Heroic version # TODO after Heroic 2.9 has been out for a while
# We should use the commented out relative_installed_path
TODO after heroic 2.9 has been out for a while # and remove this property override.
We should use the commented out relative_installed_path
and remove this property override.
"""
heroic_config_path = self.source.locations.config.root heroic_config_path = self.source.locations.config.root
# Heroic >= 2.9 # Heroic >= 2.9

View File

@@ -176,7 +176,7 @@ class RetroarchSource(Source):
invalid_subtitle=Location.CONFIG_INVALID_SUBTITLE, invalid_subtitle=Location.CONFIG_INVALID_SUBTITLE,
) )
) )
# TODO enable when we get the Steam RetroArch games work # TODO enable when we get the Steam RetroArch games working
# self.add_steam_location_candidate() # self.add_steam_location_candidate()
def add_steam_location_candidate(self) -> None: def add_steam_location_candidate(self) -> None:
@@ -192,13 +192,13 @@ class RetroarchSource(Source):
""" """
Get the RetroArch installed via Steam location Get the RetroArch installed via Steam location
:raise UnresolvableLocationError: if steam isn't installed :raise UnresolvableLocationError: if Steam isn't installed
:raise KeyError: if there is no libraryfolders.vdf subpath :raise KeyError: if there is no libraryfolders.vdf subpath
:raise OSError: if libraryfolders.vdf can't be opened :raise OSError: if libraryfolders.vdf can't be opened
:raise ValueError: if RetroArch isn't installed through Steam :raise ValueError: if RetroArch isn't installed through Steam
""" """
# Find steam location # Find Steam location
libraryfolders = SteamSource().locations.data["libraryfolders.vdf"] libraryfolders = SteamSource().locations.data["libraryfolders.vdf"]
parse_apps = False parse_apps = False
with open(libraryfolders, "r", encoding="utf-8") as open_file: with open(libraryfolders, "r", encoding="utf-8") as open_file:

View File

@@ -35,7 +35,7 @@ class SteamSourceIterable(SourceIterable):
source: "SteamSource" source: "SteamSource"
def get_manifest_dirs(self) -> Iterable[Path]: def get_manifest_dirs(self) -> Iterable[Path]:
"""Get dirs that contain steam app manifests""" """Get dirs that contain Steam app manifests"""
libraryfolders_path = self.source.locations.data["libraryfolders.vdf"] libraryfolders_path = self.source.locations.data["libraryfolders.vdf"]
with open(libraryfolders_path, "r", encoding="utf-8") as file: with open(libraryfolders_path, "r", encoding="utf-8") as file:
contents = file.read() contents = file.read()

View File

@@ -24,13 +24,13 @@ from requests.exceptions import HTTPError, SSLError
from src.errors.friendly_error import FriendlyError from src.errors.friendly_error import FriendlyError
from src.game import Game from src.game import Game
from src.store.managers.async_manager import AsyncManager from src.store.managers.async_manager import AsyncManager
from src.store.managers.steam_api_manager import SteamAPIManager
from src.store.managers.cover_manager import CoverManager from src.store.managers.cover_manager import CoverManager
from src.store.managers.steam_api_manager import SteamAPIManager
from src.utils.steamgriddb import SGDBAuthError, SGDBHelper from src.utils.steamgriddb import SGDBAuthError, SGDBHelper
class SGDBManager(AsyncManager): class SGDBManager(AsyncManager):
"""Manager in charge of downloading a game's cover from steamgriddb""" """Manager in charge of downloading a game's cover from SteamGridDB"""
run_after = (SteamAPIManager, CoverManager) run_after = (SteamAPIManager, CoverManager)
retryable_on = (HTTPError, SSLError, ConnectionError, JSONDecodeError) retryable_on = (HTTPError, SSLError, ConnectionError, JSONDecodeError)

View File

@@ -23,8 +23,8 @@ from urllib3.exceptions import ConnectionError as Urllib3ConnectionError
from src.game import Game from src.game import Game
from src.store.managers.async_manager import AsyncManager from src.store.managers.async_manager import AsyncManager
from src.utils.steam import ( from src.utils.steam import (
SteamGameNotFoundError,
SteamAPIHelper, SteamAPIHelper,
SteamGameNotFoundError,
SteamNotAGameError, SteamNotAGameError,
SteamRateLimiter, SteamRateLimiter,
) )
@@ -44,7 +44,7 @@ class SteamAPIManager(AsyncManager):
self.steam_api_helper = SteamAPIHelper(self.steam_rate_limiter) self.steam_api_helper = SteamAPIHelper(self.steam_rate_limiter)
def main(self, game: Game, additional_data: dict) -> None: def main(self, game: Game, additional_data: dict) -> None:
# Skip non-steam games # Skip non-Steam games
appid = additional_data.get("steam_appid", None) appid = additional_data.get("steam_appid", None)
if appid is None: if appid is None:
return return

View File

@@ -91,7 +91,7 @@ class SteamRateLimiter(RateLimiter):
class SteamFileHelper: class SteamFileHelper:
"""Helper for steam file formats""" """Helper for Steam file formats"""
def get_manifest_data(self, manifest_path: Path) -> SteamManifestData: def get_manifest_data(self, manifest_path: Path) -> SteamManifestData:
"""Get local data for a game from its manifest""" """Get local data for a game from its manifest"""