Native Android client for Spotify, built with Jetpack Compose
Kotlin ad-freeadblockandroidjetpack-composekotlinlyricsmusic-playermusic-videomyspotispotifyspotify-adblockerspotify-clientspotify-connectspotui
Discord reports: repeat one keeps looping when Spotify puts an ad after the song (its end goes to the song's own repeat, not to the next song); a download whose source could not answer (busy, timeout, rate limit, set aside) fails and can be tried again instead of being marked as not found; "Still downloaded" names the list that keeps the song; lyrics translation in the Immersive player (song options, under each line); the sleep timer fades out over its last 15 s; a setting hides Spotify's DJ from Home
kota-zod0f502bf08e8
diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyPlayer.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyPlayer.ktindex 1b6e1233..13940542 100644--- a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyPlayer.kt+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/SpotifyPlayer.kt@@ -1543,8 +1543,14 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScop}}- override suspend fun pause() {- pausedByUser = true+ override suspend fun pause() = pauseOver(PAUSE_MS)++ /** The sleep timer's end: the same pause over [fadeMs], and the level back for the next play. A cancel keeps the song playing. */+ override suspend fun pauseSlowly(fadeMs: Long) = pauseOver(fadeMs)++ private suspend fun pauseOver(fadeMs: Long) {+ // A long fade is still playing: the song is only marked paused once it is.+ if (fadeMs <= PAUSE_MS) pausedByUser = trueendCrossfade(restore = true)// Nothing playing (no state yet, or already paused): nothing to send. A pause on the// orphan session a fresh page finds makes the page claim it with a transfer first —@@ -1568,9 +1574,14 @@ class SpotifyPlayer(private val bridge: Bridge, private val scope: CoroutineScoptry {if (fadeOut) {runCatching {- bridge.call("media.ramp", buildJsonObject { put("to", 0); put("ms", PAUSE_MS) }, timeoutMs = LEVEL_TIMEOUT_MS, quiet = true)+ bridge.call("media.ramp", buildJsonObject { put("to", 0); put("ms", fadeMs) }, timeoutMs = LEVEL_TIMEOUT_MS, quiet = true)}- delay(PAUSE_MS)+ delay(fadeMs)+ } else if (fadeMs > PAUSE_MS) delay(fadeMs) // nothing to fade (another device plays): the pause still comes at the end+ if (fadeMs > PAUSE_MS) {+ // Paused by the user meanwhile: nothing left to send.+ if (_state.value?.isPaused != false) return+ pausedByUser = true}command("player.pause")} finally {diff --git a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/BridgeHost.kt b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/BridgeHost.ktindex 2b2c0c3b..588cd875 100644--- a/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/BridgeHost.kt+++ b/base/api-spotify/src/main/kotlin/app/myspoti/spotify/bridge/BridgeHost.kt@@ -188,6 +188,18 @@ object AdBlock {fun isAd(state: Int) = isAdTrack(trackOf(state))fun nameOf(state: Int) = ((trackOf(state)?.get("metadata") as? JsonObject)?.get("name") as? JsonPrimitive)?.contentOrNullfun indexOf(transition: JsonObject) = (transition["state_index"] as? JsonPrimitive)?.contentOrNull?.toIntOrNull()+ fun uriOf(state: Int) = (trackOf(state)?.get("metadata") as? JsonObject)?.get("uri")?.let { (it as? JsonPrimitive)?.contentOrNull }+ fun repeatsTrack(state: Int) = ((states.getOrNull(state) as? JsonObject)?.get("options") as? JsonObject)+ ?.get("repeating_track")?.let { (it as? JsonPrimitive)?.contentOrNull } == "true"+ // Repeat one: the song's `advance` is its own repeat (the same song, still repeating), and its+ // `skip_next` is the next song with repeat off (captured 21/10). An ad in between leaves the+ // song's end going to the ad: sent to the skip's target it ended the repeat after a few loops+ // (reported: "loops 2-3 times then plays the next song"). The repeat's own state is the playable+ // one of the same song (it has a show_next; the display-only ones have none).+ fun repeatOf(i: Int): Int? = states.indices.firstOrNull { j ->+ j != i && !isAd(j) && repeatsTrack(j) && uriOf(j) != null && uriOf(j) == uriOf(i) &&+ ((states[j] as? JsonObject)?.get("transitions") as? JsonObject)?.get("show_next") is JsonObject+ }var changed = falseval rewritten = states.mapIndexed { i, element ->val state = element as? JsonObject ?: return@mapIndexed element@@ -200,6 +212,12 @@ object AdBlock {for (key in listOf("advance", "skip_next")) {val t = transitions[key] as? JsonObject ?: continueif (indexOf(t)?.let(::isAd) != true) continue+ val again = if (key == "advance" && repeatsTrack(i)) repeatOf(i) else null+ if (again != null) {+ next[key] = JsonObject(t.toMutableMap().apply { put("state_index", JsonPrimitive(again)) })+ notes += "$key after ${nameOf(i)}: repeated instead of an ad"+ continue+ }if (target == null) { notes += "$key after ${nameOf(i)}: an ad, and no song to send it to"; continue }next[key] = JsonObject(target.toMutableMap().apply { t["paused"]?.let { put("paused", it) } })notes += "$key after ${nameOf(i)}: ${indexOf(target)?.let(::nameOf)} instead of an ad"diff --git a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/bridge/AdQueueTest.kt b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/bridge/AdQueueTest.ktindex b31660f9..533d29da 100644--- a/base/api-spotify/src/test/kotlin/app/myspoti/spotify/bridge/AdQueueTest.kt+++ b/base/api-spotify/src/test/kotlin/app/myspoti/spotify/bridge/AdQueueTest.kt@@ -75,6 +75,34 @@ class AdQueueTest {assertNull(AdBlock.adAhead(AdBlock.withoutAds(first)!!.first))}+ // Repeat one (captured 21/10): the song's advance is its own repeat, its skip the next song with repeat off.+ private fun repeatState(track: Int, repeating: Boolean, advance: Int? = null, next: Int? = null, show: Int? = null) =+ state(track, advance, next, show).dropLast(1) + ""","options":{"repeating_track":$repeating}}"""++ private val repeated = reply(+ listOf(track("AD", "An ad"), track("TRACK", "Playing"), track("TRACK", "After")),+ listOf(repeatState(0, true), repeatState(1, true, advance = 0, next = 3, show = 4), repeatState(1, true, show = 4),+ repeatState(2, false, show = 4), repeatState(2, false)),+ current = 1,+ )++ @Test fun `the end of a repeated song before an ad goes to its repeat, not to the next song`() {+ val (body, notes) = AdBlock.withoutAds(repeated)!!+ val t = transitions(body, 1)+ assertEquals(2, index(t, "advance"))+ assertEquals(3, index(t, "skip_next"))+ assertEquals(listOf("advance after Playing: repeated instead of an ad"), notes)+ }++ @Test fun `a repeated song with no state of its repeat falls back to the skip's target`() {+ val noRepeat = reply(+ listOf(track("AD", "An ad"), track("TRACK", "Playing"), track("TRACK", "After")),+ listOf(repeatState(0, true), repeatState(1, true, advance = 0, next = 2, show = 3), repeatState(2, false, show = 3), repeatState(2, false)),+ current = 1,+ )+ assertEquals(2, index(transitions(AdBlock.withoutAds(noRepeat)!!.first, 1), "advance"))+ }+@Test fun `a reply without an ad is left alone`() {val plain = reply(listOf(track("TRACK", "A"), track("TRACK", "B")), listOf(state(0, advance = 1, next = 1), state(1)), current = 0)assertNull(AdBlock.withoutAds(plain))diff --git a/base/api/src/main/kotlin/app/myspoti/api/Api.kt b/base/api/src/main/kotlin/app/myspoti/api/Api.ktindex cc1f24ed..9c4f2f4d 100644--- a/base/api/src/main/kotlin/app/myspoti/api/Api.kt+++ b/base/api/src/main/kotlin/app/myspoti/api/Api.kt@@ -37,6 +37,8 @@ interface Player {*/suspend fun play(contextUri: Uri, trackUri: Uri? = null, index: Int? = null, positionMs: Long? = null, order: List<Uri>? = null)suspend fun pause()+ /** [pause] after a fade of [fadeMs] (the sleep timer); cancelling it keeps playing. */+ suspend fun pauseSlowly(fadeMs: Long) = pause()suspend fun resume()suspend fun seek(positionMs: Long)suspend fun next()diff --git a/base/app/src/main/java/com/music/spotui/data/entity/HomeFeedModel.kt b/base/app/src/main/java/com/music/spotui/data/entity/HomeFeedModel.ktindex caa67f30..04a456c5 100644--- a/base/app/src/main/java/com/music/spotui/data/entity/HomeFeedModel.kt+++ b/base/app/src/main/java/com/music/spotui/data/entity/HomeFeedModel.kt@@ -17,6 +17,13 @@ data class HomeSection(val items: List<HomeItem>,)+/** The shelves without Spotify's DJ (a playlist card named "DJ"); a shelf left empty goes. */+fun List<HomeSection>.withoutDj(): List<HomeSection> =+ map { s -> s.copy(items = s.items.filterNot { it is HomeItem.Playlist && (it.id == DJ_PLAYLIST_ID || it.name.trim().equals("DJ", ignoreCase = true)) }) }+ .filter { it.items.isNotEmpty() }++private const val DJ_PLAYLIST_ID = "37i9dQZF1EYkqdzj48dyYq"+@kotlinx.serialization.Serializablesealed class HomeItem {abstract val name: Stringdiff --git a/base/app/src/main/java/com/music/spotui/data/offline/OfflineCollections.kt b/base/app/src/main/java/com/music/spotui/data/offline/OfflineCollections.ktindex c8c9c615..76025e48 100644--- a/base/app/src/main/java/com/music/spotui/data/offline/OfflineCollections.kt+++ b/base/app/src/main/java/com/music/spotui/data/offline/OfflineCollections.kt@@ -70,6 +70,13 @@ object OfflineCollections {fun isKept(trackId: String): Boolean = synchronized(lock) { trackId in singles } ||collections.values.any { trackId in it.trackIds }+ /** What the toast says when [trackId] stays on the phone: the downloaded lists (albums, playlists, Liked Songs) that hold it. */+ fun keptMessage(context: Context, trackId: String): String {+ val names = collections.values.filter { trackId in it.trackIds }.mapNotNull { it.name.takeIf(String::isNotBlank) }+ if (names.isEmpty()) return context.getString(app.myspoti.engine.R.string.download_kept_by_list)+ return context.getString(app.myspoti.engine.R.string.download_kept_by_named, names.take(3).joinToString(", ") + if (names.size > 3) "…" else "")+ }+@Volatile private var wifiPending = false/** Automatic downloads were held back for Wi-Fi: the next Wi-Fi brings every list up to date. */diff --git a/base/app/src/main/java/com/music/spotui/data/offline/OfflineDownloader.kt b/base/app/src/main/java/com/music/spotui/data/offline/OfflineDownloader.ktindex a0b54931..ff2ced2a 100644--- a/base/app/src/main/java/com/music/spotui/data/offline/OfflineDownloader.kt+++ b/base/app/src/main/java/com/music/spotui/data/offline/OfflineDownloader.kt@@ -273,6 +273,10 @@ object OfflineDownloader {} catch (e: Unavailable) {Log.i(TAG, "${r.title}: ${e.message}")OfflineStatus.Unavailable+ } catch (e: com.music.spotui.extensions.Extensions.NotAnswering) {+ // Failed, not unavailable: the source could not answer, so a tap on the song tries it again.+ Log.i(TAG, "${r.title}: download source not answering: ${e.message}")+ OfflineStatus.Failed} catch (t: Throwable) {Log.w(TAG, "${r.title} failed", t)OfflineStatus.Failed@@ -371,6 +375,9 @@ object OfflineDownloader {.copy(isrc = meta.isrc)val (extensionId, extension, files) = com.music.spotui.extensions.Extensions.downloadFiles(track, queryQuality(quality))?: throw Unavailable("no download source has this song")+ // The last error of a file that could not be fetched (not refused or failed a check): the song is then+ // a download that failed and can be tried again, not a recording that was not found.+ var fetchError: Exception? = nullfor (file in files) {currentCoroutineContext().ensureActive()setStatus(r.trackId, OfflineStatus.Downloading(-1f))@@ -386,6 +393,7 @@ object OfflineDownloader {throw e} catch (e: Exception) {Log.w(TAG, "${meta.title}: $label ${file.format}: ${e.message}")+ if (e !is app.myspoti.extensions.ExtensionMediaHttp.Refused && !app.myspoti.extensions.SafeNet.isRefusal(e)) fetchError = efalse}if (!ok) continue@@ -400,6 +408,7 @@ object OfflineDownloader {Log.i(TAG, "${meta.title}: saved FLAC from $label")return Fetched(label, file.isrcMatched, extensionId)}+ fetchError?.let { throw IOException("none of the ${files.size} files from $extension could be fetched: ${it.message}", it) }throw Unavailable("none of the ${files.size} files from $extension could be used")}diff --git a/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.kt b/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.ktindex 849b7114..c709262b 100644--- a/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.kt+++ b/base/app/src/main/java/com/music/spotui/data/preferences/SettingsPref.kt@@ -145,6 +145,21 @@ object MusicVideoPref {}}+/**+ * "Hide the DJ" on Home (off by default): Spotify's DJ, which comes in the home feed as a+ * playlist card, leaves the shelves. Read by both Home screens as state.+ */+object HideDjPref {+ private const val KEY = "hide_dj"+ var on by androidx.compose.runtime.mutableStateOf(prefs(com.music.spotui.di.Graph.app).getBoolean(KEY, false))+ private set++ fun set(c: Context, value: Boolean) {+ on = value+ prefs(c).edit().putBoolean(KEY, value).apply()+ }+}+fun getCrossfadeSeconds(c: Context): Int =prefs(c).getInt(KEY_CROSSFADE, 0).coerceIn(0, CrossfadePref.MAX)diff --git a/base/app/src/main/java/com/music/spotui/di/LocalPlayer.kt b/base/app/src/main/java/com/music/spotui/di/LocalPlayer.ktindex a3fbf175..f623cd27 100644--- a/base/app/src/main/java/com/music/spotui/di/LocalPlayer.kt+++ b/base/app/src/main/java/com/music/spotui/di/LocalPlayer.kt@@ -400,6 +400,8 @@ object LocalPlayer {if (p.playbackState == Player.STATE_IDLE && p.mediaItemCount > 0) { log("resume after an error: preparing again"); p.prepare() }p.play()}+ /** The sleep timer's fade: the player's volume (a crossfade owns it while it runs, the fade then goes on after it). */+ fun setGain(gain: Float) { if (outgoing == null) exo?.volume = gain }fun pause() { if (CastPlayback.active) CastPlayback.pause() else exo?.pause() }fun next() {// In the first half of a crossfade the main player is on the next song already, while thediff --git a/base/app/src/main/java/com/music/spotui/di/SongPlayer.kt b/base/app/src/main/java/com/music/spotui/di/SongPlayer.ktindex 286ecc91..cdc3a47b 100644--- a/base/app/src/main/java/com/music/spotui/di/SongPlayer.kt+++ b/base/app/src/main/java/com/music/spotui/di/SongPlayer.kt@@ -71,6 +71,8 @@ object SongPlayer {private const val PLAY_CHECK_MS = 4_000L/** A resume of an episode that the page did not take is asked for again after that. */private const val EPISODE_RESUME_CHECK_MS = 2_500L+ /** A timed sleep timer lowers the volume over its last seconds. */+ private const val SLEEP_FADE_MS = 15_000L/** "Next" taps closer than this are sent as one jump. */private const val SKIP_BURST_MS = 350L/** Skip commands are at least this far apart; taps in between add up (see [next]). */@@ -441,7 +443,7 @@ object SongPlayer {_queue.value = EngineQueue(); apiQueue = null; _nowPlaying.value = NowPlaying()lastTrackPrefs().edit().clear().apply(); savedLast = ""; resumeWhenReady = falsesavedSource = com.music.spotui.data.preferences.LastSession.SOURCE_SPOTIFY; savedAtMs = 0L; restoredLocal = false- _activeDevice.value = null; _sleepEndsAt.value = null; sleepTrackId = null; spotifyFallbackId = null+ _activeDevice.value = null; _sleepEndsAt.value = null; sleepFade?.cancel(); main.removeCallbacks(sleepFadeRunnable); sleepTrackId = null; spotifyFallbackId = null_video.value = VideoState(); videoFullscreen.value = falseboundState?.let { state ->state.updateQueue(emptyList())@@ -1313,11 +1315,12 @@ object SongPlayer {Haptics.click(); cancelBurst(); pauseSilently()}- private fun pauseSilently() {+ /** [send] false: the engine has paused already (the sleep timer's fade). */+ private fun pauseSilently(send: Boolean = true) {if (LocalPlayer.active.value) { LocalPlayer.pause(); return }intendPaused()positionMs = getCurrentPosition(); positionAt = SystemClock.elapsedRealtime(); playing = false- transport(pullBack = false) { api.player.pause() }+ if (send) transport(pullBack = false) { api.player.pause() }}fun stop() = pause()@@ -2189,13 +2192,21 @@ object SongPlayer {// ── Sleep timer ──private val _sleepEndsAt = mutableStateOf<Long?>(null) // elapsedRealtime, or -1 = end of trackval sleepEndsAt: State<Long?> get() = _sleepEndsAt- private val sleepRunnable = Runnable { _sleepEndsAt.value = null; pauseSilently() }+ private val sleepRunnable = Runnable {+ _sleepEndsAt.value = null+ // The fade ends in the pause itself.+ if (sleepFade?.isActive != true) pauseSilently()+ }+ private val sleepFadeRunnable = Runnable { startSleepFade() }+ private var sleepFade: kotlinx.coroutines.Job? = nullprivate var sleepTrackId: String? = null/** [minutes] null = off, 0 = at the end of the current track. */fun setSleepTimer(minutes: Int?) {main.removeCallbacks(sleepRunnable)+ main.removeCallbacks(sleepFadeRunnable)main.removeCallbacks(endOfTrackWatch)+ sleepFade?.cancel(); sleepFade = null // a fade under way ends with the volume back, the song going onsleepTrackId = nullwhen {minutes == null -> _sleepEndsAt.value = null@@ -2208,7 +2219,47 @@ object SongPlayer {else -> {_sleepEndsAt.value = SystemClock.elapsedRealtime() + minutes * 60_000Lmain.postDelayed(sleepRunnable, minutes * 60_000L)+ main.postDelayed(sleepFadeRunnable, (minutes * 60_000L - SLEEP_FADE_MS).coerceAtLeast(0L))+ }+ }+ }++ /**+ * The last [SLEEP_FADE_MS] of a timed sleep timer: the volume goes down along the ear's curve+ * and the song is paused at the end of the timer, the volume back for the next play. Spotify+ * songs use the pause's own ramp ([app.myspoti.api.Player.pauseSlowly]), the others the player's volume.+ */+ private fun startSleepFade() {+ if (!isPlaying()) return+ sleepFade?.cancel()+ sleepFade = scope.launch {+ if (LocalPlayer.active.value) {+ fadeLocalOut(SLEEP_FADE_MS)+ return@launch+ }+ runCatching { api.player.pauseSlowly(SLEEP_FADE_MS) }.onFailure { if (it is kotlinx.coroutines.CancellationException) throw it }+ if (playing) { _sleepEndsAt.value = null; pauseSilently(send = false) }+ }+ }++ private suspend fun fadeLocalOut(ms: Long) {+ val cast = com.music.spotui.cast.CastPlayback.active+ val base = if (cast) com.music.spotui.cast.CastPlayback.volume.floatValue else 1f+ fun set(gain: Float) = if (cast) com.music.spotui.cast.CastPlayback.setVolume(base * gain) else LocalPlayer.setGain(gain)+ val startedAt = SystemClock.elapsedRealtime()+ try {+ while (true) {+ if (!isPlaying()) return // paused meanwhile: only the volume to put back+ val t = ((SystemClock.elapsedRealtime() - startedAt).toFloat() / ms).coerceIn(0f, 1f)+ if (t >= 1f) break+ set(Math.pow(10.0, -2.0 * t).toFloat()) // 1 down to -40 dB+ kotlinx.coroutines.delay(if (cast) 1_000L else 250L)}+ _sleepEndsAt.value = null+ pauseSilently()+ kotlinx.coroutines.delay(300) // the tail of the buffer is not heard at the old level+ } finally {+ withContext(kotlinx.coroutines.NonCancellable) { set(1f) }}}diff --git a/base/app/src/main/java/com/music/spotui/extensions/Extensions.kt b/base/app/src/main/java/com/music/spotui/extensions/Extensions.ktindex a110412f..36b46f3f 100644--- a/base/app/src/main/java/com/music/spotui/extensions/Extensions.kt+++ b/base/app/src/main/java/com/music/spotui/extensions/Extensions.kt@@ -86,6 +86,9 @@ import java.util.concurrent.ConcurrentHashMap* the sandbox does not expect), never the app.*/object Extensions {+ /** No download source had the song and one could not answer now: the song is worth trying again. */+ class NotAnswering(message: String) : java.io.IOException(message)+// Every hook's time is in [HookBudgets], shared with the desktop runner (`myspoti-ext`)./** A lyrics hook call. */const val LYRICS_MS = HookBudgets.LYRICS@@ -670,7 +673,8 @@ object Extensions {/*** The files [track] can be downloaded from in [quality] (`hi-res`, `cd`, `small`), best first,* from the first extension (priority order) that has any, with that extension's id and name.- * A source set aside for a while ([SourceCooldown]) is not asked.+ * A source set aside for a while ([SourceCooldown]) is not asked. Null when no source has the song;+ * [NotAnswering] when none had it and one could not answer (busy, a timeout, set aside).*/suspend fun downloadFiles(track: TrackInfo, quality: String): Triple<String, String, List<DownloadFile>>? {if (!isReady) return null@@ -683,9 +687,21 @@ object Extensions {}val input = DownloadQuery.toJson(track, quality)probeStale(Hook.DOWNLOAD_SOURCE)- return HookDispatch.firstInOrder(available(Hook.DOWNLOAD_SOURCE)) { (id, rt) ->- ask(id, rt, Hook.DOWNLOAD_SOURCE, input, DOWNLOAD_MS) { DownloadFile.parseList(it).takeIf { l -> l.isNotEmpty() } }.value- }?.let { (c, files) ->+ val answers = ConcurrentHashMap<String, Outcome>()+ val found = HookDispatch.firstInOrder(available(Hook.DOWNLOAD_SOURCE)) { (id, rt) ->+ val a = ask(id, rt, Hook.DOWNLOAD_SOURCE, input, DOWNLOAD_MS) { DownloadFile.parseList(it).takeIf { l -> l.isNotEmpty() } }+ answers[id] = a.outcome+ a.value+ }+ if (found == null) {+ // A source that could not answer (busy, a timeout, a rate limit, set aside) has not said the song is not+ // there: told apart from "no source has it", so the song is retried instead of marked unavailable.+ val silent = providing(Hook.DOWNLOAD_SOURCE).map { it.first }.mapNotNull { id ->+ cooldown.reason(id)?.let { "$id set aside: $it" } ?: answers[id]?.takeIf { it.silent }?.let { "$id ${it.describe()}" }+ }+ if (silent.isNotEmpty()) throw NotAnswering(silent.joinToString("; "))+ }+ return found?.let { (c, files) ->log(c.first, "download files for ${track.title}: ${files.joinToString { "${it.format}/${it.bitDepth ?: "-"}" }}")did(Area.AUDIO, c.first, "Download of ${track.title} from ${c.second.manifest.name}")Triple(c.first, c.second.manifest.name, files)diff --git a/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.kt b/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.ktindex d191a4f6..ad7c829a 100644--- a/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/components/SongOptionsSheet.kt@@ -212,7 +212,7 @@ fun SongOptionsSheet(com.music.spotui.data.offline.PodcastDownloader.remove(downloadKey)true} else com.music.spotui.data.offline.OfflineCollections.removeSong(downloadKey)- toast(context.getString(if (gone) R.string.toast_undownload else R.string.download_kept_by_list))+ toast(if (gone) context.getString(R.string.toast_undownload) else com.music.spotui.data.offline.OfflineCollections.keptMessage(context, downloadKey))onDismiss()}offline == com.music.spotui.data.offline.OfflineStatus.Queued ||diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/lyrics/ImmersiveLyricsPanel.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/lyrics/ImmersiveLyricsPanel.ktindex 03e0a65a..0d6268c3 100644--- a/base/app/src/main/java/com/music/spotui/ui/immersive/lyrics/ImmersiveLyricsPanel.kt+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/lyrics/ImmersiveLyricsPanel.kt@@ -6,8 +6,9 @@* Changes: LyricsPanel's list, PanelVoice, the gap dots, the loading skeleton and the* scroll lead / stagger, fed by Myspoti's LyricsViewModel. Myspoti's lyrics are mostly* line-synced, so a line lights whole (BitChord's line-level path) and the word sweep runs- * only where a line has words. Translation, romanization, particles, duets, backing vocals,- * line picking and the player-controls hand-off are left out for now.+ * only where a line has words. Romanization, particles, duets, backing vocals,+ * line picking and the player-controls hand-off are left out for now. A translation (the+ * Classic look's, from the same LyricsViewModel) is shown as a smaller, dimmer line under each line.*/package com.music.spotui.ui.immersive.lyrics@@ -171,7 +172,11 @@ fun ImmersiveLyricsPanel(modifier: Modifier = Modifier, contentPadding: PaddingV// A new track, or new lyrics for it, starts the list over: its scroll position and// handover state belong to the lines they were made for.key(trackKey, System.identityHashCode(current.lyrics)) {- LyricsList(current.lyrics, trackKey, modifier, contentPadding)+ // The translation the song options sheet turned on, line for line with the source's.+ LyricsList(+ current.lyrics, trackKey, modifier, contentPadding,+ translations = current.translations.takeIf { current.showTranslation },+ )}}}@@ -190,6 +195,8 @@ private class PanelLine(/** Where a break ends; unused for a sung line. */val untilMs: Long,val swept: SweptLine,+ /** The line's place in the source's lines (the translation's), or -1 for a break of the panel's own. */+ val sourceIndex: Int = -1,) {val isWordSynced: Boolean get() = !isGap && swept.isWordSynced@@ -218,9 +225,9 @@ private fun panelLines(lyrics: Lyrics, synced: Boolean): List<PanelLine> {source.forEachIndexed { index, line ->val next = source.getOrNull(index + 1)?.timeMsif (synced && isGapText(line.text)) {- out += PanelLine(line.timeMs, "", true, next ?: (line.timeMs + TRAILING_GAP_MS), SweptLine(line.timeMs, ""))+ out += PanelLine(line.timeMs, "", true, next ?: (line.timeMs + TRAILING_GAP_MS), SweptLine(line.timeMs, ""), index)} else {- out += PanelLine(line.timeMs, line.text, false, 0L, line.toSwept(next))+ out += PanelLine(line.timeMs, line.text, false, 0L, line.toSwept(next), index)}}return out@@ -288,6 +295,8 @@ private fun LyricsList(trackKey: String,modifier: Modifier,contentPadding: PaddingValues,+ /** The lines translated, in the source's order; null while no translation is shown. */+ translations: List<String>? = null,) {val isSynced = remember(lyrics) { lyrics.synced && lyrics.lines.any { it.timeMs > 0L } }val rows = remember(lyrics, isSynced) { panelLines(lyrics, isSynced) }@@ -455,6 +464,7 @@ private fun LyricsList(glowing = blurOk,clock = clock,noteMeasurer = noteMeasurer,+ translation = translations?.getOrNull(row.sourceIndex)?.trim()?.takeIf { it.isNotEmpty() && !it.equals(row.text.trim(), ignoreCase = true) },onNote = notes[index]?.let { n -> { noteOpen = n } },onHold = notes[index]?.let { n ->{@@ -490,6 +500,8 @@ private fun PanelRow(glowing: Boolean,clock: MutableLongState,noteMeasurer: TextMeasurer,+ /** The line in the reader's language, shown small under it; null when there is none. */+ translation: String?,/** Opens the Genius note on this line; null when Genius has none. */onNote: (() -> Unit)?,onHold: (() -> Unit)?,@@ -629,29 +641,42 @@ private fun PanelRow()CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {- NoteLayout(- text = row.text,- style = lineStyle,- measurer = noteMeasurer,- onNote = onNote,- modifier = shape,- ) {- PanelVoice(- row = row,- clock = clock,+ Column(shape) {+ NoteLayout(+ text = row.text,style = lineStyle,- isActive = isActive,- sung = sung,- synced = synced,- browsing = browsing,- glowAlpha = glow,- room = GLOW_ROOM,- modifier = Modifier.fillMaxWidth(),- )+ measurer = noteMeasurer,+ onNote = onNote,+ ) {+ PanelVoice(+ row = row,+ clock = clock,+ style = lineStyle,+ isActive = isActive,+ sung = sung,+ synced = synced,+ browsing = browsing,+ glowAlpha = glow,+ room = GLOW_ROOM,+ modifier = Modifier.fillMaxWidth(),+ )+ }+ // Smaller and dimmer than the words, and it takes the row's blur and brightness with it.+ if (translation != null) {+ Text(+ text = translation,+ style = TRANSLATION_STYLE,+ color = Immersive.TextSecondary,+ modifier = Modifier.padding(start = GLOW_ROOM, end = GLOW_ROOM, bottom = GLOW_ROOM),+ )+ }}}}+/** A translated line: well below the lyric's 30 sp, so the sung words stay the focus. */+private val TRANSLATION_STYLE = Immersive.Lyric.copy(fontSize = 18.sp, lineHeight = 24.sp, fontWeight = androidx.compose.ui.text.font.FontWeight.Medium)+// ─── Genius notes on the lines ───────────────────────────────────────────────────────────private val NOTE_PILL_COLOR = Color.White.copy(alpha = 0.09f)diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveDownloadsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveDownloadsScreen.ktindex dac25cec..f6f91a18 100644--- a/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveDownloadsScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveDownloadsScreen.kt@@ -221,7 +221,7 @@ fun ImmersiveDownloadsScreen(navController: NavController) {val gone = OfflineCollections.removeSong(t.trackId)Toast.makeText(context,- context.getString(if (gone) R.string.toast_undownload else R.string.download_kept_by_list),+ if (gone) context.getString(R.string.toast_undownload) else OfflineCollections.keptMessage(context, t.trackId),Toast.LENGTH_SHORT,).show()}) {diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveSettingsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveSettingsScreen.ktindex e020bf12..b6123502 100644--- a/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveSettingsScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/pages/ImmersiveSettingsScreen.kt@@ -465,6 +465,10 @@ private fun DisplayPage(open: (SettingsPage) -> Unit, back: () -> Unit) {ImmersiveSwitchRow(stringResource(R.string.settings_music_video_title), checked = com.music.spotui.data.preferences.MusicVideoPref.on,onChecked = { com.music.spotui.data.preferences.MusicVideoPref.set(ctx, it) }, detail = stringResource(R.string.settings_music_video_detail))}+ row {+ ImmersiveSwitchRow(stringResource(R.string.settings_hide_dj_title), checked = com.music.spotui.data.preferences.HideDjPref.on,+ onChecked = { com.music.spotui.data.preferences.HideDjPref.set(ctx, it) }, detail = stringResource(R.string.settings_hide_dj_detail))+ }}immersiveGroup("layout") {row {diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/player/ImmersivePlayer.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/player/ImmersivePlayer.ktindex 37c129c9..37043f99 100644--- a/base/app/src/main/java/com/music/spotui/ui/immersive/player/ImmersivePlayer.kt+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/player/ImmersivePlayer.kt@@ -457,6 +457,7 @@ fun ImmersivePlayer(onDismiss = { showMenu = false },nowPlaying = true,onOpenQueue = { panel = Panel.QUEUE },+ lyricsOpen = lyricsOpen,)}}diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/screens/ImmersiveHomeScreen.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/screens/ImmersiveHomeScreen.ktindex 8446e2fd..af04c878 100644--- a/base/app/src/main/java/com/music/spotui/ui/immersive/screens/ImmersiveHomeScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/screens/ImmersiveHomeScreen.kt@@ -51,6 +51,7 @@ import com.music.spotui.data.api.Responseimport com.music.spotui.data.entity.HomeFeedModelimport com.music.spotui.data.entity.HomeItemimport com.music.spotui.data.entity.HomeSection+import com.music.spotui.data.entity.withoutDjimport com.music.spotui.di.Graphimport com.music.spotui.di.SongPlayerimport com.music.spotui.ui.components.pressHint@@ -120,7 +121,8 @@ fun ImmersiveHomeScreen(navController: NavController) {}// Podcasts can be off: their shows and episodes then leave the feed.- val sections = remember(feed) { feed?.let { visibleSections(it) }.orEmpty() }+ val hideDj = com.music.spotui.data.preferences.HideDjPref.on+ val sections = remember(feed, hideDj) { feed?.let { visibleSections(it) }.orEmpty().let { if (hideDj) it.withoutDj() else it } }// Only the untitled section the web home starts with is a shortcut grid; a titled lead// section is a carousel like any other.val gridSection = sections.firstOrNull()?.takeIf { it.title.isBlank() }diff --git a/base/app/src/main/java/com/music/spotui/ui/immersive/sheets/ImmersiveSongOptionsSheet.kt b/base/app/src/main/java/com/music/spotui/ui/immersive/sheets/ImmersiveSongOptionsSheet.ktindex f1b90708..f4068202 100644--- a/base/app/src/main/java/com/music/spotui/ui/immersive/sheets/ImmersiveSongOptionsSheet.kt+++ b/base/app/src/main/java/com/music/spotui/ui/immersive/sheets/ImmersiveSongOptionsSheet.kt@@ -22,11 +22,13 @@ import androidx.compose.material.icons.rounded.Checkimport androidx.compose.material.icons.rounded.DeleteOutlineimport androidx.compose.material.icons.rounded.Infoimport androidx.compose.material.icons.rounded.Lightbulb+import androidx.compose.material.icons.rounded.Translateimport androidx.compose.material.icons.rounded.Personimport androidx.compose.material.icons.rounded.Radioimport androidx.compose.material.icons.rounded.Shareimport androidx.compose.material.icons.rounded.Speedimport androidx.compose.runtime.Composable+import androidx.compose.runtime.collectAsStateimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.produceState@@ -70,6 +72,8 @@ fun ImmersiveSongOptionsSheet(onOpenQueue: (() -> Unit)? = null,onRemoveFromPlaylist: (() -> Unit)? = null,currentPlaylistId: String? = null,+ /** The player's lyrics panel is open: the translation row works on the lyrics it shows. */+ lyricsOpen: Boolean = false,) {val playerViewModel: com.music.spotui.ui.viewmodel.PlayerViewModel =androidx.lifecycle.viewmodel.compose.viewModel()@@ -149,7 +153,7 @@ fun ImmersiveSongOptionsSheet(com.music.spotui.data.offline.PodcastDownloader.remove(downloadKey)true} else com.music.spotui.data.offline.OfflineCollections.removeSong(downloadKey)- toast(context.getString(if (gone) R.string.toast_undownload else R.string.download_kept_by_list))+ toast(if (gone) context.getString(R.string.toast_undownload) else com.music.spotui.data.offline.OfflineCollections.keptMessage(context, downloadKey))onDismiss()}offline == com.music.spotui.data.offline.OfflineStatus.Queued ||@@ -194,6 +198,24 @@ fun ImmersiveSongOptionsSheet(if (nowPlaying && hasId && !song.url.startsWith("episode:")) {ImmersiveSheetRow(Icons.Rounded.Lightbulb, stringResource(R.string.lyrics_meaning_title)) { showMeaning = true }}+ if (nowPlaying && lyricsOpen) {+ // The lyrics panel's translation, the Classic look's: same model, shown under each line.+ val lyricsVm: com.music.spotui.ui.viewmodel.LyricsViewModel = androidx.lifecycle.viewmodel.compose.viewModel()+ val lyrics = lyricsVm.state.collectAsState().value as? com.music.spotui.ui.viewmodel.LyricsViewModel.State.Loaded+ val target = com.music.spotui.data.preferences.getLyricTranslateLang(context)+ .ifBlank { java.util.Locale.getDefault().language.ifBlank { "en" } }+ val sameLanguage = lyrics?.sourceLanguage?.substringBefore('-')+ ?.equals(target.substringBefore('-'), ignoreCase = true) == true+ if (lyrics != null && !sameLanguage) {+ ImmersiveSheetRow(+ Icons.Rounded.Translate,+ stringResource(if (lyrics.showTranslation) R.string.lyrics_fullscreen_translate_button_enabled_readout_value else R.string.lyrics_fullscreen_context_menu_main_page_translate_lyrics_action),+ ) {+ lyricsVm.toggleTranslation(target)+ onDismiss()+ }+ }+ }val trackUri = "spotify:track:${song.spotifyTrackId}"val excluded by produceState<Boolean?>(null, trackUri) {diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/DownloadsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/DownloadsScreen.ktindex 2eed2512..3ece7d89 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/DownloadsScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/DownloadsScreen.kt@@ -271,7 +271,7 @@ fun DownloadsScreen(navController: NavController) {val current = LocalPlayer.active.value && np.uri == "spotify:track:${t.trackId}"com.music.spotui.ui.components.SwipeToRemove(t.trackId, onRemove = {val gone = com.music.spotui.data.offline.OfflineCollections.removeSong(t.trackId)- android.widget.Toast.makeText(context, context.getString(if (gone) R.string.toast_undownload else R.string.download_kept_by_list), android.widget.Toast.LENGTH_SHORT).show()+ android.widget.Toast.makeText(context, if (gone) context.getString(R.string.toast_undownload) else com.music.spotui.data.offline.OfflineCollections.keptMessage(context, t.trackId), android.widget.Toast.LENGTH_SHORT).show()}) { Row(verticalAlignment = Alignment.CenterVertically,modifier = Modifier.fillMaxWidth().pressable(0.97f) { play(i) }.padding(horizontal = 16.dp, vertical = 8.dp),diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/HomeScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/HomeScreen.ktindex 0fa53fbe..1f820b57 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/HomeScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/HomeScreen.kt@@ -83,6 +83,7 @@ import com.music.spotui.data.entity.AlbumsModelimport com.music.spotui.data.entity.ArtistsModelimport com.music.spotui.data.entity.HomeFeedModelimport com.music.spotui.data.entity.HomeItem+import com.music.spotui.data.entity.withoutDjimport com.music.spotui.data.entity.HomeSectionimport com.music.spotui.ui.components.Loaderimport com.music.spotui.ui.navigation.Routes@@ -174,9 +175,11 @@ fun HomeFeedContent(navController: NavController, feed: HomeFeedModel, facet: St// not force-squeezed into the grid.// Podcasts are off for now: their shows and episodes leave the feed.// Kept between recompositions: a new list for every one of them would restart the rows below.- val sections = remember(feed) {- if (com.music.spotui.data.api.Features.PODCASTS) feed.sections+ val hideDj = com.music.spotui.data.preferences.HideDjPref.on+ val sections = remember(feed, hideDj) {+ val all = if (com.music.spotui.data.api.Features.PODCASTS) feed.sectionselse feed.sections.map { s -> s.copy(items = s.items.filterNot { it is HomeItem.Show }) }.filter { it.items.isNotEmpty() }+ if (hideDj) all.withoutDj() else all}val gridSection = remember(sections) { sections.firstOrNull()?.takeIf { it.title.isBlank() } }val carousels = remember(sections, gridSection) { if (gridSection != null) sections.drop(1) else sections }diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.ktindex 9a373a58..912dc359 100644--- a/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.kt+++ b/base/app/src/main/java/com/music/spotui/ui/screens/SettingsScreen.kt@@ -226,6 +226,12 @@ fun SettingsScreen(navController: NavController) {checked = com.music.spotui.data.preferences.SolidNavBar.on,onChecked = { com.music.spotui.data.preferences.SolidNavBar.set(ctx, it) },)+ OptionRow(+ label = stringResource(R.string.settings_hide_dj_title),+ detail = stringResource(R.string.settings_hide_dj_detail),+ checked = com.music.spotui.data.preferences.HideDjPref.on,+ onChecked = { com.music.spotui.data.preferences.HideDjPref.set(ctx, it) },+ )AccentRow(com.music.spotui.data.preferences.Look.CLASSIC)LookRow()OrientationRow()diff --git a/base/app/src/main/res/values-de/myspoti_strings.xml b/base/app/src/main/res/values-de/myspoti_strings.xmlindex 6365d331..f81febbe 100644--- a/base/app/src/main/res/values-de/myspoti_strings.xml+++ b/base/app/src/main/res/values-de/myspoti_strings.xml@@ -78,6 +78,7 @@<string name="local_playlist_empty">Füge Songs aus Lokale Dateien mit ihrem +-Button hinzu.</string><string name="playlist_change_refused">Spotify hat die Änderung an dieser Playlist abgelehnt</string><string name="download_kept_by_list">Bleibt heruntergeladen: Eine heruntergeladene Playlist enthält ihn</string>+ <string name="download_kept_by_named">Bleibt heruntergeladen: „%1$s“ ist heruntergeladen und enthält ihn</string><string name="support_title">Myspoti unterstützen</string><string name="support_body">Myspoti ist kostenlos, werbefrei und wird in meiner Freizeit entwickelt. Wenn es dir gefällt, hilft eine kleine Spende, es am Laufen zu halten.</string><string name="support_action">Auf Ko-fi unterstützen</string>@@ -524,6 +525,8 @@<string name="duplicate_dont_add">Nicht hinzufügen</string><string name="settings_music_video_title">Musikvideos</string><string name="settings_music_video_detail">Die Videotaste im Player und Clips, die von selbst starten. Aus: nur Audio und Canvas.</string>+ <string name="settings_hide_dj_title">DJ ausblenden</string>+ <string name="settings_hide_dj_detail">Entfernt den Spotify-DJ von der Startseite</string><string name="downloads_need_source">Downloads brauchen eine Quell-Erweiterung. Installiere eine unter Einstellungen, Erweiterungen.</string><string name="downloads_source_row_title">Download-Quelle</string><string name="downloads_source_row_on">Eine Erweiterung liefert die Dateien. Tippen, um Erweiterungen zu verwalten.</string>diff --git a/base/app/src/main/res/values-el/myspoti_strings.xml b/base/app/src/main/res/values-el/myspoti_strings.xmlindex f31256a9..72a2941a 100644--- a/base/app/src/main/res/values-el/myspoti_strings.xml+++ b/base/app/src/main/res/values-el/myspoti_strings.xml@@ -78,6 +78,7 @@<string name="local_playlist_empty">Πρόσθεσε τραγούδια από τα Τοπικά αρχεία με το κουμπί + τους.</string><string name="playlist_change_refused">Το Spotify απέρριψε την αλλαγή σε αυτή την playlist</string><string name="download_kept_by_list">Εξακολουθεί να έχει ληφθεί: τη διατηρεί μια playlist που έχει ληφθεί</string>+ <string name="download_kept_by_named">Εξακολουθεί να έχει ληφθεί: το «%1$s» έχει ληφθεί και το περιέχει</string><string name="support_title">Στήριξε το Myspoti</string><string name="support_body">Το Myspoti είναι δωρεάν, χωρίς διαφημίσεις, και φτιάχνεται στον ελεύθερο χρόνο μου. Αν σου αρέσει, μια μικρή δωρεά βοηθά να συνεχίσει.</string><string name="support_action">Στήριξε στο Ko-fi</string>@@ -524,6 +525,8 @@<string name="duplicate_dont_add">Να μην προστεθούν</string><string name="settings_music_video_title">Μουσικά βίντεο</string><string name="settings_music_video_detail">Το κουμπί βίντεο στο πρόγραμμα αναπαραγωγής και τα κλιπ που ξεκινούν μόνα τους. Ανενεργό: μόνο ήχος και Canvas.</string>+ <string name="settings_hide_dj_title">Απόκρυψη του DJ</string>+ <string name="settings_hide_dj_detail">Αφαιρεί το DJ του Spotify από την αρχική</string><string name="downloads_need_source">Οι λήψεις χρειάζονται μια επέκταση πηγής. Εγκαταστήστε μία στις Ρυθμίσεις, Επεκτάσεις.</string><string name="downloads_source_row_title">Πηγή λήψεων</string><string name="downloads_source_row_on">Μια επέκταση παρέχει τα αρχεία. Πατήστε για διαχείριση των επεκτάσεων.</string>diff --git a/base/app/src/main/res/values-es/myspoti_strings.xml b/base/app/src/main/res/values-es/myspoti_strings.xmlindex a24c06f1..e82560e4 100644--- a/base/app/src/main/res/values-es/myspoti_strings.xml+++ b/base/app/src/main/res/values-es/myspoti_strings.xml@@ -78,6 +78,7 @@<string name="local_playlist_empty">Añade canciones desde Archivos locales con su botón +.</string><string name="playlist_change_refused">Spotify ha rechazado el cambio en esta playlist</string><string name="download_kept_by_list">Sigue descargada: una playlist descargada la incluye</string>+ <string name="download_kept_by_named">Sigue descargada: «%1$s» está descargado y la incluye</string><string name="support_title">Apoya Myspoti</string><string name="support_body">Myspoti es gratis, sin anuncios, y lo desarrollo en mi tiempo libre. Si te gusta, una pequeña donación ayuda a que siga adelante.</string><string name="support_action">Apoyar en Ko-fi</string>@@ -524,6 +525,8 @@<string name="duplicate_dont_add">No añadir</string><string name="settings_music_video_title">Vídeos musicales</string><string name="settings_music_video_detail">El botón de vídeo del reproductor y los clips que se inician solos. Desactivado: solo audio y Canvas.</string>+ <string name="settings_hide_dj_title">Ocultar el DJ</string>+ <string name="settings_hide_dj_detail">Quita el DJ de Spotify de Inicio</string><string name="downloads_need_source">Las descargas necesitan una extensión de origen. Instala una en Ajustes, Extensiones.</string><string name="downloads_source_row_title">Origen de descargas</string><string name="downloads_source_row_on">Una extensión proporciona los archivos. Toca para gestionar las extensiones.</string>diff --git a/base/app/src/main/res/values-fr/myspoti_strings.xml b/base/app/src/main/res/values-fr/myspoti_strings.xmlindex b6b7e802..dfd0922f 100644--- a/base/app/src/main/res/values-fr/myspoti_strings.xml+++ b/base/app/src/main/res/values-fr/myspoti_strings.xml@@ -91,6 +91,7 @@<string name="local_playlist_empty">Ajoutez des titres depuis Fichiers locaux avec leur bouton +.</string><string name="playlist_change_refused">Spotify a refusé la modification de cette playlist</string><string name="download_kept_by_list">Reste téléchargé : une playlist téléchargée le contient</string>+ <string name="download_kept_by_named">Reste téléchargé : « %1$s » est téléchargé et le contient</string><string name="support_title">Soutenir Myspoti</string><string name="support_body">Myspoti est gratuit, sans publicité, et développé sur mon temps libre. Si vous l\'appréciez, un petit don aide à le faire avancer.</string><string name="support_action">Soutenir sur Ko-fi</string>@@ -529,6 +530,8 @@<string name="duplicate_dont_add">Ne pas ajouter</string><string name="settings_music_video_title">Clips vidéo</string><string name="settings_music_video_detail">Le bouton vidéo du lecteur et les clips qui démarrent seuls. Désactivé : audio et Canvas uniquement.</string>+ <string name="settings_hide_dj_title">Masquer le DJ</string>+ <string name="settings_hide_dj_detail">Retire le DJ de Spotify de l\'accueil</string><string name="downloads_need_source">Les téléchargements ont besoin d\'une extension source. Installez-en une dans Réglages, Extensions.</string><string name="downloads_source_row_title">Source des téléchargements</string><string name="downloads_source_row_on">Une extension fournit les fichiers. Touchez pour gérer les extensions.</string>diff --git a/base/app/src/main/res/values-it/myspoti_strings.xml b/base/app/src/main/res/values-it/myspoti_strings.xmlindex 79346d43..7035e460 100644--- a/base/app/src/main/res/values-it/myspoti_strings.xml+++ b/base/app/src/main/res/values-it/myspoti_strings.xml@@ -78,6 +78,7 @@<string name="local_playlist_empty">Aggiungi brani dai File locali con il loro pulsante +.</string><string name="playlist_change_refused">Spotify ha rifiutato la modifica a questa playlist</string><string name="download_kept_by_list">Ancora scaricato: una playlist scaricata lo contiene</string>+ <string name="download_kept_by_named">Ancora scaricato: «%1$s» è scaricato e lo contiene</string><string name="support_title">Sostieni Myspoti</string><string name="support_body">Myspoti è gratuito, senza pubblicità, e fatto nel mio tempo libero. Se ti piace, una piccola donazione aiuta a farlo andare avanti.</string><string name="support_action">Sostieni su Ko-fi</string>@@ -524,6 +525,8 @@<string name="duplicate_dont_add">Non aggiungere</string><string name="settings_music_video_title">Video musicali</string><string name="settings_music_video_detail">Il pulsante video nel player e le clip che partono da sole. Disattivato: solo audio e Canvas.</string>+ <string name="settings_hide_dj_title">Nascondi il DJ</string>+ <string name="settings_hide_dj_detail">Toglie il DJ di Spotify dalla Home</string><string name="downloads_need_source">I download richiedono un\'estensione sorgente. Installane una in Impostazioni, Estensioni.</string><string name="downloads_source_row_title">Sorgente dei download</string><string name="downloads_source_row_on">Un\'estensione fornisce i file. Tocca per gestire le estensioni.</string>diff --git a/base/app/src/main/res/values-pl/myspoti_strings.xml b/base/app/src/main/res/values-pl/myspoti_strings.xmlindex 888deac1..f182e37a 100644--- a/base/app/src/main/res/values-pl/myspoti_strings.xml+++ b/base/app/src/main/res/values-pl/myspoti_strings.xml@@ -88,6 +88,7 @@<string name="local_playlist_empty">Dodawaj utwory z plików lokalnych przyciskiem +.</string><string name="playlist_change_refused">Spotify odrzuciło zmianę w tej playliście</string><string name="download_kept_by_list">Nadal pobrane: trzyma je pobrana playlista</string>+ <string name="download_kept_by_named">Nadal pobrane: «%1$s» jest pobrane i zawiera ten utwór</string><string name="support_title">Wesprzyj Myspoti</string><string name="support_body">Myspoti jest darmowe, bez reklam i powstaje w moim wolnym czasie. Jeśli Ci się podoba, niewielka darowizna pomoże je rozwijać.</string><string name="support_action">Wesprzyj na Ko-fi</string>@@ -546,6 +547,8 @@<string name="duplicate_dont_add">Nie dodawaj</string><string name="settings_music_video_title">Teledyski</string><string name="settings_music_video_detail">Przycisk wideo w odtwarzaczu i klipy, które włączają się same. Wyłączone: tylko dźwięk i Canvas.</string>+ <string name="settings_hide_dj_title">Ukryj DJ-a</string>+ <string name="settings_hide_dj_detail">Usuwa DJ-a Spotify ze strony głównej</string><string name="downloads_need_source">Pobieranie wymaga rozszerzenia źródłowego. Zainstaluj je w Ustawieniach, Rozszerzenia.</string><string name="downloads_source_row_title">Źródło pobierania</string><string name="downloads_source_row_on">Pliki dostarcza rozszerzenie. Dotknij, aby zarządzać rozszerzeniami.</string>diff --git a/base/app/src/main/res/values-pt/myspoti_strings.xml b/base/app/src/main/res/values-pt/myspoti_strings.xmlindex b78fcf81..da059325 100644--- a/base/app/src/main/res/values-pt/myspoti_strings.xml+++ b/base/app/src/main/res/values-pt/myspoti_strings.xml@@ -78,6 +78,7 @@<string name="local_playlist_empty">Adiciona músicas de Ficheiros locais com o botão +.</string><string name="playlist_change_refused">O Spotify recusou a alteração a esta playlist</string><string name="download_kept_by_list">Continua transferida: uma playlist transferida inclui-a</string>+ <string name="download_kept_by_named">Continua transferida: «%1$s» está transferido e inclui-a</string><string name="support_title">Apoiar o Myspoti</string><string name="support_body">O Myspoti é gratuito, sem anúncios, e é feito no meu tempo livre. Se gostas, um pequeno donativo ajuda a mantê-lo a funcionar.</string><string name="support_action">Apoiar no Ko-fi</string>@@ -524,6 +525,8 @@<string name="duplicate_dont_add">Não adicionar</string><string name="settings_music_video_title">Videoclipes</string><string name="settings_music_video_detail">O botão de vídeo no player e os clipes que começam sozinhos. Desativado: só áudio e Canvas.</string>+ <string name="settings_hide_dj_title">Ocultar o DJ</string>+ <string name="settings_hide_dj_detail">Tira o DJ do Spotify do Início</string><string name="downloads_need_source">Os downloads precisam de uma extensão de origem. Instale uma em Configurações, Extensões.</string><string name="downloads_source_row_title">Origem dos downloads</string><string name="downloads_source_row_on">Uma extensão fornece os arquivos. Toque para gerenciar as extensões.</string>diff --git a/base/app/src/main/res/values-ru/myspoti_strings.xml b/base/app/src/main/res/values-ru/myspoti_strings.xmlindex 7e2d9493..b7dc1665 100644--- a/base/app/src/main/res/values-ru/myspoti_strings.xml+++ b/base/app/src/main/res/values-ru/myspoti_strings.xml@@ -88,6 +88,7 @@<string name="local_playlist_empty">Добавляйте треки из локальных файлов кнопкой +.</string><string name="playlist_change_refused">Spotify отклонил изменение этого плейлиста</string><string name="download_kept_by_list">Остаётся скачанным: его держит скачанный плейлист</string>+ <string name="download_kept_by_named">Остаётся скачанным: «%1$s» скачан и содержит его</string><string name="support_title">Поддержать Myspoti</string><string name="support_body">Myspoti бесплатен, без рекламы и создан в моё свободное время. Если он вам нравится, небольшое пожертвование поможет проекту жить дальше.</string><string name="support_action">Поддержать на Ko-fi</string>@@ -546,6 +547,8 @@<string name="duplicate_dont_add">Не добавлять</string><string name="settings_music_video_title">Музыкальные клипы</string><string name="settings_music_video_detail">Кнопка видео в плеере и клипы, которые запускаются сами. Выкл.: только аудио и Canvas.</string>+ <string name="settings_hide_dj_title">Скрыть DJ</string>+ <string name="settings_hide_dj_detail">Убирает DJ Spotify с главной</string><string name="downloads_need_source">Для загрузок нужно расширение-источник. Установите его в разделе «Настройки», «Расширения».</string><string name="downloads_source_row_title">Источник загрузок</string><string name="downloads_source_row_on">Файлы предоставляет расширение. Нажмите, чтобы управлять расширениями.</string>diff --git a/base/app/src/main/res/values-zh/myspoti_strings.xml b/base/app/src/main/res/values-zh/myspoti_strings.xmlindex c3456586..4972e202 100644--- a/base/app/src/main/res/values-zh/myspoti_strings.xml+++ b/base/app/src/main/res/values-zh/myspoti_strings.xml@@ -85,6 +85,7 @@<string name="local_playlist_empty">点按“本地文件”中的 + 按钮来添加歌曲。</string><string name="playlist_change_refused">Spotify 拒绝了对此播放列表的更改</string><string name="download_kept_by_list">仍保留下载:已下载的播放列表包含它</string>+ <string name="download_kept_by_named">仍保留下载:已下载的“%1$s”包含它</string><string name="support_title">支持 Myspoti</string><string name="support_body">Myspoti 免费、无广告,由我在业余时间制作。如果你喜欢它,一点小小的捐助能帮助它继续下去。</string><string name="support_action">在 Ko-fi 上支持</string>@@ -537,6 +538,8 @@<string name="duplicate_dont_add">不添加</string><string name="settings_music_video_title">音乐视频</string><string name="settings_music_video_detail">播放器中的视频按钮,以及自动开始的片段。关闭后:仅音频和 Canvas。</string>+ <string name="settings_hide_dj_title">隐藏 DJ</string>+ <string name="settings_hide_dj_detail">从首页移除 Spotify 的 DJ</string><string name="downloads_need_source">下载需要一个来源扩展。请在“设置”>“扩展”中安装一个。</string><string name="downloads_source_row_title">下载来源</string><string name="downloads_source_row_on">由扩展提供文件。点按以管理扩展。</string>diff --git a/base/app/src/main/res/values/myspoti_strings.xml b/base/app/src/main/res/values/myspoti_strings.xmlindex 4abb0782..55e06e84 100644--- a/base/app/src/main/res/values/myspoti_strings.xml+++ b/base/app/src/main/res/values/myspoti_strings.xml@@ -91,6 +91,7 @@<string name="local_playlist_empty">Add songs from Local Files with their + button.</string><string name="playlist_change_refused">Spotify refused the change to this playlist</string><string name="download_kept_by_list">Still downloaded: a downloaded playlist holds it</string>+ <string name="download_kept_by_named">Still downloaded: “%1$s” is downloaded and holds it</string><string name="support_title">Support Myspoti</string><string name="support_body">Myspoti is free, without ads, and made in my spare time. If you enjoy it, a small donation helps keep it going.</string><string name="support_action">Support on Ko-fi</string>@@ -549,6 +550,8 @@<string name="duplicate_dont_add">Don\'t add</string><string name="settings_music_video_title">Music videos</string><string name="settings_music_video_detail">The video button in the player, and clips that start by themselves. Off: audio and Canvas only.</string>+ <string name="settings_hide_dj_title">Hide the DJ</string>+ <string name="settings_hide_dj_detail">Removes Spotify\'s DJ from Home</string><string name="downloads_need_source">Downloads need a source extension. Install one in Settings, Extensions.</string><string name="downloads_source_row_title">Download source</string><string name="downloads_source_row_on">An extension gives the files. Tap to manage extensions.</string>diff --git a/base/extensions/src/main/kotlin/app/myspoti/extensions/Outcome.kt b/base/extensions/src/main/kotlin/app/myspoti/extensions/Outcome.ktindex 35a06a63..6deca3e9 100644--- a/base/extensions/src/main/kotlin/app/myspoti/extensions/Outcome.kt+++ b/base/extensions/src/main/kotlin/app/myspoti/extensions/Outcome.kt@@ -48,6 +48,12 @@ sealed class Outcome {/** Whether it counts as a failure of the extension ([Bug] only). */val counts: Boolean get() = this is Bug+ /**+ * It could not answer now (busy, a network error, a rate limit, its server down, signed out):+ * not the same as having nothing for the song, so a download is not "no matching recording".+ */+ val silent: Boolean get() = this is Skipped || this is Network || this is RateLimited || this is ServerDown || this is SignIn+/** `key` and its detail, for one log line. */fun describe(): String = key + (detail?.let { ": $it" } ?: "") + when (this) {is RateLimited -> retryAfterMs?.let { " (retry after $it ms)" } ?: ""diff --git a/base/extensions/src/test/kotlin/app/myspoti/extensions/OutcomeTest.kt b/base/extensions/src/test/kotlin/app/myspoti/extensions/OutcomeTest.ktindex 2435248c..11ada13e 100644--- a/base/extensions/src/test/kotlin/app/myspoti/extensions/OutcomeTest.kt+++ b/base/extensions/src/test/kotlin/app/myspoti/extensions/OutcomeTest.kt@@ -30,6 +30,11 @@ class OutcomeTest {assertEquals(Outcome.MAX_DETAIL, (Outcome.parse(Hook.LYRICS, """{"outcome":"sign-in","detail":"${"x".repeat(500)}"}""") as Outcome.SignIn).detail!!.length)}+ @Test fun silentIsNotNothingToOffer() {+ listOf(Outcome.Skipped(), Outcome.Network(), Outcome.RateLimited(), Outcome.ServerDown(), Outcome.SignIn()).forEach { assertTrue(it.key, it.silent) }+ listOf(Outcome.Found, Outcome.NotFound, Outcome.QualityUnavailable(), Outcome.Bug("x")).forEach { assertFalse(it.key, it.silent) }+ }+@Test fun failuresAreClassified() {assertEquals("network", Outcome.of(ExtensionTimeout("took longer than 15000 ms")).key)assertEquals("network", Outcome.of(ExtensionException("Error: http: api.example.com: no such host (main.js:3)")).key)