mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-15 08:15:37 +00:00
Got 3rd party dependencies working in development mode
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package de.grimsi.gameyfin.plugins.igdb
|
||||
|
||||
import com.api.igdb.request.IGDBWrapper
|
||||
import com.api.igdb.request.TwitchAuthenticator
|
||||
import de.grimsi.gameyfin.pluginapi.core.PluginConfigError
|
||||
import de.grimsi.gameyfin.pluginapi.gamemetadata.GameMetadata
|
||||
import de.grimsi.gameyfin.pluginapi.gamemetadata.GameMetadataFetcher
|
||||
import org.pf4j.Extension
|
||||
@@ -9,24 +12,39 @@ import java.time.Instant
|
||||
|
||||
class IgdbPlugin(wrapper: PluginWrapper) : Plugin(wrapper) {
|
||||
|
||||
companion object {
|
||||
val config: IgdbPluginConfig = IgdbPluginConfig(null, null)
|
||||
}
|
||||
|
||||
override fun start() {
|
||||
println("IgdbPlugin.start()")
|
||||
authenticate()
|
||||
}
|
||||
|
||||
override fun stop() {
|
||||
println("IgdbPlugin.stop()")
|
||||
log.debug("IgdbPlugin.stop()")
|
||||
}
|
||||
|
||||
private fun authenticate() {
|
||||
log.debug("Authenticating on Twitch API...")
|
||||
|
||||
// FIXME: This should be read from the config
|
||||
val clientId = "8nrnjn74x1oa7of2g8sg4voy2lapml"
|
||||
// FIXME: This should be read from the config
|
||||
val clientSecret = "pyrvg3sdduxjg4qxidra9237xj17yn"
|
||||
|
||||
// val clientId: String = config.clientId ?: throw PluginConfigError("Twitch Client ID not set")
|
||||
// val clientSecret: String = config.clientSecret ?: throw PluginConfigError("Twitch Client Secret not set")
|
||||
|
||||
val token = TwitchAuthenticator.requestTwitchToken(clientId, clientSecret)
|
||||
?: throw PluginConfigError("Failed to authenticate on Twitch API")
|
||||
|
||||
IGDBWrapper.setCredentials(clientId, token.access_token)
|
||||
|
||||
log.debug("Authentication successful")
|
||||
}
|
||||
|
||||
@Extension
|
||||
class IgdbMetadataFetcher : GameMetadataFetcher {
|
||||
override fun getConfig(): Map<String, String> {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun setConfig(config: Map<String, String>) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun fetchMetadata(gameId: String): GameMetadata {
|
||||
return GameMetadata(
|
||||
title = "Test Game",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package de.grimsi.gameyfin.plugins.igdb
|
||||
|
||||
data class IgdbPluginConfig(
|
||||
val clientId: String?,
|
||||
val clientSecret: String?
|
||||
)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package de.grimsi.gameyfin.plugins.igdb.dto
|
||||
|
||||
data class TwitchOAuthTokenDto(
|
||||
val accessToken: String,
|
||||
val expiresIn: Int,
|
||||
val tokenType: String
|
||||
)
|
||||
Reference in New Issue
Block a user