This commit is contained in:
kramo
2024-03-23 20:28:36 +01:00
parent 2b93a1feeb
commit aec8a4efa7

View File

@@ -54,6 +54,9 @@ class LutrisSourceIterable(SourceIterable):
db_path = copy_db(self.source.locations.data["pga.db"]) db_path = copy_db(self.source.locations.data["pga.db"])
connection = connect(db_path) connection = connect(db_path)
cursor = connection.execute(request, params) cursor = connection.execute(request, params)
coverart_is_dir = (
coverart_path := self.source.locations.data.root / "coverart"
).is_dir()
# Create games from the DB results # Create games from the DB results
for row in cursor: for row in cursor:
@@ -69,10 +72,12 @@ class LutrisSourceIterable(SourceIterable):
"executable": self.source.make_executable(game_id=row[0]), "executable": self.source.make_executable(game_id=row[0]),
} }
game = Game(values) game = Game(values)
additional_data = {}
# Get official image path # Get official image path
image_path = self.source.locations.data["coverart"] / f"{row[2]}.jpg" if coverart_is_dir:
additional_data = {"local_image_path": image_path} image_path = coverart_path / f"{row[2]}.jpg"
additional_data["local_image_path"] = image_path
yield (game, additional_data) yield (game, additional_data)
@@ -111,7 +116,6 @@ class LutrisSource(URLExecutableSource):
), ),
paths={ paths={
"pga.db": LocationSubPath("pga.db"), "pga.db": LocationSubPath("pga.db"),
"coverart": LocationSubPath("coverart", True),
}, },
invalid_subtitle=Location.DATA_INVALID_SUBTITLE, invalid_subtitle=Location.DATA_INVALID_SUBTITLE,
) )