feat: choose Deezer or YouTube Music per mood
CI / build (push) Successful in 3m35s
CI / play (push) Skipped

- models carry source and externalId instead of videoId
- AppCache v3 discards the old shape
- source selector in the create dialog, mood settings and search screen
- switching source patches the mood and re-runs the search
- client requests ten catalog results with a 60s timeout
This commit is contained in:
TapTap committed 2026-11-17 07:32:40 +00:00
1 parent 96ab25a91d
commit 3b40726edb
14 files changed
+338 -76

No files matched your search

+16 -11
View File
@@ -5,7 +5,7 @@ self-hosted music server.
The client and server are designed together. There is no OpenSubsonic The client and server are designed together. There is no OpenSubsonic
compatibility layer: the app speaks the native `/api/v1` API, where playback is compatibility layer: the app speaks the native `/api/v1` API, where playback is
a server-driven radio session and songs are added by searching YouTube Music. a server-driven radio session and songs are added from Deezer or YouTube Music.
## Targets ## Targets
@@ -22,9 +22,9 @@ a server-driven radio session and songs are added by searching YouTube Music.
- **Moods** are the only content model. Each user sees only their own moods. - **Moods** are the only content model. Each user sees only their own moods.
- **Songs** belong to the mood's permanent collection. A mood needs at least one - **Songs** belong to the mood's permanent collection. A mood needs at least one
song before it can play. song before it can play.
- **Search YouTube Music** from inside a mood or globally with a mood picker. - **Search Deezer or YouTube Music** from inside a mood or globally with a mood
Results are canonical songs with artist, album and duration; tracks over 10 picker. Each mood has a **Download source** selector; search, recommendations
minutes are hidden. Results that are already downloaded are marked and and downloads follow it. Tracks over 10 minutes are hidden. Results that are already downloaded are marked and
add instantly; other videos are queued for server-side download. add instantly; other videos are queued for server-side download.
- **Paste a YouTube URL** to add a specific video. - **Paste a YouTube URL** to add a specific video.
- **Recommendations** are downloaded automatically and play in the radio without - **Recommendations** are downloaded automatically and play in the radio without
@@ -70,7 +70,8 @@ a server-driven radio session and songs are added by searching YouTube Music.
- **Moods** — grid with song and pick counts, create, global search. - **Moods** — grid with song and pick counts, create, global search.
- **Mood Detail** — songs, add music, recommendations, next batch, settings. - **Mood Detail** — songs, add music, recommendations, next batch, settings.
- **Search** — mood picker, YouTube Music search, paste URL, downloaded badges. - **Search** — mood picker, source selector, catalog search, paste URL,
downloaded badges.
- **Downloads** — offline files and storage usage. - **Downloads** — offline files and storage usage.
- **Settings** — account, server URL, offline storage, sign out. - **Settings** — account, server URL, offline storage, sign out.
@@ -192,7 +193,7 @@ Tagged builds (`v*`) publish to internal testing from CI. The Gitea secrets are:
| `ANDROID_KEY_PASSWORD` | key password | | `ANDROID_KEY_PASSWORD` | key password |
| `PLAY_SERVICE_ACCOUNT_JSON` | contents of the service account JSON | | `PLAY_SERVICE_ACCOUNT_JSON` | contents of the service account JSON |
Then `git tag v0.2.0 && git push --tags` builds, signs and uploads the bundle. Then `git tag v0.3.0 && git push --tags` builds, signs and uploads the bundle.
Gradle Play Publisher asks Play for the next free `versionCode` Gradle Play Publisher asks Play for the next free `versionCode`
(`ResolutionStrategy.AUTO`), so only the tag/version name needs to change. (`ResolutionStrategy.AUTO`), so only the tag/version name needs to change.
@@ -205,7 +206,8 @@ it. It owns:
- **Mood sync** — GET `/moods` on login/refresh; details are fetched when a mood - **Mood sync** — GET `/moods` on login/refresh; details are fetched when a mood
is opened and cached. is opened and cached.
- **Mood cache** — cached details power offline mood lists and downloads. - **Mood cache** — cached details power offline mood lists and downloads.
- **Search** — debounced remote YouTube Music search with the selected target mood. - **Search** — debounced remote catalog search with the selected target mood and
its source.
- **Radio** — one session per mood, batches of 12, prefetch when the queue is - **Radio** — one session per mood, batches of 12, prefetch when the queue is
short, no repeats within a session. short, no repeats within a session.
- **Downloads** — stored under the platform app directory, keyed by the shared - **Downloads** — stored under the platform app directory, keyed by the shared
@@ -265,8 +267,11 @@ scripts/build-ci-image.sh 3
streams and caches metadata. streams and caches metadata.
- Downloads store the 320 px cover next to the MP3 (`<songId>.jpg`), so the - Downloads store the 320 px cover next to the MP3 (`<songId>.jpg`), so the
in-app cover and the Android notification artwork survive without the server. in-app cover and the Android notification artwork survive without the server.
- Search and downloads depend on `yt-dlp` on the server. YouTube bot checks can - Search and downloads depend on the server's catalogs. YouTube bot checks can
fail a search (`502`) or leave a recommendation in `failed` with Retry. fail a YouTube Music search (`502`) or leave a recommendation in `failed`
Music search resolves every result for its artist/album/duration, so a search with Retry. Music search resolves every result for its artist/album/duration,
takes roughly 10–15 seconds for ten results. so a YouTube Music search takes roughly 10–15 seconds for ten results;
Deezer search is much faster.
- Deezer downloads need `DEEZER_ARL` on the server. A Free ARL is limited to
128 kbps; Premium enables 320 kbps. The client never stores the ARL.
- No iOS target yet. The shared module is ready for one. - No iOS target yet. The shared module is ready for one.
+1 -1
View File
@@ -41,7 +41,7 @@ val hasUploadKey = uploadKeyStore?.exists() == true &&
val appVersionCode = (System.getenv("VERSION_CODE") ?: localProperties.getProperty("VERSION_CODE") ?: "1").toInt() val appVersionCode = (System.getenv("VERSION_CODE") ?: localProperties.getProperty("VERSION_CODE") ?: "1").toInt()
val appVersionName = System.getenv("VERSION_NAME") val appVersionName = System.getenv("VERSION_NAME")
?: localProperties.getProperty("VERSION_NAME") ?: localProperties.getProperty("VERSION_NAME")
?: "0.2.0" ?: "0.3.0"
kotlin { kotlin {
androidTarget { androidTarget {
@@ -125,14 +125,22 @@ class ApiClient(private val http: HttpClient) {
suspend fun addSong( suspend fun addSong(
moodId: String, moodId: String,
songId: String? = null, songId: String? = null,
videoId: String? = null, source: String? = null,
externalId: String? = null,
url: String? = null, url: String? = null,
): AddSongResponse = ): AddSongResponse =
parse( parse(
http.post(url("/moods/$moodId/songs")) { http.post(url("/moods/$moodId/songs")) {
auth() auth()
contentType(ContentType.Application.Json) contentType(ContentType.Application.Json)
setBody(AddSongRequest(songId = songId, videoId = videoId, url = url)) setBody(
AddSongRequest(
songId = songId,
source = source,
externalId = externalId,
url = url,
),
)
}, },
) )
@@ -155,23 +163,23 @@ class ApiClient(private val http: HttpClient) {
}, },
) )
suspend fun addRecommendation(moodId: String, videoId: String): RecommendationDecision = suspend fun addRecommendation(moodId: String, externalId: String): RecommendationDecision =
parse( parse(
http.post(url("/moods/$moodId/recommendations/$videoId/add")) { http.post(url("/moods/$moodId/recommendations/$externalId/add")) {
auth() auth()
}, },
) )
suspend fun rejectRecommendation(moodId: String, videoId: String): RecommendationDecision = suspend fun rejectRecommendation(moodId: String, externalId: String): RecommendationDecision =
parse( parse(
http.post(url("/moods/$moodId/recommendations/$videoId/reject")) { http.post(url("/moods/$moodId/recommendations/$externalId/reject")) {
auth() auth()
}, },
) )
suspend fun retryRecommendation(moodId: String, videoId: String): MoodDetail = suspend fun retryRecommendation(moodId: String, externalId: String): MoodDetail =
parse( parse(
http.post(url("/moods/$moodId/recommendations/$videoId/retry")) { http.post(url("/moods/$moodId/recommendations/$externalId/retry")) {
auth() auth()
}, },
) )
@@ -179,10 +187,16 @@ class ApiClient(private val http: HttpClient) {
suspend fun preview(moodId: String, limit: Int = 20): List<Song> = suspend fun preview(moodId: String, limit: Int = 20): List<Song> =
get<TracksResponse>("/moods/$moodId/preview?limit=$limit").songs get<TracksResponse>("/moods/$moodId/preview?limit=$limit").songs
suspend fun search(query: String, limit: Int = 10, moodId: String? = null): List<SearchResult> { suspend fun search(
query: String,
limit: Int = 10,
source: String? = null,
moodId: String? = null,
): List<SearchResult> {
val sourceParam = source?.let { "&source=${it.encodeURLParameter()}" }.orEmpty()
val mood = moodId?.let { "&moodId=${it.encodeURLParameter()}" }.orEmpty() val mood = moodId?.let { "&moodId=${it.encodeURLParameter()}" }.orEmpty()
return parse<SearchResponse>( return parse<SearchResponse>(
http.get(url("/search?q=${query.encodeURLParameter()}&limit=$limit$mood")) { http.get(url("/search?q=${query.encodeURLParameter()}&limit=$limit$sourceParam$mood")) {
auth() auth()
// yt-dlp resolves every YouTube Music hit to get artist, album // yt-dlp resolves every YouTube Music hit to get artist, album
// and duration, so a search takes longer than a plain API call. // and duration, so a search takes longer than a plain API call.
@@ -35,7 +35,8 @@ data class LoginResponse(
@Serializable @Serializable
data class Song( data class Song(
val id: String, val id: String,
val videoId: String, val source: String = "youtube",
val externalId: String,
val title: String, val title: String,
val artist: String, val artist: String,
val album: String? = null, val album: String? = null,
@@ -55,6 +56,7 @@ data class Mood(
val description: String? = null, val description: String? = null,
val query: String? = null, val query: String? = null,
val genres: List<String> = emptyList(), val genres: List<String> = emptyList(),
val source: String = "youtube",
val collectionPercent: Int = 50, val collectionPercent: Int = 50,
val recommendationPercent: Int = 50, val recommendationPercent: Int = 50,
val recommendationCount: Int = 10, val recommendationCount: Int = 10,
@@ -86,7 +88,8 @@ data class Download(
@Serializable @Serializable
data class Recommendation( data class Recommendation(
val videoId: String, val source: String = "youtube",
val externalId: String,
val title: String, val title: String,
val artist: String, val artist: String,
val album: String? = null, val album: String? = null,
@@ -121,7 +124,8 @@ data class RecommendationDecision(
@Serializable @Serializable
data class SearchResult( data class SearchResult(
val videoId: String, val source: String = "youtube",
val externalId: String,
val title: String, val title: String,
val artist: String, val artist: String,
val album: String? = null, val album: String? = null,
@@ -180,7 +184,8 @@ data class AddToMoodResponse(val mood: Mood, val added: Boolean)
@Serializable @Serializable
data class AddSongRequest( data class AddSongRequest(
val songId: String? = null, val songId: String? = null,
val videoId: String? = null, val source: String? = null,
val externalId: String? = null,
val url: String? = null, val url: String? = null,
) )
@@ -197,6 +202,7 @@ data class CreateMoodRequest(
val description: String? = null, val description: String? = null,
val query: String? = null, val query: String? = null,
val genres: List<String> = emptyList(), val genres: List<String> = emptyList(),
val source: String? = null,
val collectionPercent: Int = 50, val collectionPercent: Int = 50,
val recommendationCount: Int = 10, val recommendationCount: Int = 10,
val refreshHours: Int = 24, val refreshHours: Int = 24,
@@ -210,6 +216,7 @@ data class UpdateMoodRequest(
val query: String? = null, val query: String? = null,
val clearQuery: Boolean = false, val clearQuery: Boolean = false,
val genres: List<String>? = null, val genres: List<String>? = null,
val source: String? = null,
val collectionPercent: Int? = null, val collectionPercent: Int? = null,
val recommendationCount: Int? = null, val recommendationCount: Int? = null,
val refreshHours: Int? = null, val refreshHours: Int? = null,
@@ -16,8 +16,8 @@ data class SessionState(
) )
/** /**
* Offline cache. Version 2 holds moods and their details only; the old * Offline cache. Version 3 adds the download source and the source-neutral
* mounted-library shape is discarded instead of silently mis-decoding. * external track id; older shapes are discarded instead of mis-decoding.
*/ */
@Serializable @Serializable
data class CachedState( data class CachedState(
@@ -28,7 +28,7 @@ data class CachedState(
val moodDetails: List<MoodDetail> = emptyList(), val moodDetails: List<MoodDetail> = emptyList(),
) { ) {
companion object { companion object {
const val CACHE_VERSION = 2 const val CACHE_VERSION = 3
} }
} }
@@ -363,7 +363,15 @@ class AppStore(
delay(SEARCH_DEBOUNCE_MS) delay(SEARCH_DEBOUNCE_MS)
_state.update { it.copy(searching = true) } _state.update { it.copy(searching = true) }
try { try {
val results = api.search(query, SEARCH_LIMIT, _state.value.searchTargetMoodId) val target = _state.value.moods.firstOrNull {
it.id == _state.value.searchTargetMoodId
}
val results = api.search(
query,
SEARCH_LIMIT,
source = target?.source ?: DEFAULT_SOURCE,
moodId = _state.value.searchTargetMoodId,
)
_state.update { it.copy(searchResults = results) } _state.update { it.copy(searchResults = results) }
} catch (t: CancellationException) { } catch (t: CancellationException) {
throw t throw t
@@ -393,7 +401,11 @@ class AppStore(
val response = if (result.songId != null) { val response = if (result.songId != null) {
api.addSong(target, songId = result.songId) api.addSong(target, songId = result.songId)
} else { } else {
api.addSong(target, videoId = result.videoId) api.addSong(
target,
source = result.source,
externalId = result.externalId,
)
} }
applyMoodDetail(response.detail) applyMoodDetail(response.detail)
val title = response.detail.mood.name val title = response.detail.mood.name
@@ -451,6 +463,7 @@ class AppStore(
description: String?, description: String?,
genres: List<String>, genres: List<String>,
query: String?, query: String?,
source: String,
collectionPercent: Int, collectionPercent: Int,
recommendationCount: Int, recommendationCount: Int,
refreshHours: Int, refreshHours: Int,
@@ -464,6 +477,7 @@ class AppStore(
description = description?.takeIf { it.isNotBlank() }, description = description?.takeIf { it.isNotBlank() },
query = query?.takeIf { it.isNotBlank() }, query = query?.takeIf { it.isNotBlank() },
genres = genres, genres = genres,
source = source,
collectionPercent = collectionPercent, collectionPercent = collectionPercent,
recommendationCount = recommendationCount, recommendationCount = recommendationCount,
refreshHours = refreshHours, refreshHours = refreshHours,
@@ -495,12 +509,42 @@ class AppStore(
} }
} }
/**
* Changes the mood's catalog. The server clears the active recommendation
* pool and refills it from the new source; permanent songs stay.
*/
fun setMoodSource(moodId: String, source: String) {
val current = _state.value.moods.firstOrNull { it.id == moodId } ?: return
if (current.source == source) return
scope.launch {
try {
val updated = api.updateMood(moodId, UpdateMoodRequest(source = source))
applyMoodDetail(updated)
_state.update {
it.copy(
message = "Download source changed to ${sourceLabel(source)}",
messageIsError = false,
messageId = it.messageId + 1,
)
}
if (_state.value.searchTargetMoodId == moodId &&
_state.value.searchQuery.isNotBlank()
) {
search(_state.value.searchQuery)
}
} catch (t: Throwable) {
message(t)
}
}
}
fun saveMood( fun saveMood(
detail: MoodDetail, detail: MoodDetail,
name: String, name: String,
description: String?, description: String?,
genres: List<String>, genres: List<String>,
query: String?, query: String?,
source: String,
collectionPercent: Int, collectionPercent: Int,
recommendationCount: Int, recommendationCount: Int,
refreshHours: Int, refreshHours: Int,
@@ -517,6 +561,7 @@ class AppStore(
query = query ?: "", query = query ?: "",
clearQuery = query.isNullOrBlank(), clearQuery = query.isNullOrBlank(),
genres = genres, genres = genres,
source = source,
collectionPercent = collectionPercent, collectionPercent = collectionPercent,
recommendationCount = recommendationCount, recommendationCount = recommendationCount,
refreshHours = refreshHours, refreshHours = refreshHours,
@@ -612,13 +657,13 @@ class AppStore(
} }
} }
fun addRecommendation(videoId: String) { fun addRecommendation(externalId: String) {
val moodId = _state.value.selectedMood?.mood?.id ?: return val moodId = _state.value.selectedMood?.mood?.id ?: return
if (_state.value.discovering) return if (_state.value.discovering) return
scope.launch { scope.launch {
_state.update { it.copy(discovering = true) } _state.update { it.copy(discovering = true) }
try { try {
val decision = api.addRecommendation(moodId, videoId) val decision = api.addRecommendation(moodId, externalId)
applyMoodDetail(decision.detail) applyMoodDetail(decision.detail)
if (decision.recommendation.song == null) { if (decision.recommendation.song == null) {
pollUntilSongCount(decision.detail.mood.id, decision.detail.mood.songCount + 1) pollUntilSongCount(decision.detail.mood.id, decision.detail.mood.songCount + 1)
@@ -642,13 +687,13 @@ class AppStore(
} }
} }
fun rejectRecommendation(videoId: String) { fun rejectRecommendation(externalId: String) {
val moodId = _state.value.selectedMood?.mood?.id ?: return val moodId = _state.value.selectedMood?.mood?.id ?: return
if (_state.value.discovering) return if (_state.value.discovering) return
scope.launch { scope.launch {
_state.update { it.copy(discovering = true) } _state.update { it.copy(discovering = true) }
try { try {
val decision = api.rejectRecommendation(moodId, videoId) val decision = api.rejectRecommendation(moodId, externalId)
applyMoodDetail(decision.detail) applyMoodDetail(decision.detail)
_state.update { _state.update {
it.copy( it.copy(
@@ -665,11 +710,11 @@ class AppStore(
} }
} }
fun retryRecommendation(videoId: String) { fun retryRecommendation(externalId: String) {
val moodId = _state.value.selectedMood?.mood?.id ?: return val moodId = _state.value.selectedMood?.mood?.id ?: return
scope.launch { scope.launch {
try { try {
val detail = api.retryRecommendation(moodId, videoId) val detail = api.retryRecommendation(moodId, externalId)
applyMoodDetail(detail) applyMoodDetail(detail)
_state.update { _state.update {
it.copy( it.copy(
@@ -1358,5 +1403,9 @@ private const val PROGRESS_POLL_TICKS = 12
private const val MAX_HISTORY = 50 private const val MAX_HISTORY = 50
private const val SEARCH_DEBOUNCE_MS = 300L private const val SEARCH_DEBOUNCE_MS = 300L
private const val SEARCH_LIMIT = 10 private const val SEARCH_LIMIT = 10
private const val DEFAULT_SOURCE = "deezer"
internal fun sourceLabel(source: String): String =
if (source == "deezer") "Deezer" else "YouTube Music"
private const val DOWNLOAD_POLL_MS = 4_000L private const val DOWNLOAD_POLL_MS = 4_000L
private const val DOWNLOAD_POLLS = 60 private const val DOWNLOAD_POLLS = 60
@@ -113,7 +113,8 @@ fun DownloadsScreen(state: AppState, store: AppStore) {
store.toggleDownload( store.toggleDownload(
win.taptap.musicmanager.client.api.Song( win.taptap.musicmanager.client.api.Song(
id = id, id = id,
videoId = id, source = "youtube",
externalId = id,
title = id, title = id,
artist = "", artist = "",
duration = 0, duration = 0,
@@ -1,6 +1,7 @@
package win.taptap.musicmanager.client.ui package win.taptap.musicmanager.client.ui
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
@@ -24,11 +25,14 @@ import androidx.compose.material.icons.rounded.RemoveCircleOutline
import androidx.compose.material.icons.rounded.Search import androidx.compose.material.icons.rounded.Search
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.FilledTonalButton import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Slider import androidx.compose.material3.Slider
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
@@ -50,6 +54,7 @@ import win.taptap.musicmanager.client.api.MoodSong
import win.taptap.musicmanager.client.api.Recommendation import win.taptap.musicmanager.client.api.Recommendation
import win.taptap.musicmanager.client.store.AppState import win.taptap.musicmanager.client.store.AppState
import win.taptap.musicmanager.client.store.AppStore import win.taptap.musicmanager.client.store.AppStore
import win.taptap.musicmanager.client.store.sourceLabel
@Composable @Composable
fun MoodDetailScreen(state: AppState, store: AppStore) { fun MoodDetailScreen(state: AppState, store: AppStore) {
@@ -76,6 +81,8 @@ fun MoodDetailScreen(state: AppState, store: AppStore) {
var description by remember(mood.id) { mutableStateOf(mood.description.orEmpty()) } var description by remember(mood.id) { mutableStateOf(mood.description.orEmpty()) }
var genres by remember(mood.id) { mutableStateOf(mood.genres.joinToString(", ")) } var genres by remember(mood.id) { mutableStateOf(mood.genres.joinToString(", ")) }
var query by remember(mood.id) { mutableStateOf(mood.query.orEmpty()) } var query by remember(mood.id) { mutableStateOf(mood.query.orEmpty()) }
var source by remember(mood.id) { mutableStateOf(mood.source) }
var sourceMenu by remember { mutableStateOf(false) }
var collectionPercent by remember(mood.id) { mutableStateOf(mood.collectionPercent.toFloat()) } var collectionPercent by remember(mood.id) { mutableStateOf(mood.collectionPercent.toFloat()) }
var recommendations by remember(mood.id) { mutableStateOf(mood.recommendationCount.toFloat()) } var recommendations by remember(mood.id) { mutableStateOf(mood.recommendationCount.toFloat()) }
var hours by remember(mood.id) { mutableStateOf(mood.refreshHours.toString()) } var hours by remember(mood.id) { mutableStateOf(mood.refreshHours.toString()) }
@@ -231,7 +238,7 @@ fun MoodDetailScreen(state: AppState, store: AppStore) {
) )
} }
} else { } else {
items(detail.recommendations, key = { "rec-${it.videoId}" }) { recommendation -> items(detail.recommendations, key = { "rec-${it.source}-${it.externalId}" }) { recommendation ->
RecommendationRow(recommendation, state.discovering, store) RecommendationRow(recommendation, state.discovering, store)
} }
} }
@@ -271,6 +278,45 @@ fun MoodDetailScreen(state: AppState, store: AppStore) {
singleLine = true, singleLine = true,
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
) )
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
) {
Column(Modifier.weight(1f)) {
Text("Download source", style = MaterialTheme.typography.bodyMedium)
Text(
"Search, recommendations and downloads use this catalog.",
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
Box {
OutlinedButton(onClick = { sourceMenu = true }) {
Text(sourceLabel(source))
}
DropdownMenu(
expanded = sourceMenu,
onDismissRequest = { sourceMenu = false },
) {
listOf("deezer", "youtube").forEach { option ->
DropdownMenuItem(
text = { Text(sourceLabel(option)) },
onClick = {
sourceMenu = false
source = option
},
)
}
}
}
}
if (source != mood.source) {
Text(
"Changing the source clears active recommendations and refills them.",
style = MaterialTheme.typography.labelSmall,
color = MaterialTheme.colorScheme.tertiary,
)
}
Column(verticalArrangement = Arrangement.spacedBy(2.dp)) { Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
Text( Text(
"Collection share: ${collectionPercent.roundToInt()}% · ${100 - collectionPercent.roundToInt()}% recommendations", "Collection share: ${collectionPercent.roundToInt()}% · ${100 - collectionPercent.roundToInt()}% recommendations",
@@ -321,6 +367,7 @@ fun MoodDetailScreen(state: AppState, store: AppStore) {
description = description.trim().takeIf { it.isNotEmpty() }, description = description.trim().takeIf { it.isNotEmpty() },
genres = genres.split(',').map { it.trim() }.filter { it.isNotEmpty() }, genres = genres.split(',').map { it.trim() }.filter { it.isNotEmpty() },
query = query.trim().takeIf { it.isNotEmpty() }, query = query.trim().takeIf { it.isNotEmpty() },
source = source,
collectionPercent = collectionPercent.roundToInt(), collectionPercent = collectionPercent.roundToInt(),
recommendationCount = recommendations.roundToInt(), recommendationCount = recommendations.roundToInt(),
refreshHours = hours.toIntOrNull() ?: mood.refreshHours, refreshHours = hours.toIntOrNull() ?: mood.refreshHours,
@@ -418,21 +465,21 @@ private fun RecommendationRow(
} }
if (failed) { if (failed) {
IconButton( IconButton(
onClick = { store.retryRecommendation(recommendation.videoId) }, onClick = { store.retryRecommendation(recommendation.externalId) },
enabled = !busy, enabled = !busy,
) { ) {
Icon(Icons.Rounded.Refresh, contentDescription = "Retry download") Icon(Icons.Rounded.Refresh, contentDescription = "Retry download")
} }
} else { } else {
IconButton( IconButton(
onClick = { store.addRecommendation(recommendation.videoId) }, onClick = { store.addRecommendation(recommendation.externalId) },
enabled = !busy, enabled = !busy,
) { ) {
Icon(Icons.Rounded.Add, contentDescription = "Add to mood") Icon(Icons.Rounded.Add, contentDescription = "Add to mood")
} }
} }
IconButton( IconButton(
onClick = { store.rejectRecommendation(recommendation.videoId) }, onClick = { store.rejectRecommendation(recommendation.externalId) },
enabled = !busy, enabled = !busy,
) { ) {
Icon(Icons.Rounded.Close, contentDescription = "Not interested") Icon(Icons.Rounded.Close, contentDescription = "Not interested")
@@ -27,9 +27,12 @@ import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.FilledTonalButton import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Slider import androidx.compose.material3.Slider
import androidx.compose.material3.Text import androidx.compose.material3.Text
@@ -50,6 +53,7 @@ import kotlin.math.roundToInt
import win.taptap.musicmanager.client.api.Mood import win.taptap.musicmanager.client.api.Mood
import win.taptap.musicmanager.client.store.AppState import win.taptap.musicmanager.client.store.AppState
import win.taptap.musicmanager.client.store.AppStore import win.taptap.musicmanager.client.store.AppStore
import win.taptap.musicmanager.client.store.sourceLabel
@Composable @Composable
fun MoodsScreen(state: AppState, store: AppStore) { fun MoodsScreen(state: AppState, store: AppStore) {
@@ -115,9 +119,18 @@ fun MoodsScreen(state: AppState, store: AppStore) {
CreateMoodDialog( CreateMoodDialog(
saving = state.saving, saving = state.saving,
onDismiss = { creating = false }, onDismiss = { creating = false },
onCreate = { name, description, genres, query, collectionPercent, recommendations, hours -> onCreate = { name, description, genres, query, source, collectionPercent, recommendations, hours ->
creating = false creating = false
store.createMood(name, description, genres, query, collectionPercent, recommendations, hours) store.createMood(
name,
description,
genres,
query,
source,
collectionPercent,
recommendations,
hours,
)
}, },
) )
} }
@@ -165,6 +178,12 @@ private fun MoodCard(mood: Mood, onOpen: () -> Unit, onPlay: () -> Unit) {
color = Color.White.copy(alpha = 0.85f), color = Color.White.copy(alpha = 0.85f),
) )
} }
Spacer(Modifier.width(8.dp))
Text(
sourceLabel(mood.source),
style = MaterialTheme.typography.labelMedium,
color = Color.White.copy(alpha = 0.7f),
)
Spacer(Modifier.weight(1f)) Spacer(Modifier.weight(1f))
FilledTonalButton( FilledTonalButton(
onClick = onPlay, onClick = onPlay,
@@ -187,12 +206,14 @@ private fun MoodCard(mood: Mood, onOpen: () -> Unit, onPlay: () -> Unit) {
private fun CreateMoodDialog( private fun CreateMoodDialog(
saving: Boolean, saving: Boolean,
onDismiss: () -> Unit, onDismiss: () -> Unit,
onCreate: (String, String?, List<String>, String?, Int, Int, Int) -> Unit, onCreate: (String, String?, List<String>, String?, String, Int, Int, Int) -> Unit,
) { ) {
var name by remember { mutableStateOf("") } var name by remember { mutableStateOf("") }
var description by remember { mutableStateOf("") } var description by remember { mutableStateOf("") }
var genres by remember { mutableStateOf("") } var genres by remember { mutableStateOf("") }
var query by remember { mutableStateOf("") } var query by remember { mutableStateOf("") }
var source by remember { mutableStateOf("deezer") }
var sourceMenu by remember { mutableStateOf(false) }
var collectionPercent by remember { mutableStateOf(50f) } var collectionPercent by remember { mutableStateOf(50f) }
var recommendations by remember { mutableStateOf(10f) } var recommendations by remember { mutableStateOf(10f) }
var hours by remember { mutableStateOf("24") } var hours by remember { mutableStateOf("24") }
@@ -229,6 +250,35 @@ private fun CreateMoodDialog(
label = { Text("Discovery hint") }, label = { Text("Discovery hint") },
singleLine = true, singleLine = true,
) )
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
"Download source",
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.weight(1f),
)
Box {
OutlinedButton(onClick = { sourceMenu = true }) {
Text(sourceLabel(source))
}
DropdownMenu(
expanded = sourceMenu,
onDismissRequest = { sourceMenu = false },
) {
listOf("deezer", "youtube").forEach { option ->
DropdownMenuItem(
text = { Text(sourceLabel(option)) },
onClick = {
sourceMenu = false
source = option
},
)
}
}
}
}
Column(verticalArrangement = Arrangement.spacedBy(2.dp)) { Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
Text( Text(
"Collection share: ${collectionPercent.roundToInt()}% · ${100 - collectionPercent.roundToInt()}% recommendations", "Collection share: ${collectionPercent.roundToInt()}% · ${100 - collectionPercent.roundToInt()}% recommendations",
@@ -270,6 +320,7 @@ private fun CreateMoodDialog(
description.trim().takeIf { it.isNotEmpty() }, description.trim().takeIf { it.isNotEmpty() },
genres.split(',').map { it.trim() }.filter { it.isNotEmpty() }, genres.split(',').map { it.trim() }.filter { it.isNotEmpty() },
query.trim().takeIf { it.isNotEmpty() }, query.trim().takeIf { it.isNotEmpty() },
source,
collectionPercent.roundToInt(), collectionPercent.roundToInt(),
recommendations.roundToInt(), recommendations.roundToInt(),
hours.toIntOrNull() ?: 24, hours.toIntOrNull() ?: 24,
@@ -47,6 +47,7 @@ import androidx.compose.ui.unit.dp
import win.taptap.musicmanager.client.api.SearchResult import win.taptap.musicmanager.client.api.SearchResult
import win.taptap.musicmanager.client.store.AppState import win.taptap.musicmanager.client.store.AppState
import win.taptap.musicmanager.client.store.AppStore import win.taptap.musicmanager.client.store.AppStore
import win.taptap.musicmanager.client.store.sourceLabel
@Composable @Composable
fun SearchScreen(state: AppState, store: AppStore) { fun SearchScreen(state: AppState, store: AppStore) {
@@ -61,6 +62,7 @@ fun SearchScreen(state: AppState, store: AppStore) {
var url by remember { mutableStateOf("") } var url by remember { mutableStateOf("") }
var moodMenu by remember { mutableStateOf(false) } var moodMenu by remember { mutableStateOf(false) }
var sourceMenu by remember { mutableStateOf(false) }
val target = state.moods.firstOrNull { it.id == state.searchTargetMoodId } ?: state.moods.first() val target = state.moods.firstOrNull { it.id == state.searchTargetMoodId } ?: state.moods.first()
LazyColumn( LazyColumn(
@@ -95,11 +97,41 @@ fun SearchScreen(state: AppState, store: AppStore) {
} }
} }
item {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp),
) {
Text("Download source", style = MaterialTheme.typography.bodyMedium)
Box {
OutlinedButton(onClick = { sourceMenu = true }) {
Text(sourceLabel(target.source))
Icon(Icons.Rounded.ArrowDropDown, contentDescription = null)
}
DropdownMenu(
expanded = sourceMenu,
onDismissRequest = { sourceMenu = false },
) {
listOf("deezer", "youtube").forEach { option ->
DropdownMenuItem(
text = { Text(sourceLabel(option)) },
onClick = {
sourceMenu = false
store.setMoodSource(target.id, option)
},
)
}
}
}
}
}
item { item {
OutlinedTextField( OutlinedTextField(
value = state.searchQuery, value = state.searchQuery,
onValueChange = store::setSearchQuery, onValueChange = store::setSearchQuery,
label = { Text("Search YouTube Music") }, label = { Text("Search ${sourceLabel(target.source)}") },
singleLine = true, singleLine = true,
leadingIcon = { Icon(Icons.Rounded.Search, contentDescription = null) }, leadingIcon = { Icon(Icons.Rounded.Search, contentDescription = null) },
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
@@ -115,7 +147,7 @@ fun SearchScreen(state: AppState, store: AppStore) {
OutlinedTextField( OutlinedTextField(
value = url, value = url,
onValueChange = { url = it }, onValueChange = { url = it },
label = { Text("Paste a YouTube URL") }, label = { Text("Paste a YouTube or Deezer URL") },
singleLine = true, singleLine = true,
leadingIcon = { Icon(Icons.Rounded.Link, contentDescription = null) }, leadingIcon = { Icon(Icons.Rounded.Link, contentDescription = null) },
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
@@ -152,7 +184,7 @@ fun SearchScreen(state: AppState, store: AppStore) {
} }
} }
items(state.searchResults, key = { it.videoId }) { result -> items(state.searchResults, key = { "${it.source}-${it.externalId}" }) { result ->
SearchRow(result, store) SearchRow(result, store)
} }
@@ -107,7 +107,7 @@ fun SettingsScreen(state: AppState, store: AppStore) {
Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) { Column(Modifier.padding(18.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
Text("About", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold) Text("About", style = MaterialTheme.typography.titleMedium, fontWeight = FontWeight.SemiBold)
Text( Text(
"AudioManager 0.2.0 · $platformName", "AudioManager 0.3.0 · $platformName",
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
) )
@@ -38,7 +38,7 @@ class ApiClientTest {
) )
"/api/v1/moods" -> respond( "/api/v1/moods" -> respond(
""" """
{"moods":[{"id":"mo-1","name":"Focus","collectionPercent":60, {"moods":[{"id":"mo-1","name":"Focus","source":"deezer","collectionPercent":60,
"recommendationPercent":40,"recommendationCount":10,"refreshHours":24, "recommendationPercent":40,"recommendationCount":10,"refreshHours":24,
"createdAt":"now","changedAt":"now","songCount":2,"recommendationReady":3}]} "createdAt":"now","changedAt":"now","songCount":2,"recommendationReady":3}]}
""".trimIndent(), """.trimIndent(),
@@ -68,10 +68,10 @@ class ApiClientTest {
"/api/v1/search" -> respond( "/api/v1/search" -> respond(
""" """
{"results":[ {"results":[
{"videoId":"v1","title":"Fresh","artist":"Artist","duration":180, {"source":"deezer","externalId":"v1","title":"Fresh","artist":"Artist",
"downloaded":false}, "duration":180,"downloaded":false},
{"videoId":"v2","title":"Old","artist":"Artist","duration":200, {"source":"deezer","externalId":"v2","title":"Old","artist":"Artist",
"songId":"sg-2","downloaded":true} "duration":200,"songId":"sg-2","downloaded":true}
]} ]}
""".trimIndent(), """.trimIndent(),
HttpStatusCode.OK, HttpStatusCode.OK,
@@ -98,8 +98,9 @@ class ApiClientTest {
assertNull(results[0].songId) assertNull(results[0].songId)
assertEquals("sg-2", results[1].songId) assertEquals("sg-2", results[1].songId)
assertTrue(results[1].downloaded) assertTrue(results[1].downloaded)
assertEquals("v2", results[1].externalId)
val added = client.addSong("mo-1", videoId = "v1") val added = client.addSong("mo-1", source = "deezer", externalId = "v1")
assertTrue(added.downloading) assertTrue(added.downloading)
assertEquals(1, added.detail.mood.songCount) assertEquals(1, added.detail.mood.songCount)
} }
@@ -112,8 +113,8 @@ class ApiClientTest {
""" """
{"detail":{"mood":{"id":"mo-1","name":"Focus","createdAt":"now", {"detail":{"mood":{"id":"mo-1","name":"Focus","createdAt":"now",
"changedAt":"now","songCount":2},"songs":[],"recommendations":[]}, "changedAt":"now","songCount":2},"songs":[],"recommendations":[]},
"recommendation":{"videoId":"v1","title":"Pick","artist":"Artist", "recommendation":{"source":"deezer","externalId":"v1","title":"Pick",
"state":"added"}} "artist":"Artist","state":"added"}}
""".trimIndent(), """.trimIndent(),
HttpStatusCode.OK, HttpStatusCode.OK,
jsonHeaders, jsonHeaders,
@@ -122,8 +123,8 @@ class ApiClientTest {
""" """
{"detail":{"mood":{"id":"mo-1","name":"Focus","createdAt":"now", {"detail":{"mood":{"id":"mo-1","name":"Focus","createdAt":"now",
"changedAt":"now","songCount":2},"songs":[],"recommendations":[]}, "changedAt":"now","songCount":2},"songs":[],"recommendations":[]},
"recommendation":{"videoId":"v2","title":"Other","artist":"Artist", "recommendation":{"source":"deezer","externalId":"v2","title":"Other",
"state":"rejected"}} "artist":"Artist","state":"rejected"}}
""".trimIndent(), """.trimIndent(),
HttpStatusCode.OK, HttpStatusCode.OK,
jsonHeaders, jsonHeaders,
@@ -223,6 +224,6 @@ class ApiClientTest {
storage.write("mood-cache.json", """{"version":1,"songs":[{"id":"old"}]}""") storage.write("mood-cache.json", """{"version":1,"songs":[{"id":"old"}]}""")
val invalidated = cache.load() val invalidated = cache.load()
assertTrue(invalidated.moods.isEmpty()) assertTrue(invalidated.moods.isEmpty())
assertEquals(2, invalidated.version) assertEquals(3, invalidated.version)
} }
} }
@@ -111,8 +111,8 @@ class AppStoreTest {
"/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/me" -> respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/moods" -> respond("""{"moods":[${moodJson(0)}]}""", HttpStatusCode.OK, jsonHeaders) "/api/v1/moods" -> respond("""{"moods":[${moodJson(0)}]}""", HttpStatusCode.OK, jsonHeaders)
"/api/v1/search" -> respond( "/api/v1/search" -> respond(
"""{"results":[{"videoId":"v1","title":"Fresh","artist":"Artist", """{"results":[{"source":"youtube","externalId":"v1","title":"Fresh",
"duration":180,"downloaded":false}]}""", "artist":"Artist","duration":180,"downloaded":false}]}""",
HttpStatusCode.OK, HttpStatusCode.OK,
jsonHeaders, jsonHeaders,
) )
@@ -133,7 +133,7 @@ class AppStoreTest {
advanceTimeBy(350) advanceTimeBy(350)
runCurrent() runCurrent()
awaitState { store.state.value.searchResults.isNotEmpty() } awaitState { store.state.value.searchResults.isNotEmpty() }
assertEquals("v1", store.state.value.searchResults.single().videoId) assertEquals("v1", store.state.value.searchResults.single().externalId)
store.addSearchResult(store.state.value.searchResults.single()) store.addSearchResult(store.state.value.searchResults.single())
awaitState { store.state.value.message != null } awaitState { store.state.value.message != null }
@@ -180,6 +180,54 @@ class AppStoreTest {
store.release() store.release()
} }
@Test
fun `changing the mood source re-runs the search against the new catalog`() = runTest {
val storage = MemoryStorage()
val cache = AppCache(storage)
cache.saveSession(SessionState("http://music", "token", User("alice", admin = false)))
val engine = MockEngine { request ->
when {
request.url.encodedPath == "/api/v1/me" ->
respond("""{"name":"alice","admin":false}""", HttpStatusCode.OK, jsonHeaders)
request.url.encodedPath == "/api/v1/moods" ->
respond("""{"moods":[${moodJson(0)}]}""", HttpStatusCode.OK, jsonHeaders)
request.method.value == "PATCH" && request.url.encodedPath == "/api/v1/moods/mo-1" ->
respond(detailJson(emptyList(), source = "deezer"), HttpStatusCode.OK, jsonHeaders)
request.url.encodedPath == "/api/v1/moods/mo-1" ->
respond(detailJson(emptyList()), HttpStatusCode.OK, jsonHeaders)
request.url.encodedPath == "/api/v1/moods/mo-1/preview" ->
respond("""{"songs":[]}""", HttpStatusCode.OK, jsonHeaders)
request.url.encodedPath == "/api/v1/search" -> {
val source = request.url.parameters["source"]
val body = if (source == "deezer") {
"""{"results":[{"source":"deezer","externalId":"67238732",
"title":"Instant Crush","artist":"Daft Punk","duration":337,
"downloaded":false}]}"""
} else {
"""{"results":[]}"""
}
respond(body, HttpStatusCode.OK, jsonHeaders)
}
else -> respondError(HttpStatusCode.NotFound)
}
}
val store = store(storage, cache, FakePlayer(), engine)
runCurrent()
store.openMood("mo-1")
awaitState { store.state.value.selectedMood != null }
store.openSearch("mo-1")
store.setSearchQuery("daft")
advanceTimeBy(350)
runCurrent()
store.setMoodSource("mo-1", "deezer")
awaitState { store.state.value.searchResults.any { it.source == "deezer" } }
assertEquals("deezer", store.state.value.moods.first { it.id == "mo-1" }.source)
assertEquals("67238732", store.state.value.searchResults.single().externalId)
store.release()
}
@Test @Test
fun `sleep timer pauses playback when it expires`() = runTest { fun `sleep timer pauses playback when it expires`() = runTest {
val storage = MemoryStorage() val storage = MemoryStorage()
@@ -319,31 +367,38 @@ class AppStoreTest {
private val jsonHeaders = headersOf(HttpHeaders.ContentType, "application/json") private val jsonHeaders = headersOf(HttpHeaders.ContentType, "application/json")
private fun songJson(id: String) = """ private fun songJson(id: String) = """
{"id":"$id","videoId":"video-$id","title":"Song $id","artist":"Artist", {"id":"$id","source":"youtube","externalId":"video-$id","title":"Song $id",
"album":"Album","duration":180,"bitRate":320,"size":1000,"suffix":"mp3"} "artist":"Artist","album":"Album","duration":180,"bitRate":320,"size":1000,"suffix":"mp3"}
""".trimIndent() """.trimIndent()
private fun moodJson(songCount: Int) = """ private fun moodJson(songCount: Int, source: String = "youtube") = """
{"id":"mo-1","name":"Focus","collectionPercent":50,"recommendationPercent":50, {"id":"mo-1","name":"Focus","source":"$source","collectionPercent":50,
"recommendationCount":10,"refreshHours":24,"createdAt":"2026-01-01T00:00:00Z", "recommendationPercent":50,"recommendationCount":10,"refreshHours":24,
"changedAt":"2026-01-01T00:00:00Z","songCount":$songCount} "createdAt":"2026-01-01T00:00:00Z","changedAt":"2026-01-01T00:00:00Z",
"songCount":$songCount}
""".trimIndent() """.trimIndent()
private fun recommendationJson(state: String = "new", songId: String? = null) = """ private fun recommendationJson(state: String = "new", songId: String? = null) = """
{"videoId":"v1","title":"Pick","artist":"Artist","duration":180,"state":"$state", {"source":"youtube","externalId":"v1","title":"Pick","artist":"Artist",
"duration":180,"state":"$state",
${songId?.let { "\"song\":${songJson(it)}," } ?: ""} ${songId?.let { "\"song\":${songJson(it)}," } ?: ""}
"firstSeen":"2026-01-01T00:00:00Z","lastSeen":"2026-01-01T00:00:00Z"} "firstSeen":"2026-01-01T00:00:00Z","lastSeen":"2026-01-01T00:00:00Z"}
""".trimIndent() """.trimIndent()
private fun detailJson(songs: List<String>, recommendation: String? = null) = """ private fun detailJson(
{"mood":${moodJson(songs.size)}, songs: List<String>,
recommendation: String? = null,
source: String = "youtube",
) = """
{"mood":${moodJson(songs.size, source)},
"songs":[${songs.joinToString(",") { """{"song":${songJson(it)},"origin":"search","addedAt":"now"}""" }}], "songs":[${songs.joinToString(",") { """{"song":${songJson(it)},"origin":"search","addedAt":"now"}""" }}],
"recommendations":${recommendation?.let { "[$it]" } ?: "[]"}} "recommendations":${recommendation?.let { "[$it]" } ?: "[]"}}
""".trimIndent() """.trimIndent()
private fun song(id: String, duration: Int = 180) = Song( private fun song(id: String, duration: Int = 180) = Song(
id = id, id = id,
videoId = "video-$id", source = "youtube",
externalId = "video-$id",
title = "Song $id", title = "Song $id",
artist = "Artist", artist = "Artist",
album = "Album", album = "Album",
+3 -3
View File
@@ -10,7 +10,7 @@ Read that first. This file only records the client-side consequences.
## What the client becomes ## What the client becomes
- Moods are the only content model. No Library, no Longform, no mounted music. - Moods are the only content model. No Library, no Longform, no mounted music.
- All music is downloaded on the server from YouTube Music; the client searches and - All music is downloaded on the server from Deezer or YouTube Music; the client searches and
adds songs to a mood. adds songs to a mood.
- A mood has **songs** (collection) and **recommendations** (auto-downloaded, - A mood has **songs** (collection) and **recommendations** (auto-downloaded,
playable in radio, not permanent until added). playable in radio, not permanent until added).
@@ -25,7 +25,7 @@ Read that first. This file only records the client-side consequences.
- **MoodDetail**: songs, add music, recommendations (Add / Not interested / - **MoodDetail**: songs, add music, recommendations (Add / Not interested /
Retry), next batch, mood settings (query, genres, collectionPercent, Retry), next batch, mood settings (query, genres, collectionPercent,
recommendationCount 0–30, refreshHours). recommendationCount 0–30, refreshHours).
- **Search**: remote YouTube Music search, results over 10 minutes hidden, add to the - **Search**: remote Deezer/YouTube Music search, results over 10 minutes hidden, add to the
current or a chosen mood, already-downloaded/in-mood badges, paste URL. current or a chosen mood, already-downloaded/in-mood badges, paste URL.
- **Downloads**: device-side offline files, delete/clear, storage usage. - **Downloads**: device-side offline files, delete/clear, storage usage.
- **Settings**: server/account/devices/logout (no scan UI). - **Settings**: server/account/devices/logout (no scan UI).
@@ -59,7 +59,7 @@ Implemented. Concretely:
- `AppCache` (version 2) stores moods and details only; old cache shapes are - `AppCache` (version 2) stores moods and details only; old cache shapes are
discarded. Session and playback snapshots are kept. discarded. Session and playback snapshots are kept.
- `AppStore` has `Moods | MoodDetail | Search | Downloads | Settings`, remote - `AppStore` has `Moods | MoodDetail | Search | Downloads | Settings`, remote
YouTube Music search with a target mood, add/remove song, recommendation actions, offline Deezer/YouTube Music search with a target mood and a per-mood source, add/remove song, recommendation actions, offline
playback from device downloads, and no longform/library paths. playback from device downloads, and no longform/library paths.
- The UI has a dedicated Search screen (mood picker, paste URL, downloaded - The UI has a dedicated Search screen (mood picker, paste URL, downloaded
badges) and a Downloads screen. Mood Detail shows songs, add music, badges) and a Downloads screen. Mood Detail shows songs, add music,