WIP: new Spotify API #917
Replies: 23 comments 123 replies
-
@gdesmott w.r.t. your lyrics structs, a couple of points:
To add lyrics parsing to |
Beta Was this translation helpful? Give feedback.
-
Some new commits pushed today, most prominently:
In line with 0fdff0d I will start tracking the |
Beta Was this translation helpful? Give feedback.
-
Working on the switch to the What this would bring us, is support for MP3, Ogg Vorbis and FLAC all in one package. You can just fire any audio stream at it and it will figure out what to do. Also, it's under active development. If we were to support MP3 and FLAC in any other way, it would mean pulling in specific libraries per format (which aren't too great for MP3, Rust native, and AFAIK non-existent for FLAC) and creating a decoder per format. |
Beta Was this translation helpful? Give feedback.
-
Hi. HNY! |
Beta Was this translation helpful? Give feedback.
-
What's the status of this patch, is it ready for use? I thought it was from the comments here but I'm unable to get it to play any audio. It either plays in silence, or it makes the playback buttons in the web player go greyed out so you can't click them. The logs say things like:
I'm guessing this means it's not in a functional state yet? |
Beta Was this translation helpful? Give feedback.
-
Is there any plan to add API to search the Spotify catalog? I didn't find any. |
Beta Was this translation helpful? Give feedback.
-
As I was updating all the crates, I found out that GStreamer would lag with audio when forwarding to the next track. Meaning: it would play a short bit of the previous track. In e69d5a8 I fixed that by flushing the buffers. Also I removed the thread and accompanying channels to write samples to the buffer pool. That code could simply be moved to Before that in d2c377d I got rid of the critical GStreamer error on shutdown, complaining we did not clean up GStreamer properly. It now also reports the Users of GStreamer are invited to test a bit more. |
Beta Was this translation helpful? Give feedback.
-
I have playlist, which contains track, which do not have OGG, only AAC_24 and preview MP3_96, all know "Panic! At The Disco - I Write Sins Not Tragedies". At album this track was skiped, but if this track is in playlist app panic. After this error, there is no sounds. |
Beta Was this translation helpful? Give feedback.
-
Got another crash similar to last time. It looks like when the old API comes up with those channel errors, that's when the new API starts getting weird errors too. Here, I tried to play a song the old API couldn't play, the new API appeared to load it fine but actually it looked like it skipped it. I skipped to the next track (thinking it was playing fine) and it appears my attempt to play the next track while it was already being played caused another crash (possibly, I'm just guessing). This is the log from the first track which looked like it worked but it didn't:
At this point I skipped to the next track, which gave normal logs until:
I'm not sure whether this is two different crashes or whether it's one "panic" but the backtrace ends up being displayed much later in the logs. Either way the player buttons got disabled in the web player and I had to terminate librespot to get things working again. |
Beta Was this translation helpful? Give feedback.
-
abbc3ba made it so the message listeners can be installed before connection. Previously there was a race condition where it was possible that messages arrived in the meantime. These messages are becoming increasingly important and looking ahead even more so with the dealer, so this was important plumbing. Previously you called |
Beta Was this translation helpful? Give feedback.
-
The only instances of unsafe code are the 2 calls to |
Beta Was this translation helpful? Give feedback.
-
Could you guys help me out? I'm trying to port the |
Beta Was this translation helpful? Give feedback.
-
@roderickvd is it still the plan to remove the basic normalisation mode? It's had a depreciation warning since 0e9fdbe If so I can remove it. If not I can remove the depreciation warning. |
Beta Was this translation helpful? Give feedback.
-
Any chance these messages could be converted from an array of ASCII codes to strings? It makes it a bit harder to figure out what went wrong when you only see the ASCII codes. I converted them back to a string and it's just JSON data, so having the debug message print JSON would be helpful for debugging:
|
Beta Was this translation helpful? Give feedback.
-
Getting those channel errors again. Previously the new API has been able to download the files anyway, but today it can't.
Unfortunately in this case it locks up the web player too, with all the controls disabled: And the current track, normally highlighted in green, disappears so you don't know where you're up to. It doesn't appear to try to advance to the next track, and it looks like perhaps preloading the next track might be interfering with this. I've noticed that the new API always tends to disable the playback controls while it's loading the next track, so as you move between tracks the buttons grey out in between tracks, and the green song in the playlist disappears (but then returns when playback starts). The old API used to jump straight to the next track without hiding it, and without disabling the buttons so if it got stuck you could still skip to the next track. |
Beta Was this translation helpful? Give feedback.
-
I've been doing a bit more in-depth experimentation and found another issue, this time with metadata. If I try to retrieve the album metadata (e.g. via
This works with the old API. Looking more closely, it seems this album's metadata only has a year, but no month or day. The old API was able to supply the album's release date as just a year, whereas the new metadata changes appear to make the month and day mandatory, so the function fails completely when the month and/or day are missing from the album release date. |
Beta Was this translation helpful? Give feedback.
-
31c6824 adds server key verification to prevent man-in-the-middle attacks and interception of credentials. Something |
Beta Was this translation helpful? Give feedback.
-
I see the new API has changed the behaviour after reaching the end of the last track in a playlist. With the old API, when it got to the end of the playlist it would just stop, which was great for starting some music when you went to bed, knowing it would stop after you had gone to sleep. But with the new API once it gets to the end of the playlist it starts playing random songs forever, so you eventually get woken up again by some song you don't recognise. I've also noticed that if you start a long playlist, after the 81st song it forgets about the playlist and starts playing random songs too. The old API used to just stop after song 81, which I think is because when you start a playlist, you only get told about the first 81 songs, and librespot doesn't request the next lot of songs in the playlist when it gets to the last one in the subset. Assuming there are no plans to support playlists longer than 81 songs, is there a way to restore the old behaviour so that after the end of the playlist, playback just stops? I've had a look at the command line options and while there are options for things like disabling gapless playback, I couldn't see anything that seemed related to this. I figure this is related to #434 but I mention it here as the switch to playing random songs seems to be new behaviour in this branch. |
Beta Was this translation helpful? Give feedback.
-
The track is interrupted quite often. I noticed that this happens until the track is downloaded. Here is the log:
My connection speed is 100Mbps. The download speed with CDN is about 3-4Mbps. |
Beta Was this translation helpful? Give feedback.
-
I don't know that SoC, what architecture is it, ARMv8? It seems more than powerful enough, yes, but still, a quick CPU check would be appreciated. The logs clearly state that there is a TCP connection error, do you have any hypothesis why from your end? I have one hypothesis: the CDN doesn't like connections that are too fast, and hit rate limiting. You may want to read #917 (comment) and try some of the suggestions I mentioned at the end. Let me know how it goes. I do think we need to make some changes here. |
Beta Was this translation helpful? Give feedback.
-
Looking at our command line options I have a couple thoughts. Caching: Currently we have a lot of caching options that I think can be simplified a bit. We have My thought is that:
Discovery, creds and cred caching: Currently discovery is enabled by default and so is cred caching. It's mostly harmless but cred caching is completely unnecessary if discovery is working as intended. The flip side to that is that if you disable cred caching and provide your username and password you get nag emails from Spotify every time My thought is that: Really there are 2 modes |
Beta Was this translation helpful? Give feedback.
-
Not sure if this was said (or if this is an issue), I'm trying out the For example, the let credentials = Credentials::with_password("username", "password");
let session = Session::new(SessionConfig::default(), None);
session.connect(credentials).await.unwrap(); This is the first time I'm encountering errors like these, so I am unsure if it is a problem or not with the function or the swift bridge. I am not getting these errors on version |
Beta Was this translation helpful? Give feedback.
-
Today the |
Beta Was this translation helpful? Give feedback.
-
This is a thread to track ongoing development to develop the "new Spotify API". Previously, this was tracked in PR #891 -- look for earlier discussion there. Since then the
new-api
branch has been merged intodev
, please focus your development efforts there.The "new Spotify API" means moving large parts of the Spotify protocol from Mercury to HTTP. A lot of this was reverse engineered before by @devgianlu of
librespot-java
. It was long overdue that we started implementing it too, not in the least because new features like the upcoming Spotify HiFi depend on it.While at it, I am taking the liberty to do some major refactoring to make
librespot
more robust. Consequently not only the Spotify API changed but large parts of thelibrespot
API too. For downstream maintainers, I realise that it can be a lot to move from the current codebase to this one, but believe me it will be well worth it.Required work
Status report: Moving to the dealer will have a large impact on
librespot-connect
. That's why I'm now more focused on the optional things below. My current intention is to get to a stablespirc
"enhanced" baseline, maybe do an intermediate merge todev
, then move on to the dealer.spclient
dealer
eventsdev
Optional work
The following work items are somewhat related but optional. They might go in if time allows, or warrant separate PR's later. They don't need to block releasing this work but could reasonably be within scope.
Code quality
assert_debug
Connect
?cid={}
client ID to queriesCore
ConnectConfig
fromcore
toconnect
client_id
argument toget_token
again (moved toSessionConfig
)librespot-java
implementationMetadata
?country={}&product={}
and?product={}&partner={}
metrics to querieschrono
withtime
librespot-java
implementationNetworking
Player
lewton
toSymphonia
to support MP3 and FLACogg
dependencyPlaylists
Fix issues
Finally there is a slew of issues that are targeted to be fixed under the new API. I might link them here sometime.
Earlier work
spclient
anddealer
access pointsspclient
spclient
playlist4_external
protounwrap
,expect
and returnResult
Beta Was this translation helpful? Give feedback.
All reactions