mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-16 16:20:04 +00:00
Code cleanup
This commit is contained in:
@@ -94,14 +94,4 @@ class EntityUpdateInterceptor() : Interceptor {
|
|||||||
|
|
||||||
return reconstructed
|
return reconstructed
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun extractGameImages(game: Game): List<Image> {
|
|
||||||
val images = mutableListOf<Image>()
|
|
||||||
|
|
||||||
game.coverImage?.let { images.add(it) }
|
|
||||||
game.headerImage?.let { images.add(it) }
|
|
||||||
images.addAll(game.images)
|
|
||||||
|
|
||||||
return images
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,8 +104,7 @@ class GameService(
|
|||||||
return entities.toDtos()
|
return entities.toDtos()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
private fun create(game: Game): Game {
|
||||||
fun create(game: Game): Game? {
|
|
||||||
game.publishers = game.publishers.map { companyService.createOrGet(it) }.toMutableList()
|
game.publishers = game.publishers.map { companyService.createOrGet(it) }.toMutableList()
|
||||||
game.developers = game.developers.map { companyService.createOrGet(it) }.toMutableList()
|
game.developers = game.developers.map { companyService.createOrGet(it) }.toMutableList()
|
||||||
|
|
||||||
@@ -124,7 +123,6 @@ class GameService(
|
|||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
log.error { "Error downloading images for game '${game.title}' (${game.id}): ${e.message}" }
|
log.error { "Error downloading images for game '${game.title}' (${game.id}): ${e.message}" }
|
||||||
log.debug(e) {}
|
log.debug(e) {}
|
||||||
null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
game.metadata.fileSize = filesystemService.calculateFileSize(game.metadata.path)
|
game.metadata.fileSize = filesystemService.calculateFileSize(game.metadata.path)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class ImageEndpoint(
|
|||||||
@GetMapping("/plugins/{id}/logo")
|
@GetMapping("/plugins/{id}/logo")
|
||||||
fun getPluginLogo(@PathVariable("id") pluginId: String): ResponseEntity<ByteArrayResource>? {
|
fun getPluginLogo(@PathVariable("id") pluginId: String): ResponseEntity<ByteArrayResource>? {
|
||||||
val logo = pluginService.getLogo(pluginId)
|
val logo = pluginService.getLogo(pluginId)
|
||||||
return Utils.Companion.inputStreamToResponseEntity(logo)
|
return Utils.inputStreamToResponseEntity(logo)
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/avatar")
|
@GetMapping("/avatar")
|
||||||
@@ -85,7 +85,7 @@ class ImageEndpoint(
|
|||||||
userService.deleteAvatar(name)
|
userService.deleteAvatar(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getImageContent(id: Long): ResponseEntity<InputStreamResource>? {
|
private fun getImageContent(id: Long): ResponseEntity<InputStreamResource> {
|
||||||
val image = imageService.getImage(id) ?: return ResponseEntity.notFound().build()
|
val image = imageService.getImage(id) ?: return ResponseEntity.notFound().build()
|
||||||
|
|
||||||
val file = image.let { imageService.getFileContent(it) }
|
val file = image.let { imageService.getFileContent(it) }
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.gameyfin.app.media
|
package org.gameyfin.app.media
|
||||||
|
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
|
||||||
import org.apache.tika.Tika
|
import org.apache.tika.Tika
|
||||||
import org.apache.tika.io.TikaInputStream
|
import org.apache.tika.io.TikaInputStream
|
||||||
import org.gameyfin.app.core.events.GameDeletedEvent
|
import org.gameyfin.app.core.events.GameDeletedEvent
|
||||||
@@ -29,7 +28,6 @@ class ImageService(
|
|||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
private val tika = Tika()
|
private val tika = Tika()
|
||||||
private val log = KotlinLogging.logger {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TransactionalEventListener(
|
@TransactionalEventListener(
|
||||||
|
|||||||
Reference in New Issue
Block a user