Skip to content

Native Android client for Spotify, built with Jetpack Compose

A download that failed because a source is inactive, still starting or not answering names that source on its row in both looks ("Qobuz is not answering for now · Try again"), in English, German, Greek, Spanish, French, Italian, Polish, Portuguese, Brazilian Portuguese, Russian and Chinese

kota-zod345e6bc5393
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.kt
index f5d52abf..f3e0e6ac 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
@@ -248,7 +248,9 @@ object OfflineDownloader {
}
}
- private suspend fun setStatus(id: String, s: OfflineStatus?) = withContext(Dispatchers.Main) {
+ /** [by]: the download sources a failure waits for (Extensions.NotAnswering), shown on its row. */
+ private suspend fun setStatus(id: String, s: OfflineStatus?, by: List<String> = emptyList()) = withContext(Dispatchers.Main) {
+ if (by.isEmpty()) OfflineStore.notAnswering.remove(id) else OfflineStore.notAnswering[id] = by.joinToString(", ")
if (s == null) OfflineStore.status.remove(id) else OfflineStore.status[id] = s
}
@@ -261,6 +263,7 @@ object OfflineDownloader {
if (synchronized(pending) { !pending.containsKey(r.trackId) }) return
}
val job = scope.launch {
+ var by = emptyList<String>()
val outcome: OfflineStatus? = try {
setStatus(r.trackId, OfflineStatus.Downloading(-1f))
val t = download(r)
@@ -277,13 +280,14 @@ object OfflineDownloader {
// Failed, not unavailable: a source could not answer or was not asked (inactive, still starting),
// so a tap on the song tries it again.
Log.i(TAG, "${r.title}: download source not answering: ${e.message}")
+ by = e.sources
OfflineStatus.Failed
} catch (t: Throwable) {
Log.w(TAG, "${r.title} failed", t)
OfflineStatus.Failed
}
synchronized(pending) { pending.remove(r.trackId); savePending() }
- if (outcome != null) setStatus(r.trackId, outcome)
+ if (outcome != null) setStatus(r.trackId, outcome, by)
}
running[r.trackId] = job
job.join()
diff --git a/base/app/src/main/java/com/music/spotui/data/offline/OfflineStore.kt b/base/app/src/main/java/com/music/spotui/data/offline/OfflineStore.kt
index e2370561..345e645a 100644
--- a/base/app/src/main/java/com/music/spotui/data/offline/OfflineStore.kt
+++ b/base/app/src/main/java/com/music/spotui/data/offline/OfflineStore.kt
@@ -98,6 +98,8 @@ object OfflineStore {
val tracks: SnapshotStateMap<String, OfflineTrack> = mutableStateMapOf()
/** Songs in the download queue, or whose last attempt did not succeed. */
val status: SnapshotStateMap<String, OfflineStatus> = mutableStateMapOf()
+ /** The download sources a [OfflineStatus.Failed] song waits for (not answering, inactive, still starting), by track id. */
+ val notAnswering: SnapshotStateMap<String, String> = mutableStateMapOf()
fun init(context: Context) {
if (::root.isInitialized) return
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.kt
index 2d25afe6..633b8924 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,8 +86,11 @@ 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, or was not asked: the song is worth trying again. */
- class NotAnswering(message: String) : java.io.IOException(message)
+ /**
+ * No download source had the song and one could not answer now, or was not asked: the song is
+ * worth trying again. [sources]: the names of those sources, for the song's row.
+ */
+ class NotAnswering(message: String, val sources: List<String> = emptyList()) : java.io.IOException(message)
// Every hook's time is in [HookBudgets], shared with the desktop runner (`myspoti-ext`).
/** A lyrics hook call. */
@@ -777,11 +780,12 @@ object Extensions {
// there, nor has one on that was not asked: 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()}" }
+ (cooldown.reason(id)?.let { "$id set aside: $it" } ?: answers[id]?.takeIf { it.silent }?.let { "$id ${it.describe()}" })?.let { id to it }
} + downloadNotAsked()
if (silent.isNotEmpty()) {
- Logbook.log("download: ${track.title} not found, not marked unavailable: ${silent.joinToString("; ")}")
- throw NotAnswering(silent.joinToString("; "))
+ val why = silent.joinToString("; ") { it.second }
+ Logbook.log("download: ${track.title} not found, not marked unavailable: $why")
+ throw NotAnswering(why, silent.map { (id, _) -> manifest(id)?.name ?: id }.distinct())
}
}
return found?.let { (c, files) ->
@@ -795,14 +799,14 @@ object Extensions {
* The download sources on that [providing] leaves out, with why ("x inactive: …", "x still starting"):
* their `status` said they do not answer now, or they are not running yet. Neither said a song is not there.
*/
- private fun downloadNotAsked(): List<String> = _registry.value.let { r ->
+ private fun downloadNotAsked(): List<Pair<String, String>> = _registry.value.let { r ->
line(r, Action.DOWNLOAD_SOURCE).mapNotNull(r::find).filter { it.enabled }.mapNotNull { e ->
val rt = runtimes[e.id]
when {
rt == null -> "${e.id} still starting".takeIf { Action.DOWNLOAD_SOURCE.key in e.granted }
rt.provides(Hook.DOWNLOAD_SOURCE) && health.inactive(e.id) -> "${e.id} inactive: ${health.last(e.id)?.detail ?: "no detail"}"
else -> null
- }
+ }?.let { e.id to it }
}
}
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.kt
index 6a805733..15b4d483 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
@@ -183,7 +183,8 @@ fun ImmersiveDownloadsScreen(navController: NavController) {
val line = when (status) {
OfflineStatus.Unavailable -> stringResource(R.string.download_unavailable)
OfflineStatus.Failed ->
- stringResource(R.string.download_badge_error_content_description) + " · " + stringResource(R.string.download_retry)
+ (OfflineStore.notAnswering[r.trackId]?.let { stringResource(R.string.download_source_not_answering, it) }
+ ?: stringResource(R.string.download_badge_error_content_description)) + " · " + stringResource(R.string.download_retry)
else -> stringResource(R.string.download_notification_downloading)
}
ImmersiveListRow(
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.kt
index 3ece7d89..92f97414 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
@@ -217,7 +217,8 @@ fun DownloadsScreen(navController: NavController) {
Text(r.title, color = AppText.copy(alpha = 0.6f), fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
val line = when (status) {
OfflineStatus.Unavailable -> stringResource(R.string.download_unavailable)
- OfflineStatus.Failed -> stringResource(R.string.download_badge_error_content_description) + " · " + stringResource(R.string.download_retry)
+ OfflineStatus.Failed -> (OfflineStore.notAnswering[r.trackId]?.let { stringResource(R.string.download_source_not_answering, it) }
+ ?: stringResource(R.string.download_badge_error_content_description)) + " · " + stringResource(R.string.download_retry)
else -> stringResource(R.string.download_notification_downloading)
}
Text(line, color = if (problem) AppDestructive else AppMuted, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
diff --git a/base/app/src/main/res/values-de/myspoti_strings.xml b/base/app/src/main/res/values-de/myspoti_strings.xml
index 37f277a1..615c1b2d 100644
--- a/base/app/src/main/res/values-de/myspoti_strings.xml
+++ b/base/app/src/main/res/values-de/myspoti_strings.xml
@@ -657,4 +657,5 @@
<string name="equalizer_speed_detail">Alles, was die App selbst abspielt, Musik und heruntergeladene Folgen. Von Spotify gestreamte Folgen behalten die Geschwindigkeit des Podcast-Players. Bei jeder Geschwindigkeit außer 1× spielt Spotify den Titel nicht mit (er wird dort nicht gezählt und deine anderen Geräte sehen ihn nicht): Spotify spielt Musik nur mit 1×.</string>
<string name="equalizer_skip_silence">Stille überspringen</string>
<string name="equalizer_skip_silence_detail">Stille Abschnitte werden übersprungen (lange Pausen in einer Folge, Stille vor einem versteckten Titel).</string>
+ <string name="download_source_not_answering">%1$s antwortet gerade nicht</string>
</resources>
diff --git a/base/app/src/main/res/values-el/myspoti_strings.xml b/base/app/src/main/res/values-el/myspoti_strings.xml
index 75565e58..a5fd0a89 100644
--- a/base/app/src/main/res/values-el/myspoti_strings.xml
+++ b/base/app/src/main/res/values-el/myspoti_strings.xml
@@ -657,4 +657,5 @@
<string name="equalizer_speed_detail">Όλα όσα αναπαράγει η ίδια η εφαρμογή, μουσική και κατεβασμένα επεισόδια. Τα επεισόδια που μεταδίδει το Spotify κρατούν την ταχύτητα του player podcast. Σε οποιαδήποτε ταχύτητα εκτός από 1×, το Spotify δεν παίζει το κομμάτι παράλληλα (δεν καταμετράται εκεί και οι άλλες συσκευές σου δεν το βλέπουν): το Spotify παίζει μουσική μόνο στο 1×.</string>
<string name="equalizer_skip_silence">Παράλειψη σιωπών</string>
<string name="equalizer_skip_silence_detail">Τα σιωπηλά διαστήματα παραλείπονται (μεγάλες παύσεις σε ένα επεισόδιο, σιωπή πριν από κρυφό κομμάτι).</string>
+ <string name="download_source_not_answering">Η πηγή %1$s δεν απαντά προς το παρόν</string>
</resources>
diff --git a/base/app/src/main/res/values-es/myspoti_strings.xml b/base/app/src/main/res/values-es/myspoti_strings.xml
index 423d098e..cc011e5c 100644
--- a/base/app/src/main/res/values-es/myspoti_strings.xml
+++ b/base/app/src/main/res/values-es/myspoti_strings.xml
@@ -657,4 +657,5 @@
<string name="equalizer_speed_detail">Todo lo que la app reproduce ella misma, música y episodios descargados. Los episodios emitidos por Spotify conservan la velocidad del reproductor de podcasts. A cualquier velocidad distinta de 1×, Spotify no reproduce la canción en paralelo (allí no se cuenta y tus otros dispositivos no la ven): Spotify solo reproduce música a 1×.</string>
<string name="equalizer_skip_silence">Saltar silencios</string>
<string name="equalizer_skip_silence_detail">Los tramos silenciosos se saltan (pausas largas en un episodio, un silencio antes de una pista oculta).</string>
+ <string name="download_source_not_answering">%1$s no responde por ahora</string>
</resources>
diff --git a/base/app/src/main/res/values-fr/myspoti_strings.xml b/base/app/src/main/res/values-fr/myspoti_strings.xml
index 7c8a797a..f19eab55 100644
--- a/base/app/src/main/res/values-fr/myspoti_strings.xml
+++ b/base/app/src/main/res/values-fr/myspoti_strings.xml
@@ -662,4 +662,5 @@
<string name="equalizer_speed_detail">Tout ce que l’appli joue elle-même, musique et épisodes téléchargés. Les épisodes diffusés par Spotify gardent la vitesse du lecteur de podcasts. À toute vitesse autre que 1×, Spotify ne joue pas le titre en parallèle (il n’y est pas compté et vos autres appareils ne le voient pas) : Spotify ne joue la musique qu’à 1×.</string>
<string name="equalizer_skip_silence">Sauter les silences</string>
<string name="equalizer_skip_silence_detail">Les passages silencieux sont sautés (longues pauses dans un épisode, silence avant un titre caché).</string>
+ <string name="download_source_not_answering">%1$s ne répond pas pour le moment</string>
</resources>
diff --git a/base/app/src/main/res/values-it/myspoti_strings.xml b/base/app/src/main/res/values-it/myspoti_strings.xml
index c6ed3412..5c362215 100644
--- a/base/app/src/main/res/values-it/myspoti_strings.xml
+++ b/base/app/src/main/res/values-it/myspoti_strings.xml
@@ -657,4 +657,5 @@
<string name="equalizer_speed_detail">Tutto ciò che l\'app riproduce da sé, musica ed episodi scaricati. Gli episodi in streaming da Spotify mantengono la velocità del player dei podcast. A qualsiasi velocità diversa da 1×, Spotify non riproduce il brano in parallelo (lì non viene conteggiato e gli altri tuoi dispositivi non lo vedono): Spotify riproduce la musica solo a 1×.</string>
<string name="equalizer_skip_silence">Salta i silenzi</string>
<string name="equalizer_skip_silence_detail">I tratti silenziosi vengono saltati (lunghe pause in un episodio, un silenzio prima di una traccia nascosta).</string>
+ <string name="download_source_not_answering">%1$s non risponde per ora</string>
</resources>
diff --git a/base/app/src/main/res/values-pl/myspoti_strings.xml b/base/app/src/main/res/values-pl/myspoti_strings.xml
index 4d3f59dd..04e8bfdb 100644
--- a/base/app/src/main/res/values-pl/myspoti_strings.xml
+++ b/base/app/src/main/res/values-pl/myspoti_strings.xml
@@ -672,4 +672,5 @@
<string name="equalizer_speed_detail">Wszystko, co aplikacja odtwarza sama, muzyka i pobrane odcinki. Odcinki streamowane przez Spotify zachowują prędkość odtwarzacza podcastów. Przy każdej prędkości innej niż 1× Spotify nie odtwarza utworu równolegle (nie jest tam liczony, a Twoje inne urządzenia go nie widzą): Spotify gra muzykę tylko z prędkością 1×.</string>
<string name="equalizer_skip_silence">Pomijaj ciszę</string>
<string name="equalizer_skip_silence_detail">Ciche fragmenty są pomijane (długie przerwy w odcinku, cisza przed ukrytym utworem).</string>
+ <string name="download_source_not_answering">%1$s chwilowo nie odpowiada</string>
</resources>
diff --git a/base/app/src/main/res/values-pt-rBR/myspoti_strings.xml b/base/app/src/main/res/values-pt-rBR/myspoti_strings.xml
index 65c1854d..eed36323 100644
--- a/base/app/src/main/res/values-pt-rBR/myspoti_strings.xml
+++ b/base/app/src/main/res/values-pt-rBR/myspoti_strings.xml
@@ -635,4 +635,5 @@
<string name="equalizer_speed_detail">Tudo o que o app toca por conta própria, música e episódios baixados. Os episódios transmitidos pelo Spotify mantêm a velocidade do player de podcasts. A qualquer velocidade diferente de 1×, o Spotify não toca a música em paralelo (ela não é contada lá e os seus outros dispositivos não a veem): o Spotify só toca música a 1×.</string>
<string name="equalizer_skip_silence">Pular silêncios</string>
<string name="equalizer_skip_silence_detail">Os trechos silenciosos são pulados (pausas longas em um episódio, um silêncio antes de uma faixa oculta).</string>
+ <string name="download_source_not_answering">%1$s não está respondendo no momento</string>
</resources>
diff --git a/base/app/src/main/res/values-pt-rPT/myspoti_strings.xml b/base/app/src/main/res/values-pt-rPT/myspoti_strings.xml
index afdcbd9d..08717a7a 100644
--- a/base/app/src/main/res/values-pt-rPT/myspoti_strings.xml
+++ b/base/app/src/main/res/values-pt-rPT/myspoti_strings.xml
@@ -604,4 +604,5 @@
<string name="lan_logging_in">A iniciar sessão…</string>
<string name="lan_failed">%1$s não aceitou o início de sessão. Abra-o uma vez com a aplicação Spotify e tente novamente.</string>
<string name="lan_others">Mais %1$d dispositivos nesta rede precisam primeiro de iniciar sessão através da aplicação Spotify</string>
+ <string name="download_source_not_answering">%1$s sem resposta por agora</string>
</resources>
diff --git a/base/app/src/main/res/values-pt/myspoti_strings.xml b/base/app/src/main/res/values-pt/myspoti_strings.xml
index fff57dfb..10b63341 100644
--- a/base/app/src/main/res/values-pt/myspoti_strings.xml
+++ b/base/app/src/main/res/values-pt/myspoti_strings.xml
@@ -657,4 +657,5 @@
<string name="equalizer_speed_detail">Tudo o que o app toca por conta própria, música e episódios baixados. Os episódios transmitidos pelo Spotify mantêm a velocidade do player de podcasts. A qualquer velocidade diferente de 1×, o Spotify não toca a música em paralelo (ela não é contada lá e os seus outros dispositivos não a veem): o Spotify só toca música a 1×.</string>
<string name="equalizer_skip_silence">Pular silêncios</string>
<string name="equalizer_skip_silence_detail">Os trechos silenciosos são pulados (pausas longas em um episódio, um silêncio antes de uma faixa oculta).</string>
+ <string name="download_source_not_answering">%1$s sem resposta por enquanto</string>
</resources>
diff --git a/base/app/src/main/res/values-ru/myspoti_strings.xml b/base/app/src/main/res/values-ru/myspoti_strings.xml
index 27362f09..e4fdf51e 100644
--- a/base/app/src/main/res/values-ru/myspoti_strings.xml
+++ b/base/app/src/main/res/values-ru/myspoti_strings.xml
@@ -672,4 +672,5 @@
<string name="equalizer_speed_detail">Всё, что приложение воспроизводит само, музыка и скачанные выпуски. Выпуски, которые передаёт Spotify, сохраняют скорость подкаст-плеера. При любой скорости, кроме 1×, Spotify не воспроизводит песню параллельно (там она не засчитывается, а ваши другие устройства её не видят): Spotify играет музыку только на 1×.</string>
<string name="equalizer_skip_silence">Пропускать тишину</string>
<string name="equalizer_skip_silence_detail">Тихие участки пропускаются (долгие паузы в выпуске, тишина перед скрытым треком).</string>
+ <string name="download_source_not_answering">Источник %1$s пока не отвечает</string>
</resources>
diff --git a/base/app/src/main/res/values-zh/myspoti_strings.xml b/base/app/src/main/res/values-zh/myspoti_strings.xml
index 36fcdb96..eea80837 100644
--- a/base/app/src/main/res/values-zh/myspoti_strings.xml
+++ b/base/app/src/main/res/values-zh/myspoti_strings.xml
@@ -657,4 +657,5 @@
<string name="equalizer_speed_detail">应用自己播放的所有内容,包括音乐和已下载的节目。由 Spotify 串流的节目保持播客播放器的速度。在 1× 以外的任何速度下,Spotify 不会同步播放这首歌(那里不会计入,你的其他设备也看不到):Spotify 只以 1× 播放音乐。</string>
<string name="equalizer_skip_silence">跳过静音</string>
<string name="equalizer_skip_silence_detail">会跳过静音片段(节目中的长时间停顿、隐藏曲目前的静音)。</string>
+ <string name="download_source_not_answering">%1$s 暂时无响应</string>
</resources>
diff --git a/base/app/src/main/res/values/myspoti_strings.xml b/base/app/src/main/res/values/myspoti_strings.xml
index 2c2fce75..e6651c8d 100644
--- a/base/app/src/main/res/values/myspoti_strings.xml
+++ b/base/app/src/main/res/values/myspoti_strings.xml
@@ -663,4 +663,5 @@
<string name="equalizer_speed_detail">Everything the app plays itself, music and downloaded episodes alike. Episodes streamed by Spotify keep the podcast player\'s speed. At any speed but 1×, Spotify does not play the song along (it is not counted there and your other devices do not see it): Spotify plays music at 1× only.</string>
<string name="equalizer_skip_silence">Skip silences</string>
<string name="equalizer_skip_silence_detail">Silent stretches are skipped (long pauses in an episode, a silence before a hidden track).</string>
+ <string name="download_source_not_answering">%1$s is not answering for now</string>
</resources>