Skip to content

Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.

Ask for covers in the language the app is set to

Lelonio91576a26c37c
diff --git a/.claude/settings.local.json b/.claude/settings.local.json
index 97fa72a..3591b01 100644
--- a/.claude/settings.local.json
+++ b/.claude/settings.local.json
@@ -162,7 +162,10 @@
"Bash(curl -s \"https://api.github.com/search/code?q=EventService+repo:librespot-org/librespot-java\")",
"Bash(curl -s \"https://api.github.com/repos/librespot-org/librespot-java/git/trees/master?recursive=1\")",
"Bash(rm -rf lsj)",
- "Bash(git clone *)"
+ "Bash(git clone *)",
+ "Bash(./gradlew :app:assembleDebug)",
+ "Bash(./gradlew :app:installDebug)",
+ "Bash(./gradlew :app:installRelease)"
]
}
}
diff --git a/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin b/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin
index 6f10538..27eb76e 100644
--- a/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin
+++ b/app/.cxx/Debug/286k5v33/arm64-v8a/configure_fingerprint.bin
@@ -2,27 +2,27 @@ C/C++ Structured Logc
a
_/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/additional_project_files.txtC
A
-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ����3  ��߈�3`
+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �����3  ��߈�3`
^
-\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build.json  ����3� ��߈�3e
+\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build.json  �����3� ��߈�3e
c
-a/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build_mini.json  ����3� ��߈�3R
+a/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/android_gradle_build_mini.json  �����3� ��߈�3R
P
-N/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja  ����3� ��߈�3V
+N/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja  �����3� ��߈�3V
T
-R/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja.txt  ����3[
+R/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build.ninja.txt  �����3[
Y
-W/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build_file_index.txt  ����3 @ ��߈�3\
+W/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/build_file_index.txt  �����3 @ ��߈�3\
Z
-X/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json  ����3֚ ��߈�3`
+X/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json  �����3֚ ��߈�3`
^
-\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json.bin  ����3 �" ��߈�3f
+\/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/compile_commands.json.bin  �����3 �" ��߈�3f
d
-b/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/metadata_generation_command.txt  ����3
+b/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/metadata_generation_command.txt  �����3
� ��߈�3Y
W
-U/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/prefab_config.json  ����3  ( ��߈�3^
+U/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/prefab_config.json  �����3  ( ��߈�3^
\
-Z/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/symbol_folder_index.txt  ����3  Y ��߈�3D
+Z/Users/emanuele/Progetto Spotify/app/.cxx/Debug/286k5v33/arm64-v8a/symbol_folder_index.txt  �����3  Y ��߈�3D
B
-@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  ����3 � �Ȅ��3
\ No newline at end of file
+@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �����3 � �Ȅ��3
\ No newline at end of file
diff --git a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
index a403867..add7af2 100644
--- a/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
+++ b/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/configure_fingerprint.bin
@@ -2,27 +2,27 @@ C/C++ Structured Logl
j
h/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/additional_project_files.txtC
A
-?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  �ݚ��3  ����3i
+?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ڶı�3  ����3i
g
-e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build.json  �ݚ��3� ����3n
+e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build.json  ڶı�3� ����3n
l
-j/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build_mini.json  �ݚ��3� �����3[
+j/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/android_gradle_build_mini.json  ڶı�3� �����3[
Y
-W/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja  �ݚ��3�� ����3_
+W/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja  ۶ı�3�� ����3_
]
-[/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja.txt  �ݚ��3d
+[/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build.ninja.txt  ۶ı�3d
b
-`/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build_file_index.txt  �ݚ��3 @ ����3e
+`/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/build_file_index.txt  ۶ı�3 @ ����3e
c
-a/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json  �ݚ��3�� ����3i
+a/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json  ۶ı�3�� ����3i
g
-e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json.bin  �ݚ��3 �" ����3o
+e/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/compile_commands.json.bin  ۶ı�3 �" ����3o
m
-k/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/metadata_generation_command.txt  �ݚ��3
+k/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/metadata_generation_command.txt  ۶ı�3
� ����3b
`
-^/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/prefab_config.json  �ݚ��3  ( ����3g
+^/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/prefab_config.json  ۶ı�3  ( ����3g
e
-c/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/symbol_folder_index.txt  �ݚ��3  b ����3D
+c/Users/emanuele/Progetto Spotify/app/.cxx/RelWithDebInfo/151m4dr6/arm64-v8a/symbol_folder_index.txt  ۶ı�3  b ����3D
B
-@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  �ݚ��3 � �Ȅ��3
\ No newline at end of file
+@/Users/emanuele/Progetto Spotify/app/src/main/cpp/CMakeLists.txt  ۶ı�3 � �Ȅ��3
\ No newline at end of file
diff --git a/app/src/main/java/dev/emanuele/spot/nativecore/NativeBridge.kt b/app/src/main/java/dev/emanuele/spot/nativecore/NativeBridge.kt
index 1a90d88..644cacd 100644
--- a/app/src/main/java/dev/emanuele/spot/nativecore/NativeBridge.kt
+++ b/app/src/main/java/dev/emanuele/spot/nativecore/NativeBridge.kt
@@ -64,8 +64,18 @@ object NativeBridge {
accessToken: String,
credentialsDir: String,
cacheDir: String,
+ /** What language Spotify should answer in, as a bare tag: `it`, `en`. */
+ language: String,
listener: NativeEvents,
- ) = nativeStart(clientId, deviceName, accessToken, credentialsDir, cacheDir, listener)
+ ) = nativeStart(
+ clientId,
+ deviceName,
+ accessToken,
+ credentialsDir,
+ cacheDir,
+ language,
+ listener,
+ )
/**
* Hands the whole queue to the Connect device, starting at [index].
@@ -161,6 +171,7 @@ object NativeBridge {
accessToken: String,
credentialsDir: String,
cacheDir: String,
+ language: String,
listener: NativeEvents,
)
diff --git a/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt b/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt
index 3744c50..e35d443 100644
--- a/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt
+++ b/app/src/main/java/dev/emanuele/spot/playback/PlaybackService.kt
@@ -152,6 +152,11 @@ class PlaybackService : MediaSessionService() {
// catalogue access until the user logs in again.
credentialsDir = filesDir.resolve("librespot").absolutePath,
cacheDir = cacheDir.absolutePath,
+ // The app's own language, not the account's. Spotify
+ // localises what it answers with, artwork included: the
+ // generated playlists carry the language in the cover's
+ // URL, so the tiles came back in English.
+ language = appLanguage(),
listener = player,
)
}
@@ -348,3 +353,13 @@ class PlaybackService : MediaSessionService() {
}
}
}
+
+/**
+ * The language Spotify should answer in.
+ *
+ * Read from the resources rather than from the device, so it follows what the
+ * app is actually showing: today that is Italian for everyone, and the day it
+ * has more languages this keeps pointing at the one in use.
+ */
+private fun android.content.Context.appLanguage(): String =
+ resources.configuration.locales[0]?.language?.takeIf { it.isNotEmpty() } ?: "it"
diff --git a/native/src/engine.rs b/native/src/engine.rs
index b00c3b8..8f2c9e0 100644
--- a/native/src/engine.rs
+++ b/native/src/engine.rs
@@ -110,6 +110,7 @@ pub fn start(
access_token: &str,
credentials_dir: &str,
cache_dir: &str,
+ language: &str,
listener: GlobalRef,
) -> EngineResult<()> {
let mut guard = ENGINE.lock().map_err(|_| "engine mutex poisoned")?;
@@ -131,6 +132,12 @@ pub fn start(
// but be rejected at the access point.
let mut session_config = SessionConfig::default();
session_config.tmp_dir = std::path::PathBuf::from(cache_dir);
+ // What Spotify should answer in. Artwork for the generated playlists is
+ // localised — the language is in the cover's own URL — so a client that
+ // never says which one it wants gets English tiles.
+ if !language.is_empty() {
+ session_config.language = language.to_string();
+ }
if !client_id.is_empty() {
session_config.client_id = client_id.to_string();
}
diff --git a/native/src/ffi.rs b/native/src/ffi.rs
index 43eb1a5..e1b015d 100644
--- a/native/src/ffi.rs
+++ b/native/src/ffi.rs
@@ -84,6 +84,7 @@ pub extern "system" fn Java_dev_emanuele_spot_nativecore_NativeBridge_nativeStar
access_token: JString,
credentials_dir: JString,
cache_dir: JString,
+ language: JString,
listener: JObject,
) {
let result = (|| {
@@ -92,6 +93,7 @@ pub extern "system" fn Java_dev_emanuele_spot_nativecore_NativeBridge_nativeStar
let access_token = read_string(&mut env, &access_token)?;
let credentials_dir = read_string(&mut env, &credentials_dir)?;
let cache_dir = read_string(&mut env, &cache_dir)?;
+ let language = read_string(&mut env, &language).unwrap_or_default();
let listener = env
.new_global_ref(&listener)
.map_err(|e| format!("failed to pin listener: {e}"))?;
@@ -101,6 +103,7 @@ pub extern "system" fn Java_dev_emanuele_spot_nativecore_NativeBridge_nativeStar
&access_token,
&credentials_dir,
&cache_dir,
+ &language,
listener,
)
})();
diff --git a/native/vendor/README.md b/native/vendor/README.md
index 26ed1ed..c5dde34 100644
--- a/native/vendor/README.md
+++ b/native/vendor/README.md
@@ -33,7 +33,7 @@ One line:
+pub const OS: &str = "linux";
```
-### Why
+#### Why
`OS` decides three things at once: the default client id, the `platform` field
librespot sends to Spotify, and the HTTP user agent. On Android the real value
@@ -57,6 +57,21 @@ The same fix exists in the librespot fork behind
[Outify](https://github.com/iTomKo/Outify) — commit *"Fixed login5 errors by
mocking linux"* — which is how it was found.
+#### 3. `src/spclient.rs` and `src/config.rs` — the language to answer in
+
+Spotify localises the artwork of its generated playlists: the cover of "Your
+All-Time Top Songs" is served from a URL ending in the language, and the
+Italian one is a different picture from the English one. librespot sends no
+`Accept-Language` at all, so everything came back English regardless of what
+the app was set to.
+
+A `language` field was added to `SessionConfig` (default `"en"`, so behaviour
+for anyone not setting it is unchanged), and the spclient request builder now
+sends it as `Accept-Language`. The app fills it from the device locale.
+
+Not everything follows it: the charts, daylist, blend and seed-mix covers are
+picked by the server from the account's own language and stay English.
+
### Maintenance
Re-apply this patch when bumping `librespot-core`. If the whole file is replaced,
diff --git a/native/vendor/librespot-core/src/config.rs b/native/vendor/librespot-core/src/config.rs
index 6025fd5..b330e68 100644
--- a/native/vendor/librespot-core/src/config.rs
+++ b/native/vendor/librespot-core/src/config.rs
@@ -34,6 +34,12 @@ pub fn os_version() -> String {
#[derive(Clone, Debug)]
pub struct SessionConfig {
pub client_id: String,
+ /// LOCAL CHANGE: sent as `Accept-Language` on spclient requests.
+ ///
+ /// Spotify localises what it answers with, and that includes artwork: the
+ /// generated playlists' covers carry the language in the URL, so without
+ /// this the tiles came back in English on an Italian app.
+ pub language: String,
pub device_id: String,
pub proxy: Option<Url>,
pub ap_port: Option<u16>,
@@ -53,6 +59,7 @@ impl SessionConfig {
Self {
client_id,
+ language: "en".to_string(),
device_id,
proxy: None,
ap_port: None,
diff --git a/native/vendor/librespot-core/src/spclient.rs b/native/vendor/librespot-core/src/spclient.rs
index 6eaa33c..a38c634 100644
--- a/native/vendor/librespot-core/src/spclient.rs
+++ b/native/vendor/librespot-core/src/spclient.rs
@@ -32,7 +32,7 @@ use futures_util::future::IntoStream;
use http::{Uri, header::HeaderValue};
use hyper::{
HeaderMap, Method, Request,
- header::{ACCEPT, AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderName, RANGE},
+ header::{ACCEPT, ACCEPT_LANGUAGE, AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderName, RANGE},
};
use hyper_util::client::legacy::ResponseFuture;
use protobuf::{Enum, EnumOrUnknown, Message, MessageFull};
@@ -500,6 +500,11 @@ impl SpClient {
}
}
+ // LOCAL CHANGE: what language to answer in; see SessionConfig.
+ if let Ok(language) = HeaderValue::from_str(&self.session().config().language) {
+ headers_mut.insert(ACCEPT_LANGUAGE, language);
+ }
+
headers_mut.insert(
AUTHORIZATION,
HeaderValue::from_str(&format!("{} {}", token.token_type, token.access_token,))?,