🚧 SGDB
This commit is contained in:
@@ -2,7 +2,7 @@ from threading import Thread, Lock
|
||||
from gi.repository import Adw, Gtk, Gio
|
||||
|
||||
from .game import Game
|
||||
from .steamgriddb import SGDBSave
|
||||
from .steamgriddb import SGDBHelper
|
||||
|
||||
|
||||
class Importer:
|
||||
@@ -97,47 +97,20 @@ class Importer:
|
||||
|
||||
def __import_from_source(self, *args, **kwargs):
|
||||
"""Source import thread entry point"""
|
||||
# TODO just get Game objects from the sources
|
||||
source, *rest = args
|
||||
|
||||
iterator = source.__iter__()
|
||||
for game_values in iterator:
|
||||
game = Game(self.win, game_values)
|
||||
|
||||
for game in iterator:
|
||||
self.games_lock.acquire()
|
||||
self.games.add(game)
|
||||
self.games_lock.release()
|
||||
|
||||
# TODO SGDB image
|
||||
# Who's in charge of image adding ?
|
||||
|
||||
self.progress_lock.acquire()
|
||||
self.counts[source.id]["total"] = len(iterator)
|
||||
if not game.blacklisted:
|
||||
self.counts[source.id]["done"] += 1
|
||||
self.update_progressbar()
|
||||
self.progress_lock.release()
|
||||
|
||||
# TODO remove after not needed
|
||||
def save_game(self, values=None, cover_path=None):
|
||||
if values:
|
||||
game = Game(self.win, values)
|
||||
|
||||
if save_cover:
|
||||
save_cover(self.win, game.game_id, resize_cover(self.win, cover_path))
|
||||
|
||||
self.games.add(game)
|
||||
|
||||
self.games_no += 1
|
||||
if game.blacklisted:
|
||||
self.games_no -= 1
|
||||
|
||||
self.queue -= 1
|
||||
self.update_progressbar()
|
||||
|
||||
if self.queue == 0 and not self.blocker:
|
||||
if self.games:
|
||||
self.total_queue = len(self.games)
|
||||
self.queue = len(self.games)
|
||||
self.import_statuspage.set_title(_("Importing Covers…"))
|
||||
self.update_progressbar()
|
||||
SGDBSave(self.win, self.games, self)
|
||||
else:
|
||||
self.done()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from functools import cached_property
|
||||
from sqlite3 import connect
|
||||
|
||||
from src.game import Game
|
||||
from src.utils.save_cover import resize_cover, save_cover
|
||||
from src.importer.source import Source, SourceIterator
|
||||
from src.importer.decorators import replaced_by_schema_key, replaced_by_path
|
||||
@@ -55,6 +56,7 @@ class LutrisSourceIterator(SourceIterator):
|
||||
continue
|
||||
|
||||
# Build basic game
|
||||
# TODO decouple game creation from the window object (later)
|
||||
values = {
|
||||
"hidden": row[4],
|
||||
"name": row[1],
|
||||
@@ -65,6 +67,7 @@ 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)
|
||||
|
||||
# Save official image
|
||||
image_path = self.source.cache_location / "coverart" / f"{row[2]}.jpg"
|
||||
@@ -73,6 +76,7 @@ class LutrisSourceIterator(SourceIterator):
|
||||
save_cover(self.source.win, values["game_id"], resized)
|
||||
|
||||
# TODO Save SGDB
|
||||
SGDBSave(self.win, self.games, self)
|
||||
|
||||
return values
|
||||
|
||||
|
||||
Reference in New Issue
Block a user