aoede icon indicating copy to clipboard operation
aoede copied to clipboard

add zeroconf auth for spotify

Open shiftybitshiftr opened this issue 1 year ago • 11 comments

As described in https://github.com/librespot-org/librespot/issues/1308#issuecomment-2276196094, Spotify has deprecated basic authentication for apps via username/password. Specifically, as of version 3.203.235 of the Spotify eSDK, the SpConnectionLoginPassword API has been removed.

This PR adds support for Spotify's zeroconf authentication via librespot, and updates the ReadMe with instructions.

Resolves #54.

shiftybitshiftr avatar Aug 19 '24 02:08 shiftybitshiftr

I tested this PR by building from source on my Windows box and running the binary on the same host my Spotify client was running. It works!

If we want to retain auth to Spotify between bot restarts, then we need to save the encrypted blob to disk (e.g. https://github.com/codetheweb/aoede/pull/55/files#diff-b072d44757027067e88a4e0972075dd9bcf9bcc9fb44dc1c28b9b84f8e7b1e03R252). Although, to reauth all you need to do is select the device in the Spotify app, so saving the blob isn't really necessary.

Still needs to be tested from Docker.

shiftybitshiftr avatar Aug 19 '24 19:08 shiftybitshiftr

I've now successfully tested via Docker running on a ProxMox Alpine LXC within the same network segment as my Windows box running the Spotify client. I needed to add --net=host / network_mode: host to get the mDNS broadcast to propagate correctly, I've gone ahead and added that to the ReadMe.

I've captured logs after setting RUST_LOG=debug, for posterity: aeode-local.log

shiftybitshiftr avatar Aug 19 '24 20:08 shiftybitshiftr

I built this from source and I can get the bot to join, but the audio is extremely slow and choppy. Also I can't seem to get the bot to show up in the devices list when it running on a server outside of the local network.

Anyway I can help debug?

Giggitybyte avatar Aug 25 '24 04:08 Giggitybyte

thank you! the playback is also choppy for me, although maybe it's just a temporary issue with my wifi

I'm able to repro the choppy playback over the network. I'm puzzled as to why - I didn't modify the audio processing and my network is running over 2.5 gig lines. Will spend some time debugging later this week

shiftybitshiftr avatar Aug 28 '24 07:08 shiftybitshiftr

Something about the audio I noticed that might be relevant is that it sounds more like the audio is being played at a slow speed and multiple times overlapping. So I think the issue might actually have something to do with performance inside the container and not network, potentially due to the stream getting played multiple times simultaneously.

Saikron avatar Oct 07 '24 15:10 Saikron

While running this branch on my machine (Docker on Windows), I noticed that even though the user and password have been removed, they are still required in the environment. Without these variables, the container doesn't initialize properly.

codebyant avatar Oct 26 '24 23:10 codebyant

Something about the audio I noticed that might be relevant is that it sounds more like the audio is being played at a slow speed and multiple times overlapping. So I think the issue might actually have something to do with performance inside the container and not network, potentially due to the stream getting played multiple times simultaneously.

That is exactly how I'd describe it, I gave it it a shot myself and encountered this, so despite the credentials change of this PR working, the audio itself is completely unusable in the current state.

NotVeryAnonymous avatar Dec 31 '24 11:12 NotVeryAnonymous

working now?

exababy avatar Mar 08 '25 20:03 exababy

I haven't had a chance to work on this, it's still in the same state where the audio output is corrupted.

shiftybitshiftr avatar Mar 08 '25 20:03 shiftybitshiftr

Yes, I just got the build and the sound is distorted, I wonder if there is a similar project or can you fix it, I need something like this very much right now.

exababy avatar Mar 08 '25 20:03 exababy

https://github.com/SpoticordMusic/spoticord/ i found

exababy avatar Mar 08 '25 21:03 exababy

Hey, any progress on this? Or is this PR (and project) dead?

kyngs avatar Jul 02 '25 21:07 kyngs

Hey, any progress on this? Or is this PR (and project) dead?

Apparently, the project is no longer active. However, you can check out Spoticord, it’s written in Rust, I believe, and offers essentially the same functionality, with the added benefit of a publicly available bot ready to use. https://spoticord.com/

codebyant avatar Jul 06 '25 17:07 codebyant

Hey, any progress on this? Or is this PR (and project) dead?

Apparently, the project is no longer active. However, you can check out Spoticord, it’s written in Rust, I believe, and offers essentially the same functionality, with the added benefit of a publicly available bot ready to use. https://spoticord.com/

Afaik spoticord doesn't support zeroconf, and instead relies on the Spotify API. That makes self-hosting it way more complicated than aoede.

kyngs avatar Jul 06 '25 18:07 kyngs