app: introduce as-is covers
Risks extreme instability since I am no longer in control of format, but some users just want very high-quality covers.
This commit is contained in:
@@ -141,4 +141,6 @@ object IntegerTable {
|
||||
const val PLAY_SONG_BY_ITSELF = 0xA124
|
||||
/** CoverMode.SaveSpace */
|
||||
const val COVER_MODE_SAVE_SPACE = 0xA125
|
||||
/** CoverMode.AsIs */
|
||||
const val COVER_MODE_AS_IS = 0xA126
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ enum class CoverMode {
|
||||
OFF,
|
||||
SAVE_SPACE,
|
||||
BALANCED,
|
||||
HIGH_QUALITY;
|
||||
HIGH_QUALITY,
|
||||
AS_IS;
|
||||
|
||||
/**
|
||||
* The integer representation of this instance.
|
||||
@@ -43,6 +44,7 @@ enum class CoverMode {
|
||||
SAVE_SPACE -> IntegerTable.COVER_MODE_SAVE_SPACE
|
||||
BALANCED -> IntegerTable.COVER_MODE_BALANCED
|
||||
HIGH_QUALITY -> IntegerTable.COVER_MODE_HIGH_QUALITY
|
||||
AS_IS -> IntegerTable.COVER_MODE_AS_IS
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -59,6 +61,7 @@ enum class CoverMode {
|
||||
IntegerTable.COVER_MODE_SAVE_SPACE -> SAVE_SPACE
|
||||
IntegerTable.COVER_MODE_BALANCED -> BALANCED
|
||||
IntegerTable.COVER_MODE_HIGH_QUALITY -> HIGH_QUALITY
|
||||
IntegerTable.COVER_MODE_AS_IS -> AS_IS
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,13 +24,16 @@ import javax.inject.Inject
|
||||
import org.oxycblt.auxio.image.CoverMode
|
||||
import org.oxycblt.auxio.image.ImageSettings
|
||||
import org.oxycblt.musikr.cover.Cover
|
||||
import org.oxycblt.musikr.cover.CoverFormat
|
||||
import org.oxycblt.musikr.cover.CoverIdentifier
|
||||
import org.oxycblt.musikr.cover.CoverParams
|
||||
import org.oxycblt.musikr.cover.Covers
|
||||
import org.oxycblt.musikr.cover.FileCover
|
||||
import org.oxycblt.musikr.cover.FolderCovers
|
||||
import org.oxycblt.musikr.cover.MutableCovers
|
||||
import org.oxycblt.musikr.cover.MutableFileCovers
|
||||
import org.oxycblt.musikr.cover.MutableFolderCovers
|
||||
import org.oxycblt.musikr.fs.app.AppFiles
|
||||
|
||||
interface SettingCovers {
|
||||
suspend fun mutate(context: Context, revision: UUID): MutableCovers<out Cover>
|
||||
@@ -51,10 +54,19 @@ 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)
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user