Fix source id being translated
- Additional fix, lutris source db subpath
This commit is contained in:
@@ -43,7 +43,7 @@ class BottlesSourceIterable(SourceIterable):
|
||||
for entry in library.values():
|
||||
# Build game
|
||||
values = {
|
||||
"source": self.source.id,
|
||||
"source": self.source.source_id,
|
||||
"added": added_time,
|
||||
"name": entry["name"],
|
||||
"game_id": self.source.game_id_format.format(game_id=entry["id"]),
|
||||
@@ -84,6 +84,7 @@ class BottlesLocations(NamedTuple):
|
||||
class BottlesSource(URLExecutableSource):
|
||||
"""Generic Bottles source"""
|
||||
|
||||
source_id = "bottles"
|
||||
name = _("Bottles")
|
||||
iterable_class = BottlesSourceIterable
|
||||
url_format = 'bottles:run/"{bottle_name}"/"{game_name}"'
|
||||
|
||||
@@ -77,7 +77,7 @@ class FlatpakSourceIterable(SourceIterable):
|
||||
continue
|
||||
|
||||
values = {
|
||||
"source": self.source.id,
|
||||
"source": self.source.source_id,
|
||||
"added": added_time,
|
||||
"name": name,
|
||||
"game_id": self.source.game_id_format.format(game_id=flatpak_id),
|
||||
@@ -119,6 +119,7 @@ class FlatpakLocations(NamedTuple):
|
||||
class FlatpakSource(Source):
|
||||
"""Generic Flatpak source"""
|
||||
|
||||
source_id = "flatpak"
|
||||
name = _("Flatpak")
|
||||
iterable_class = FlatpakSourceIterable
|
||||
executable_format = "flatpak run {flatpak_id}"
|
||||
|
||||
@@ -100,7 +100,7 @@ class SubSourceIterable(Iterable):
|
||||
|
||||
# Build game
|
||||
values = {
|
||||
"source": f"{self.source.id}_{self.service}",
|
||||
"source": f"{self.source.source_id}_{self.service}",
|
||||
"added": added_time,
|
||||
"name": entry["title"],
|
||||
"developer": entry.get("developer", None),
|
||||
@@ -356,6 +356,7 @@ class HeroicLocations(NamedTuple):
|
||||
class HeroicSource(URLExecutableSource):
|
||||
"""Generic Heroic Games Launcher source"""
|
||||
|
||||
source_id = "heroic"
|
||||
name = _("Heroic")
|
||||
iterable_class = HeroicSourceIterable
|
||||
url_format = "heroic://launch/{app_name}"
|
||||
@@ -384,4 +385,4 @@ class HeroicSource(URLExecutableSource):
|
||||
@property
|
||||
def game_id_format(self) -> str:
|
||||
"""The string format used to construct game IDs"""
|
||||
return self.id + "_{service}_{game_id}"
|
||||
return self.source_id + "_{service}_{game_id}"
|
||||
|
||||
@@ -62,7 +62,7 @@ class ItchSourceIterable(SourceIterable):
|
||||
for row in cursor:
|
||||
values = {
|
||||
"added": added_time,
|
||||
"source": self.source.id,
|
||||
"source": self.source.source_id,
|
||||
"name": row[1],
|
||||
"game_id": self.source.game_id_format.format(game_id=row[0]),
|
||||
"executable": self.source.executable_format.format(cave_id=row[4]),
|
||||
@@ -80,6 +80,7 @@ class ItchLocations(NamedTuple):
|
||||
|
||||
|
||||
class ItchSource(URLExecutableSource):
|
||||
source_id = "itch"
|
||||
name = _("itch")
|
||||
iterable_class = ItchSourceIterable
|
||||
url_format = "itch://caves/{cave_id}/launch"
|
||||
|
||||
@@ -43,7 +43,7 @@ class LegendarySourceIterable(SourceIterable):
|
||||
app_name = entry["app_name"]
|
||||
values = {
|
||||
"added": added_time,
|
||||
"source": self.source.id,
|
||||
"source": self.source.source_id,
|
||||
"name": entry["title"],
|
||||
"game_id": self.source.game_id_format.format(game_id=app_name),
|
||||
"executable": self.source.executable_format.format(app_name=app_name),
|
||||
@@ -94,6 +94,7 @@ class LegendaryLocations(NamedTuple):
|
||||
|
||||
|
||||
class LegendarySource(Source):
|
||||
source_id = "legendary"
|
||||
name = _("Legendary")
|
||||
executable_format = "legendary launch {app_name}"
|
||||
available_on = {"linux"}
|
||||
|
||||
@@ -65,7 +65,7 @@ class LutrisSourceIterable(SourceIterable):
|
||||
"added": added_time,
|
||||
"hidden": row[4],
|
||||
"name": row[1],
|
||||
"source": f"{self.source.id}_{row[3]}",
|
||||
"source": f"{self.source.source_id}_{row[3]}",
|
||||
"game_id": self.source.game_id_format.format(
|
||||
runner=row[3], game_id=row[0]
|
||||
),
|
||||
@@ -92,6 +92,7 @@ class LutrisLocations(NamedTuple):
|
||||
class LutrisSource(URLExecutableSource):
|
||||
"""Generic Lutris source"""
|
||||
|
||||
source_id = "lutris"
|
||||
name = _("Lutris")
|
||||
iterable_class = LutrisSourceIterable
|
||||
url_format = "lutris:rungameid/{game_id}"
|
||||
@@ -108,7 +109,7 @@ class LutrisSource(URLExecutableSource):
|
||||
shared.home / ".local" / "share" / "lutris",
|
||||
),
|
||||
paths={
|
||||
"pga.db": (False, "pga.db"),
|
||||
"pga.db": LocationSubPath("pga.db"),
|
||||
},
|
||||
invalid_subtitle=Location.DATA_INVALID_SUBTITLE,
|
||||
),
|
||||
@@ -128,4 +129,4 @@ class LutrisSource(URLExecutableSource):
|
||||
|
||||
@property
|
||||
def game_id_format(self):
|
||||
return self.id + "_{runner}_{game_id}"
|
||||
return self.source_id + "_{runner}_{game_id}"
|
||||
|
||||
@@ -51,6 +51,7 @@ class SourceIterable(Iterable):
|
||||
class Source(Iterable):
|
||||
"""Source of games. E.g an installed app with a config file that lists game directories"""
|
||||
|
||||
source_id: str
|
||||
name: str
|
||||
variant: str = None
|
||||
available_on: set[str] = set()
|
||||
@@ -65,18 +66,10 @@ class Source(Iterable):
|
||||
full_name_ += f" ({self.variant})"
|
||||
return full_name_
|
||||
|
||||
@property
|
||||
def id(self) -> str: # pylint: disable=invalid-name
|
||||
"""The source's identifier"""
|
||||
id_ = self.name.lower()
|
||||
if self.variant is not None:
|
||||
id_ += f"_{self.variant.lower()}"
|
||||
return id_
|
||||
|
||||
@property
|
||||
def game_id_format(self) -> str:
|
||||
"""The string format used to construct game IDs"""
|
||||
return self.id + "_{game_id}"
|
||||
return self.source_id + "_{game_id}"
|
||||
|
||||
@property
|
||||
def is_available(self):
|
||||
|
||||
@@ -92,7 +92,7 @@ class SteamSourceIterable(SourceIterable):
|
||||
values = {
|
||||
"added": added_time,
|
||||
"name": local_data["name"],
|
||||
"source": self.source.id,
|
||||
"source": self.source.source_id,
|
||||
"game_id": self.source.game_id_format.format(game_id=appid),
|
||||
"executable": self.source.executable_format.format(game_id=appid),
|
||||
}
|
||||
@@ -114,6 +114,7 @@ class SteamLocations(NamedTuple):
|
||||
|
||||
|
||||
class SteamSource(URLExecutableSource):
|
||||
source_id = "steam"
|
||||
name = _("Steam")
|
||||
available_on = {"linux", "win32"}
|
||||
iterable_class = SteamSourceIterable
|
||||
|
||||
Reference in New Issue
Block a user