Update Plugin API (and plugins)

Fix issue with persisting new games
This commit is contained in:
grimsi
2024-12-21 23:43:38 +01:00
parent 890748fb7c
commit eb14007190
14 changed files with 96 additions and 49 deletions
@@ -122,6 +122,7 @@ class IgdbPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
return GameMetadata(
title = game.name,
description = game.summary,
coverUrl = Mapper.cover(game.cover),
release = Instant.ofEpochSecond(game.firstReleaseDate.seconds),
userRating = game.rating.toInt(),
criticRating = game.aggregatedRating.toInt(),
@@ -95,7 +95,11 @@ class Mapper {
}
fun screenshot(screenshot: proto.Screenshot): URL {
return URI(imageBuilder(screenshot.imageId, ImageSize.SCREENSHOT_HUGE, ImageType.PNG)).toURL()
return URI(imageBuilder(screenshot.imageId, ImageSize.FHD, ImageType.PNG)).toURL()
}
fun cover(cover: proto.Cover): URL {
return URI(imageBuilder(cover.imageId, ImageSize.COVER_BIG, ImageType.PNG)).toURL()
}
fun video(video: proto.GameVideo): URL {
@@ -18,6 +18,7 @@ import org.pf4j.Extension
import org.pf4j.PluginWrapper
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.net.URI
import java.net.URLEncoder
import java.nio.charset.StandardCharsets
import java.time.Instant
@@ -109,6 +110,7 @@ class SteamPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
val metadata = GameMetadata(
title = string(game, "name"),
description = string(game, "detailed_description"),
coverUrl = URI("").toURL(),
release = date(game["release_date"]?.jsonObject["date"]?.jsonPrimitive?.content!!),
userRating = 0,
criticRating = 0,