Small tweaks
This commit is contained in:
parent
abe863f015
commit
1d8928a745
@ -136,42 +136,18 @@ class CompletedTaskListener : CoordinatorEventListener() {
|
||||
} else mediaInfo.fallbackCollection
|
||||
|
||||
val mover = ContentCompletionMover(usableCollection, events)
|
||||
val newVideoPath = mover.moveVideo()
|
||||
val newCoverPath = mover.moveCover()
|
||||
val newSubtitles = mover.moveSubtitles()
|
||||
|
||||
|
||||
val genreIdsForCatalog = ContentGenresStore.storeAndGetIds(mediaInfo.genres)
|
||||
val newCoverPath = mover.moveCover()
|
||||
|
||||
|
||||
val catalogId = ContentCatalogStore.storeCatalog(
|
||||
ContentCatalogStore.storeCatalog(
|
||||
title = mediaInfo.title,
|
||||
collection = usableCollection,
|
||||
type = mediaInfo.type,
|
||||
cover = newCoverPath?.second?.let { dp -> File(dp).name },
|
||||
genres = genreIdsForCatalog,
|
||||
)
|
||||
|
||||
getVideo(events)?.let { video ->
|
||||
ContentCatalogStore.storeMedia(
|
||||
title = mediaInfo.title,
|
||||
collection = usableCollection,
|
||||
type = mediaInfo.type,
|
||||
videoDetails = video
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
val storedSubtitles = newSubtitles?.let { subtitles ->
|
||||
subtitles.mapNotNull {
|
||||
ContentSubtitleStore.storeSubtitles(
|
||||
collection = usableCollection,
|
||||
language = it.language,
|
||||
destinationFile = File(it.destination)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
catalogId?.let { cid ->
|
||||
)?.also { cid ->
|
||||
mediaInfo.summaries.forEach {
|
||||
ContentMetadataStore.storeSummary(cid, it)
|
||||
}
|
||||
@ -179,6 +155,38 @@ class CompletedTaskListener : CoordinatorEventListener() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
val newVideoPath = mover.moveVideo()
|
||||
try {
|
||||
getVideo(events)?.let { video ->
|
||||
ContentCatalogStore.storeMedia(
|
||||
title = mediaInfo.title,
|
||||
collection = usableCollection,
|
||||
type = mediaInfo.type,
|
||||
videoDetails = video
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
val newSubtitles = mover.moveSubtitles()
|
||||
|
||||
try {
|
||||
newSubtitles?.let { subtitles ->
|
||||
subtitles.map {
|
||||
ContentSubtitleStore.storeSubtitles(
|
||||
collection = usableCollection,
|
||||
language = it.language,
|
||||
destinationFile = File(it.destination)
|
||||
)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
|
||||
if (!doNotProduceComplete) {
|
||||
onProduceEvent(MediaProcessCompletedEvent(
|
||||
metadata = event.makeDerivedEventInfo(EventStatus.Success, getProducerName()),
|
||||
|
||||
@ -38,7 +38,7 @@ class ContentCompletionMover(val collection: String, val events: List<Event>) {
|
||||
val result = encodedFile.moveTo(storeFile) {
|
||||
|
||||
}
|
||||
return if (result) Pair(encodedFile.absolutePath, storeFile.absolutePath) else null
|
||||
return if (result) Pair(encodedFile.absolutePath, storeFile.absolutePath) else throw RuntimeException("Unable to movie file ${encodedFile.absolutePath} to ${storeFile.absolutePath}")
|
||||
}
|
||||
|
||||
fun moveCover(): Pair<String, String>? {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user