Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add zeroconf auth for spotify #55

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

shiftybitshiftr
Copy link

@shiftybitshiftr shiftybitshiftr commented Aug 19, 2024

As described in librespot-org/librespot#1308 (comment), 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 shiftybitshiftr marked this pull request as draft August 19, 2024 02:43
@shiftybitshiftr shiftybitshiftr marked this pull request as ready for review August 19, 2024 05:20
@shiftybitshiftr
Copy link
Author

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
Copy link
Author

shiftybitshiftr commented Aug 19, 2024

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

@Giggitybyte
Copy link

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?

Copy link
Owner

@codetheweb codetheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

src/lib/player.rs Outdated Show resolved Hide resolved
let credentials = discovery.next().await.expect("Failed to get credentials");

// Save the encrypted blob for future use
config.spotify_encrypted_blob = credentials.auth_data.clone();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we save this to a new separate file?

README.md Outdated Show resolved Hide resolved
shiftybitshiftr and others added 2 commits August 28, 2024 00:19
Co-authored-by: Max Isom <codetheweb@users.noreply.github.com>
Co-authored-by: Max Isom <codetheweb@users.noreply.github.com>
@shiftybitshiftr
Copy link
Author

shiftybitshiftr commented Aug 28, 2024

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

@Saikron
Copy link

Saikron commented Oct 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AuthenticationError out of nowhere
4 participants