diff --git a/PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporter.swift b/PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporter.swift index c77eaee799..4f666286b1 100644 --- a/PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporter.swift +++ b/PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporter.swift @@ -194,6 +194,10 @@ public final class GameImporter: GameImporting, ObservableObject { /// Path to the BIOS directory public var biosPath: URL { get { Paths.biosesPath }} + public var databaseService: GameImporterDatabaseServicing { + return gameImporterDatabaseService + } + /// Path to the conflicts directory public let conflictPath: URL = URL.documentsPath.appendingPathComponent("Conflicts/", isDirectory: true) diff --git a/PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporterDatabaseService.swift b/PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporterDatabaseService.swift index 633717c0ad..de65e7262f 100644 --- a/PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporterDatabaseService.swift +++ b/PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporterDatabaseService.swift @@ -21,11 +21,12 @@ import PVRealm import Perception import SwiftUI -protocol GameImporterDatabaseServicing { +public protocol GameImporterDatabaseServicing { func setOpenVGDB(_ vgdb: OpenVGDB) func setRomsPath(url:URL) func importGameIntoDatabase(queueItem: ImportQueueItem) async throws func importBIOSIntoDatabase(queueItem: ImportQueueItem) async throws + func getUpdatedGameInfo(for game: PVGame, forceRefresh: Bool) -> PVGame func getArtwork(forGame game: PVGame) async -> PVGame } diff --git a/PVUI/Sources/PVUIBase/Game Library/CollectionViewController/PVGameLibraryViewController.swift b/PVUI/Sources/PVUIBase/Game Library/CollectionViewController/PVGameLibraryViewController.swift index ccf4b3d364..c56a24cc71 100644 --- a/PVUI/Sources/PVUIBase/Game Library/CollectionViewController/PVGameLibraryViewController.swift +++ b/PVUI/Sources/PVUIBase/Game Library/CollectionViewController/PVGameLibraryViewController.swift @@ -1010,8 +1010,9 @@ public final class PVGameLibraryViewController: GCEventViewController, UITextFie self.hud.hide(animated:true, afterDelay: 1.0) Task.detached(priority: .utility) { do { - //TODO: fix this - //try await self.gameImporter.importFiles(atPaths: paths) + //unclear if this would actually work... + self.gameImporter.addImports(forPaths: paths) + self.gameImporter.startProcessing() } catch { ELOG("Error: \(error.localizedDescription)") } diff --git a/PVUI/Sources/PVUIBase/Game Library/PVGameMoreInfoViewController.swift b/PVUI/Sources/PVUIBase/Game Library/PVGameMoreInfoViewController.swift index 6a9996cacb..b8a57279fc 100644 --- a/PVUI/Sources/PVUIBase/Game Library/PVGameMoreInfoViewController.swift +++ b/PVUI/Sources/PVUIBase/Game Library/PVGameMoreInfoViewController.swift @@ -707,7 +707,7 @@ public final class PVGameMoreInfoViewController: PVGameMoreInfoViewControllerBas Task { [weak self] in guard let self = self else { return } //TODO: fix this - //self.game = GameImporter.shared.lookupInfo(for: game, overwrite: false) + self.game = GameImporter.shared.databaseService.getUpdatedGameInfo(for: game, forceRefresh: false) } } }