Simplifying game executable

This commit is contained in:
GeoffreyCoulaud
2023-08-27 13:53:23 +02:00
parent c607a65d1f
commit 6486f5b336
8 changed files with 11 additions and 14 deletions

View File

@@ -47,8 +47,9 @@ class BottlesSourceIterable(SourceIterable):
"added": added_time, "added": added_time,
"name": entry["name"], "name": entry["name"],
"game_id": self.source.game_id_format.format(game_id=entry["id"]), "game_id": self.source.game_id_format.format(game_id=entry["id"]),
"executable": self.source.executable_format.format( "executable": self.source.make_executable(
bottle_name=entry["bottle"]["name"], game_name=entry["name"] bottle_name=entry["bottle"]["name"],
game_name=entry["name"],
), ),
} }
game = Game(values) game = Game(values)

View File

@@ -82,9 +82,7 @@ class FlatpakSourceIterable(SourceIterable):
"added": added_time, "added": added_time,
"name": name, "name": name,
"game_id": self.source.game_id_format.format(game_id=flatpak_id), "game_id": self.source.game_id_format.format(game_id=flatpak_id),
"executable": self.source.executable_format.format( "executable": self.source.make_executable(flatpak_id=flatpak_id),
flatpak_id=flatpak_id
),
} }
game = Game(values) game = Game(values)

View File

@@ -108,9 +108,7 @@ class SubSourceIterable(Iterable):
"game_id": self.source.game_id_format.format( "game_id": self.source.game_id_format.format(
service=self.service, game_id=app_name service=self.service, game_id=app_name
), ),
"executable": self.source.executable_format.format( "executable": self.source.make_executable(runner=runner, app_name=app_name),
runner=runner, app_name=app_name
),
"hidden": self.source_iterable.is_hidden(app_name), "hidden": self.source_iterable.is_hidden(app_name),
} }
game = Game(values) game = Game(values)

View File

@@ -65,7 +65,7 @@ class ItchSourceIterable(SourceIterable):
"source": self.source.source_id, "source": self.source.source_id,
"name": row[1], "name": row[1],
"game_id": self.source.game_id_format.format(game_id=row[0]), "game_id": self.source.game_id_format.format(game_id=row[0]),
"executable": self.source.executable_format.format(cave_id=row[4]), "executable": self.source.make_executable(cave_id=row[4]),
} }
additional_data = {"online_cover_url": row[3] or row[2]} additional_data = {"online_cover_url": row[3] or row[2]}
game = Game(values) game = Game(values)

View File

@@ -28,8 +28,8 @@ from src.game import Game
from src.importer.sources.location import Location, LocationSubPath from src.importer.sources.location import Location, LocationSubPath
from src.importer.sources.source import ( from src.importer.sources.source import (
ExecutableFormatSource, ExecutableFormatSource,
SourceIterationResult,
SourceIterable, SourceIterable,
SourceIterationResult,
) )
@@ -50,7 +50,7 @@ class LegendarySourceIterable(SourceIterable):
"source": self.source.source_id, "source": self.source.source_id,
"name": entry["title"], "name": entry["title"],
"game_id": self.source.game_id_format.format(game_id=app_name), "game_id": self.source.game_id_format.format(game_id=app_name),
"executable": self.source.executable_format.format(app_name=app_name), "executable": self.source.make_executable(app_name=app_name),
} }
data = {} data = {}

View File

@@ -69,7 +69,7 @@ class LutrisSourceIterable(SourceIterable):
"game_id": self.source.game_id_format.format( "game_id": self.source.game_id_format.format(
runner=row[3], game_id=row[0] runner=row[3], game_id=row[0]
), ),
"executable": self.source.executable_format.format(game_id=row[0]), "executable": self.source.make_executable(game_id=row[0]),
} }
game = Game(values) game = Game(values)

View File

@@ -104,7 +104,7 @@ class ExecutableFormatSource(Source):
def make_executable(self, *args, **kwargs) -> str: def make_executable(self, *args, **kwargs) -> str:
"""Use the executable format to""" """Use the executable format to"""
return self.executable_format.format(args, kwargs) return self.executable_format.format(*args, **kwargs)
# pylint: disable=abstract-method # pylint: disable=abstract-method

View File

@@ -94,7 +94,7 @@ class SteamSourceIterable(SourceIterable):
"name": local_data["name"], "name": local_data["name"],
"source": self.source.source_id, "source": self.source.source_id,
"game_id": self.source.game_id_format.format(game_id=appid), "game_id": self.source.game_id_format.format(game_id=appid),
"executable": self.source.executable_format.format(game_id=appid), "executable": self.source.make_executable(game_id=appid),
} }
game = Game(values) game = Game(values)