musikr: clean up as-is setting
This commit is contained in:
parent
b48bf3729e
commit
859e31d825
3 changed files with 5 additions and 13 deletions
|
@ -21,8 +21,8 @@ package org.oxycblt.auxio.image.covers
|
|||
import java.util.UUID
|
||||
import org.oxycblt.musikr.cover.CoverParams
|
||||
|
||||
data class CoverSilo(val revision: UUID, val params: CoverParams) {
|
||||
override fun toString() = "${revision}.${params.resolution}.${params.quality}"
|
||||
data class CoverSilo(val revision: UUID, val params: CoverParams?) {
|
||||
override fun toString() = "${revision}.${params?.let { "${params.resolution}${params.quality}" }}"
|
||||
|
||||
companion object {
|
||||
fun parse(silo: String): CoverSilo? {
|
||||
|
|
|
@ -54,19 +54,11 @@ constructor(private val imageSettings: ImageSettings, private val identifier: Co
|
|||
CoverMode.SAVE_SPACE -> siloedCovers(context, revision, CoverParams.of(500, 70))
|
||||
CoverMode.BALANCED -> siloedCovers(context, revision, CoverParams.of(750, 85))
|
||||
CoverMode.HIGH_QUALITY -> siloedCovers(context, revision, CoverParams.of(1000, 100))
|
||||
CoverMode.AS_IS -> asIsCovers(context)
|
||||
CoverMode.AS_IS -> siloedCovers(context, revision, null)
|
||||
}
|
||||
|
||||
private suspend fun siloedCovers(context: Context, revision: UUID, with: CoverParams) =
|
||||
private suspend fun siloedCovers(context: Context, revision: UUID, with: CoverParams?) =
|
||||
MutableCovers.chain(
|
||||
MutableSiloedCovers.from(context, CoverSilo(revision, with), identifier),
|
||||
MutableFolderCovers(context))
|
||||
|
||||
private suspend fun asIsCovers(context: Context) =
|
||||
MutableCovers.chain(
|
||||
MutableFileCovers(
|
||||
AppFiles.at(context.coversDir().resolve("asis").also { it.mkdirs() }),
|
||||
CoverFormat.asIs(),
|
||||
identifier),
|
||||
MutableFolderCovers(context))
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ private data class SiloCore(val rootDir: File, val files: AppFiles, val format:
|
|||
revisionDir = rootDir.resolve(silo.toString()).apply { mkdirs() }
|
||||
}
|
||||
val files = AppFiles.at(revisionDir)
|
||||
val format = CoverFormat.jpeg(silo.params)
|
||||
val format = silo.params?.let(CoverFormat::jpeg) ?: CoverFormat.asIs()
|
||||
return SiloCore(rootDir, files, format)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue