diff --git a/src/importer/sources/lutris_source.py b/src/importer/sources/lutris_source.py index a916468..c656573 100644 --- a/src/importer/sources/lutris_source.py +++ b/src/importer/sources/lutris_source.py @@ -1,5 +1,6 @@ from functools import cached_property, cache from sqlite3 import connect +from time import time from src.game import Game from src.utils.save_cover import resize_cover, save_cover @@ -66,6 +67,7 @@ class LutrisSourceIterator(SourceIterator): # Create game row = self.__next_row() values = { + "added": int(time()), "hidden": row[4], "name": row[1], "source": f"{self.source.id}_{row[3]}", diff --git a/src/main.py b/src/main.py index d70e77c..60445b2 100644 --- a/src/main.py +++ b/src/main.py @@ -28,15 +28,11 @@ gi.require_version("Adw", "1") from gi.repository import Adw, Gio, GLib, Gtk from . import shared -from .bottles_importer import bottles_importer from .details_window import DetailsWindow -from .heroic_importer import heroic_importer -from .importer import Importer -from .itch_importer import itch_importer -from .lutris_importer import lutris_importer from .preferences import PreferencesWindow -from .steam_importer import steam_importer from .window import CartridgesWindow +from .importer import Importer +from .lutris_source import LutrisNativeSource, LutrisFlatpakSource class CartridgesApplication(Adw.Application): @@ -151,30 +147,11 @@ class CartridgesApplication(Adw.Application): DetailsWindow() def on_import_action(self, *_args): - shared.importer = Importer() - - shared.importer.blocker = True - - if shared.schema.get_boolean("steam"): - steam_importer() - - if shared.schema.get_boolean("lutris"): - lutris_importer() - - if shared.schema.get_boolean("heroic"): - heroic_importer() - - if shared.schema.get_boolean("bottles"): - bottles_importer() - - if shared.schema.get_boolean("itch"): - itch_importer() - - shared.importer.blocker = False - - if shared.importer.import_dialog.is_visible and shared.importer.queue == 0: - shared.importer.queue = 1 - shared.importer.save_game() + importer = Importer(self.win) + if self.win.schema.get_boolean("lutris"): + importer.add_source(LutrisNativeSource) + importer.add_source(LutrisFlatpakSource) + importer.import_games() def on_remove_game_action(self, *_args): self.win.active_game.remove_game() diff --git a/src/meson.build b/src/meson.build index 87099ba..617adf3 100644 --- a/src/meson.build +++ b/src/meson.build @@ -25,12 +25,8 @@ cartridges_sources = [ 'game.py', 'game_cover.py', 'shared.py', - 'importers/steam_importer.py', - 'importers/lutris_importer.py', - 'importers/heroic_importer.py', - 'importers/bottles_importer.py', - 'importers/itch_importer.py', - 'utils/importer.py', + 'importer/sources/lutris_source.py', + 'importer/importer.py', 'utils/steamgriddb.py', 'utils/save_cover.py', 'utils/create_dialog.py', diff --git a/src/utils/check_install.py b/src/utils/check_install.py deleted file mode 100644 index 5454be3..0000000 --- a/src/utils/check_install.py +++ /dev/null @@ -1,32 +0,0 @@ -# check_install.py -# -# Copyright 2022-2023 kramo -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# SPDX-License-Identifier: GPL-3.0-or-later - -from pathlib import Path - - -def check_install(check, locations, setting=None, subdirs=(Path(),)): - for location in locations: - for subdir in (Path(),) + subdirs: - if (location / subdir / check).is_file() or ( - location / subdir / check - ).exists(): - if setting: - setting[0].set_string(setting[1], str(location / subdir)) - - return location / subdir