Updated
This commit is contained in:
parent
ea8892ef3f
commit
fe47168718
@ -37,7 +37,7 @@ dependencies {
|
|||||||
implementation("org.json:json:20210307")
|
implementation("org.json:json:20210307")
|
||||||
|
|
||||||
implementation("no.iktdev:exfl:0.0.13-SNAPSHOT")
|
implementation("no.iktdev:exfl:0.0.13-SNAPSHOT")
|
||||||
implementation("no.iktdev.streamit.library:streamit-library-db:0.0.6-alpha22")
|
implementation("no.iktdev.streamit.library:streamit-library-db:0.0.6-alpha25")
|
||||||
|
|
||||||
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
|
||||||
|
|||||||
@ -25,6 +25,8 @@ class MetadataMapping(val events: List<PersistentMessage>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val videoInfo = mediaReadOut?.toValueObject()
|
val videoInfo = mediaReadOut?.toValueObject()
|
||||||
|
val collection = mediaReadOut?.outDirectory?.let { File(it).name } ?: baseInfo?.title
|
||||||
|
|
||||||
|
|
||||||
val mediaCover = if (coverDownloadTask != null || cover != null) {
|
val mediaCover = if (coverDownloadTask != null || cover != null) {
|
||||||
val coverFile = cover?.coverFile?.let { File(it) }
|
val coverFile = cover?.coverFile?.let { File(it) }
|
||||||
@ -36,13 +38,15 @@ class MetadataMapping(val events: List<PersistentMessage>) {
|
|||||||
} else null
|
} else null
|
||||||
|
|
||||||
return if (meta != null || videoInfo != null) {
|
return if (meta != null || videoInfo != null) {
|
||||||
|
|
||||||
MetadataDto(
|
MetadataDto(
|
||||||
title = meta?.data?.title ?: videoInfo?.fullName ?: return null,
|
title = videoInfo?.title ?: meta?.data?.title ?: baseInfo?.title ?: return null,
|
||||||
collection = baseInfo?.title ?: return null,
|
collection = collection ?: return null,
|
||||||
cover = mediaCover,
|
cover = mediaCover,
|
||||||
type = meta?.data?.type ?: videoInfo?.type ?: return null,
|
type = meta?.data?.type ?: videoInfo?.type ?: return null,
|
||||||
summary = meta?.data?.summary?.filter {it.summary != null }?.map { SummaryInfo(language = it.language, summary = it.summary!! ) } ?: emptyList(),
|
summary = meta?.data?.summary?.filter {it.summary != null }?.map { SummaryInfo(language = it.language, summary = it.summary!! ) } ?: emptyList(),
|
||||||
genres = meta?.data?.genres ?: emptyList(),
|
genres = meta?.data?.genres ?: emptyList(),
|
||||||
|
titles = meta?.data?.altTitle ?: emptyList()
|
||||||
)
|
)
|
||||||
} else null
|
} else null
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,9 @@ import no.iktdev.mediaprocessing.shared.kafka.dto.SimpleMessageData
|
|||||||
import no.iktdev.mediaprocessing.shared.kafka.dto.Status
|
import no.iktdev.mediaprocessing.shared.kafka.dto.Status
|
||||||
import no.iktdev.mediaprocessing.shared.kafka.dto.isSuccess
|
import no.iktdev.mediaprocessing.shared.kafka.dto.isSuccess
|
||||||
import no.iktdev.streamit.library.db.query.*
|
import no.iktdev.streamit.library.db.query.*
|
||||||
|
import no.iktdev.streamit.library.db.tables.titles
|
||||||
import org.jetbrains.exposed.exceptions.ExposedSQLException
|
import org.jetbrains.exposed.exceptions.ExposedSQLException
|
||||||
|
import org.jetbrains.exposed.sql.insertIgnore
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@ -70,6 +72,7 @@ class CollectAndStoreTask(@Autowired override var coordinator: Coordinator) : Ta
|
|||||||
|
|
||||||
mapped.metadata?.let {
|
mapped.metadata?.let {
|
||||||
storeMetadata(catalogId = catalogId, metadata = it)
|
storeMetadata(catalogId = catalogId, metadata = it)
|
||||||
|
storeTitles(collection = it.collection, it.title, contentTitles = it.titles)
|
||||||
}
|
}
|
||||||
|
|
||||||
return SimpleMessageData(Status.COMPLETED, derivedFromEventId = event.eventId)
|
return SimpleMessageData(Status.COMPLETED, derivedFromEventId = event.eventId)
|
||||||
@ -104,6 +107,21 @@ class CollectAndStoreTask(@Autowired override var coordinator: Coordinator) : Ta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun storeTitles(collection: String, usedTitle: String, contentTitles: List<String>) {
|
||||||
|
withTransaction(getStoreDatabase()) {
|
||||||
|
titles.insertIgnore {
|
||||||
|
it[titles.collection] = collection
|
||||||
|
it[titles.title] = usedTitle
|
||||||
|
}
|
||||||
|
contentTitles.forEach { title ->
|
||||||
|
titles.insertIgnore {
|
||||||
|
it[titles.collection] = collection
|
||||||
|
it[titles.title] = title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun storeAndGetGenres(genres: List<String>): String? {
|
private fun storeAndGetGenres(genres: List<String>): String? {
|
||||||
return withTransaction(getStoreDatabase()) {
|
return withTransaction(getStoreDatabase()) {
|
||||||
val gq = GenreQuery( *genres.toTypedArray() )
|
val gq = GenreQuery( *genres.toTypedArray() )
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import no.iktdev.mediaprocessing.shared.kafka.dto.events_result.MovieInfo
|
|||||||
import no.iktdev.mediaprocessing.shared.kafka.dto.events_result.VideoInfo
|
import no.iktdev.mediaprocessing.shared.kafka.dto.events_result.VideoInfo
|
||||||
|
|
||||||
|
|
||||||
class FileNameDeterminate(val title: String, val sanitizedName: String, val ctype: ContentType = ContentType.UNDEFINED) {
|
class FileNameDeterminate(val title: String, val sanitizedName: String, val ctype: ContentType = ContentType.UNDEFINED, val metaTitle: String? = null) {
|
||||||
|
|
||||||
enum class ContentType {
|
enum class ContentType {
|
||||||
MOVIE,
|
MOVIE,
|
||||||
@ -29,7 +29,7 @@ class FileNameDeterminate(val title: String, val sanitizedName: String, val ctyp
|
|||||||
else -> sanitizedName
|
else -> sanitizedName
|
||||||
}
|
}
|
||||||
val nonResolutioned = movieEx.removeResolutionAndBeyond(stripped) ?: stripped
|
val nonResolutioned = movieEx.removeResolutionAndBeyond(stripped) ?: stripped
|
||||||
return MovieInfo(title = cleanup(nonResolutioned), fullName = cleanup(nonResolutioned))
|
return MovieInfo(title = metaTitle ?: cleanup(nonResolutioned), fullName = cleanup(nonResolutioned))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun determineSerieFileName(): EpisodeInfo? {
|
private fun determineSerieFileName(): EpisodeInfo? {
|
||||||
@ -58,7 +58,7 @@ class FileNameDeterminate(val title: String, val sanitizedName: String, val ctyp
|
|||||||
}
|
}
|
||||||
} else title
|
} else title
|
||||||
val fullName = "${useTitle.trim()} - $seasonEpisodeCombined ${if (episodeTitle.isNullOrEmpty()) "" else " - $episodeTitle"}".trim()
|
val fullName = "${useTitle.trim()} - $seasonEpisodeCombined ${if (episodeTitle.isNullOrEmpty()) "" else " - $episodeTitle"}".trim()
|
||||||
return EpisodeInfo(title = title, episode = episodeNumber.toInt(), season = seasonNumber.toInt(), episodeTitle = episodeTitle, fullName = cleanup(fullName))
|
return EpisodeInfo(title = metaTitle ?: title, episode = episodeNumber.toInt(), season = seasonNumber.toInt(), episodeTitle = episodeTitle, fullName = cleanup(fullName))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun determineUndefinedFileName(): VideoInfo? {
|
private fun determineUndefinedFileName(): VideoInfo? {
|
||||||
|
|||||||
@ -7,6 +7,7 @@ data class MetadataDto(
|
|||||||
val cover: MetadataCoverDto?,
|
val cover: MetadataCoverDto?,
|
||||||
val summary: List<SummaryInfo> = emptyList(),
|
val summary: List<SummaryInfo> = emptyList(),
|
||||||
val genres: List<String>,
|
val genres: List<String>,
|
||||||
|
val titles: List<String> = emptyList()
|
||||||
)
|
)
|
||||||
|
|
||||||
data class SummaryInfo(
|
data class SummaryInfo(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user