feat: mix mood radio by seed percentage and embed download artwork
Moods now store a seedPercent (0-100, default 50). RadioService rolls that share independently for every queued slot: heads picks from the seed songs, tails from the generated recommendation pool. When one pool is empty the other fills the batch, so a mood never stalls. The DTO exposes both seedPercent and the derived recommendationPercent, and create/patch accept seedPercent. Automatic YT downloads now embed the video thumbnail as MP3 cover art so the scanner publishes a cover for newly imported tracks. V7 adds moods.seed_percent.
This commit is contained in:
1 parent
dd7bbde84d
commit
c75f2971b4
11 files changed
+146
-6
No files matched your search
@@ -26,6 +26,7 @@ data class MoodRecord(
|
||||
val query: String?,
|
||||
val genres: List<String>,
|
||||
val targetSize: Int,
|
||||
val seedPercent: Int = 50,
|
||||
val refreshHours: Int,
|
||||
val ytEnabled: Boolean,
|
||||
val lastDiscoveryAt: String?,
|
||||
@@ -99,6 +100,7 @@ object MoodRepository {
|
||||
refreshHours: Int,
|
||||
ytEnabled: Boolean,
|
||||
seedSongIds: List<String>,
|
||||
seedPercent: Int = 50,
|
||||
): MoodRecord = transaction {
|
||||
val now = Instant.now().toString()
|
||||
val id = IdGenerator.moodId(owner, name, now)
|
||||
@@ -111,6 +113,7 @@ object MoodRepository {
|
||||
it[MoodsTable.query] = query?.trim()?.takeIf(String::isNotEmpty)
|
||||
it[MoodsTable.genres] = encodeGenres(genres)
|
||||
it[MoodsTable.targetSize] = targetSize.coerceIn(5, 500)
|
||||
it[MoodsTable.seedPercent] = seedPercent.coerceIn(0, 100)
|
||||
it[MoodsTable.refreshHours] = refreshHours.coerceIn(1, 720)
|
||||
it[MoodsTable.ytEnabled] = ytEnabled
|
||||
it[createdAt] = now
|
||||
@@ -134,6 +137,7 @@ object MoodRepository {
|
||||
targetSize: Int,
|
||||
refreshHours: Int,
|
||||
ytEnabled: Boolean,
|
||||
seedPercent: Int = 50,
|
||||
): MoodRecord? = transaction {
|
||||
val exists = MoodsTable.selectAll()
|
||||
.where { (MoodsTable.id eq id) and (MoodsTable.owner eq owner) }
|
||||
@@ -146,6 +150,7 @@ object MoodRepository {
|
||||
it[MoodsTable.query] = query?.trim()?.takeIf(String::isNotEmpty)
|
||||
it[MoodsTable.genres] = encodeGenres(genres)
|
||||
it[MoodsTable.targetSize] = targetSize.coerceIn(5, 500)
|
||||
it[MoodsTable.seedPercent] = seedPercent.coerceIn(0, 100)
|
||||
it[MoodsTable.refreshHours] = refreshHours.coerceIn(1, 720)
|
||||
it[MoodsTable.ytEnabled] = ytEnabled
|
||||
it[changedAt] = Instant.now().toString()
|
||||
@@ -430,6 +435,7 @@ object MoodRepository {
|
||||
query = row[MoodsTable.query],
|
||||
genres = decodeGenres(row[MoodsTable.genres]),
|
||||
targetSize = row[MoodsTable.targetSize],
|
||||
seedPercent = row[MoodsTable.seedPercent],
|
||||
refreshHours = row[MoodsTable.refreshHours],
|
||||
ytEnabled = row[MoodsTable.ytEnabled],
|
||||
lastDiscoveryAt = row[MoodsTable.lastDiscoveryAt],
|
||||
|
||||
Reference in new issue
Block a user