🚧 More fixes

This commit is contained in:
GeoffreyCoulaud
2023-05-21 18:29:26 +02:00
parent e5d2657bb9
commit 9fd58e6ba3
7 changed files with 33 additions and 47 deletions

View File

@@ -4,6 +4,7 @@ from sqlite3 import connect
from time import time
from pathlib import Path
import src.shared as shared
from src.game import Game
from src.importer.source import Source, SourceIterator
from src.utils.decorators import replaced_by_path, replaced_by_schema_key
@@ -41,7 +42,7 @@ class LutrisSourceIterator(SourceIterator):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.import_steam = self.source.win.schema.get_boolean("lutris-import-steam")
self.import_steam = shared.schema.get_boolean("lutris-import-steam")
self.db_location = self.source.location / "pga.db"
self.db_connection = connect(self.db_location)
self.db_request_params = {"import_steam": self.import_steam}
@@ -77,13 +78,12 @@ class LutrisSourceIterator(SourceIterator):
"executable": self.source.executable_format.format(game_id=row[2]),
"developer": None, # TODO get developer metadata on Lutris
}
game = Game(self.source.win, values, allow_side_effects=False)
game = Game(values, allow_side_effects=False)
# Save official image
image_path = self.source.location / "covers" / "coverart" / f"{row[2]}.jpg"
if image_path.exists():
resized = resize_cover(self.source.win, image_path)
save_cover(self.source.win, values["game_id"], resized)
save_cover(values["game_id"], resize_cover(image_path))
return game

View File

@@ -84,7 +84,7 @@ class SteamSourceIterator(SourceIterator):
"game_id": self.source.game_id_format.format(game_id=appid),
"executable": self.source.executable_format.format(game_id=appid),
}
game = Game(self.source.win, values, allow_side_effects=False)
game = Game(values, allow_side_effects=False)
# Add official cover image
cover_path = (
@@ -94,9 +94,7 @@ class SteamSourceIterator(SourceIterator):
/ f"{appid}_library_600x900.jpg"
)
if cover_path.is_file():
save_cover(
self.source.win, game.game_id, resize_cover(self.source.win, cover_path)
)
save_cover(game.game_id, resize_cover(cover_path))
# Get online metadata
# TODO move to its own manager