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

Spotty stopped working due to Spotify API changes #137

Open
thasd3bu9 opened this issue Sep 3, 2024 · 48 comments
Open

Spotty stopped working due to Spotify API changes #137

thasd3bu9 opened this issue Sep 3, 2024 · 48 comments

Comments

@thasd3bu9
Copy link

Hi,
I have some troubles with authenticating Spotify within a fresh docker deployment (docker v27.2.0) lmscommunity:logitechmediaserver
After Spotify removed the credential auth and i've been on lms 8.1 I decided to upgrade to latest version.
I'm running 1 Radio, 1 Boom, 1 Touch, and 2 squeezelightclients.

I can run local media files with no problems and can see all players.

I reinstalled Spotty several times, put the container in Host network mode, tried different Spotify clients (Laptop, mobile, PC) but there's no device showing up

server.log

I appreciate any help and i believe I'm just too noobish :)

thx in advance

Rob

@michaelherger
Copy link
Owner

It should work in host mode, unless you have something else blocking access to ports.

That said, it looks as if they turned something off. I've been receiving emails from users telling me they were no longer able to listen to Spotify for several days. Today the issue reached me, I believe. I can no longer listen to any Spotify content... I'm sorry, but for the time being I'll have to concentrate on getting things working again at all 😢.

@thasd3bu9
Copy link
Author

Thank you for your quick reply. I was concerning that this is a Spotify related issue but I'm on the road now. I will investigate if there's something blocking ports later on.
Even I'm also not able to exec inside the container which gives an 'unable to retrieve image details'

Thanks for your work

@wwalterww
Copy link

[quote]That said, it looks as if they turned something off. [/quote]
I think that as well. I've got 2 server instances running with spotty. On one, the problem showed up yesterday: it keeped skipping to the end of the playlist, without playing anything. Loading Playlists etc. works. I could temporarily resolve this problem by switching to the fallback access point.
On the other one, the problem came up a few hours later.
Since a few hours, also the fallback access point stopped working.

There are NO log warnings/errors, though.

@smartins4
Copy link

[quote]That said, it looks as if they turned something off. [/quote] I think that as well. I've got 2 server instances running with spotty. On one, the problem showed up yesterday: it keeped skipping to the end of the playlist, without playing anything. Loading Playlists etc. works. I could temporarily resolve this problem by switching to the fallback access point. On the other one, the problem came up a few hours later. Since a few hours, also the fallback access point stopped working.

There are NO log warnings/errors, though.

same here..

@GodfatherX64
Copy link

GodfatherX64 commented Sep 3, 2024

unfortunately same here too
lms on alpine x86_64

@h00t2y
Copy link

h00t2y commented Sep 3, 2024

same...
ERROR librespot_core::channel] channel error: 2 0
librespot-org/librespot#972 (comment)

@bbernhard
Copy link

same... ERROR librespot_core::channel] channel error: 2 0 librespot-org/librespot#972 (comment)

Does anyone have success with blocking apresolve.spotify.com? Doesn't work for me unfortunately :/

@h00t2y
Copy link

h00t2y commented Sep 3, 2024

same... ERROR librespot_core::channel] channel error: 2 0 librespot-org/librespot#972 (comment)

Does anyone have success with blocking apresolve.spotify.com? Doesn't work for me unfortunately :/

No success with blocking...
maybe
AmbientCapabilities=CAP_NET_BIND_SERVICE
can work if i only knew how to use this :)

@h00t2y
Copy link

h00t2y commented Sep 3, 2024

looks like dev branch worx
librespot-org/librespot#1322 (comment)

@bbernhard
Copy link

I saw that Spotty uses its own fork of librespot (https://github.com/michaelherger/librespot), so I am wondering if one can just replace spotty-hf with the dev version? Does that work?

@michaelherger
Copy link
Owner

I saw that Spotty uses its own fork of librespot (michaelherger/librespot), so I am wondering if one can just replace spotty-hf with the dev version? Does that work?

Nope. I wouldn't have forked it if I hadn't needed to do so in order to make things work for spotty.

I'll hopefully be able to migrate to the latest dev branch work of upstream librespot.

@bbernhard
Copy link

I saw that Spotty uses its own fork of librespot (michaelherger/librespot), so I am wondering if one can just replace spotty-hf with the dev version? Does that work?

Nope. I wouldn't have forked it if I hadn't needed to do so in order to make things work for spotty.

I'll hopefully be able to migrate to the latest dev branch work of upstream librespot.

thanks a lot - very much appreciated!

@michaelherger michaelherger changed the title Lyrion 8.5.2 No Spotify Connect device pops up Spotty stopped working due to Spotify API changes Sep 4, 2024
@michaelherger
Copy link
Owner

michaelherger commented Sep 4, 2024

Ok, here's something for the brave among you... a somewhat working test version of Spotty! Before you promise too much to your kids, please check these caveats:

  • 💣 hardly tested at all (to be exact: I'm on track 2430 of the Release Radar, playing on a Pi4 based LMS, a single OMLI import run in the background - that's basically all the testing I've done so far)
  • 📑 you will need your own client ID. I've got odd behaviour without adding one.
  • ✍🏻 you might have to remove your accounts and re-add them
  • ⛔️ you might see 429 ("too many requests") initially, but they would go away after a few minutes
  • 🛜 Connect mode does NOT work. Turn it off if you had it enabled
  • 💻 No more i386/Linux build. You'll need 64-bit Linux on Intel hardware.
  • 😣 you might need a good level of frustration tolerance

If you agree with the above, add the following URL to the plugin manager and install the Spotty update.

https://www.herger.net/slim-plugins/spotty-test.xml

@cregeland
Copy link

cregeland commented Sep 4, 2024

Great work @michaelherger !

I just updated and re-added accounts. Stuck on unable to get access token for a while but worked shortly after. Moving through the menu and searching seems a litt bit slower than it used to but that might just be on my side. Will continue testing 👍
Running LMS 8.5.2 on win10 VM.

Thanks for your effort!

@wwalterww
Copy link

WOW. Quite a disclaimer - but it works!
The delay between tracks seems longer than usual though.
(docker lmscommunity/logitechmediaserver on linux/intel machine)

I get this error on Spotty's "home page":
ERROR: List processing failed TypeError: Cannot read properties of undefined (reading 'length') TypeError: Cannot read properties of undefined (reading 'length') at parseBrowseResp (http://192.168.0.253/html/js/material-deferred.min.js?r=5.2.5:82:145) at http://192.168.0.253/html/js/material.min.js?r=5.2.5:423:300

Thank you @michaelherger ! My kids are as desperate as yours. And me as well, we all kind of depend on Spotty. :)

@brunphil
Copy link

brunphil commented Sep 4, 2024

just installed the new version and tested it shortly. playback worked again immediatly. thank you very much! looking forward to let the kids test it out tomorrow... will keep you updated...

edit:
works like a charm. had to reboot once as the plugin had troubles getting a token. running spotty v4.11.9 on lms version 8.5.2 - 1716215514 i an unraid (x86_64-linux) docker image (repo dlandon/logitechmediaserver)

@MarcPlace
Copy link

MarcPlace commented Sep 4, 2024

Can confirm after a short test with LMS 8.5.2 on my 64-Bit Laptop (Archlinux) everything seems to work again as expected. But I can't experience any longer delays between the tracks as mentioned above. Looks pretty quite normal to me. Will do some further testing with v4.11.9.

Unfortunately I'm probably the only one 😁 who's still running an LMS on an old ITX 32-Bit home server. So I think, after all these years (although still very stable and reliable), it's time for something new now. 😇
Thanks @michaelherger for all your effort, I'm really appreciate this.

Edit:
Just fell over it... Some podcasts can't be played anymore (e.g. https://open.spotify.com/episode/7e65zcGoYOHfWmpe8CD1Uc) while other podcasts play without any issues (e.g. https://open.spotify.com/episode/1wVnctv6Yr2H5FLZ8YXPkI).

@michaelherger
Copy link
Owner

@MarcPlace you could try to build the binary yourself. It's not that difficult. My difficulties result from the fact that I cross-compile most of it, and rely on Github to do the heavy lifting. And they do not provide support for all platforms (and I was too lazy to build a pipeline for i386 cross-compilation).

Once you've got rust installed (https://rustup.rs) just run cargo build --release from the repo's root folder, wait, and put the resulting target/release/spotty as spotty-custom somewhere in your search path.

@FlorentBrianFoxcorner
Copy link

Works, thank you @michaelherger. Will operation be stable if I switch off docker host networking after having logged in?

@jasjpp
Copy link

jasjpp commented Sep 5, 2024

Thank you @michaelherger. Works like a charm on x64 QNAP with QLMS

@ebbesmoeller
Copy link

ebbesmoeller commented Sep 5, 2024

Tested new build with own client ID, on Raspberry Pi 2 Lyrion. Works 👍

@MarcPlace
Copy link

@MarcPlace you could try to build the binary yourself. It's not that difficult. My difficulties result from the fact that I cross-compile most of it, and rely on Github to do the heavy lifting. And they do not provide support for all platforms (and I was too lazy to build a pipeline for i386 cross-compilation).

Will give it a try to compile it 32-Bit native as soon as I'm back home tonight. 👍

@michaelherger
Copy link
Owner

Works, thank you @michaelherger. Will operation be stable if I switch off docker host networking after having logged in?

Yes, I believe once authenticated spotty would go back to reaching outside from the inside. You should be good.

@xudabit
Copy link

xudabit commented Sep 5, 2024

Had the same problem with skipping the playlist over the last few days. Started around tuesday. Now it's working fine again without any update besides the update with the message which says, that it's not working anymore. So I'm currently using 4.11.1 which works just as before.

@git-qb
Copy link

git-qb commented Sep 5, 2024

I've just reverted my LMS from snap and i confirm that it is working on 4.11.1 without any problems.

@DCH-SOCOMEC
Copy link

Works again on my side too, after few days down... Some changes on Spotify side ?

@00bins
Copy link

00bins commented Sep 5, 2024 via email

@neumanntv
Copy link

yes it also works for me again - I haven't installed new version of spotty or changed any other settings

On Thu, 5 Sept 2024 at 14:28, DCH-SOCOMEC @.> wrote: Works again on my side too, after few days down... Some changes on Spotify side ? — Reply to this email directly, view it on GitHub <#137 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZ7UMAVEKWFHNQKWF5UN5DZVBL7ZAVCNFSM6AAAAABNRYAUQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZRGY4DMMRVHE . You are receiving this because you are subscribed to this thread.Message ID: @.>

Same for me - the old spotty 4.11.1 also works again (with that message...and start missing)

@MarcPlace
Copy link

MarcPlace commented Sep 5, 2024

Huh? 🤔
Same here, running LMS 8.5.2 and Spotty 4.11.1 also without any issues now. Very odd... maybe they've reverted their changes again at Spotify because of too many complaints from 3rd party users.

Nevertheless, I've managed to compile the i386 binary for Spotty 4.11.9 myself successfully using my client ID. Works as expected on my old 32-Bit ITX. 👍

[root@vdr i386-linux]# file spotty-i386
spotty-i386: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 3.2.0, stripped

[root@vdr i386-linux]# ./spotty-i386 --help
spotty v1.9.9 - using librespot 0.5.0-dev VERGEN_IDEMPOTENT_OUTPUT (Built on 2024-09-05, Build ID: Nyc7nOmS, Profile: release)

@CyberKnight-s
Copy link

CyberKnight-s commented Sep 6, 2024

For me its working now again with v4.11.0. So Spotify must have realized they broke something on their end and fixed it. Because before it would just skip through the playlist without playing anything. Running PicorePlayer btw, piCorePlayer v9.2.0 | www v00029 | linux 6.1.77-pcpCore-v8 (64) | piCore v14.1 | Squeezelite v2.0.0-1476-pCP.
Anyway, Michael, thanks so much for your continued support! Spotty = necessity of life for my family & me...

@neumanntv
Copy link

now updated to 4.11.2. Issue is back again - likely from spotifys side again. :(

@neumanntv
Copy link

now updated to 4.11.2. Issue is back again - likely from spotifys side again. :(

Now it works again...strange.

@FlorentBrianFoxcorner
Copy link

FlorentBrianFoxcorner commented Sep 7, 2024

With 4.11.9 I seem to have an issue with token refresh.

I'm on docker amd64 stable (8.5.3), still with --net=host.

Once set up using my account from Spotify on Android, Spotty works alright, again thank you Michael!

Then after 1+ hour of operation I get in server.log for each Spotty action:

    [24-09-06 20:06:42.5600] Plugins::Spotty::API::__ANON__ (1464) API call: episodes?ids=4H3aJfrcbS0hPBFkvpmPGl&market=from_token
    [24-09-06 20:06:42.5606] Plugins::Spotty::API::__ANON__ (1468) error: 401 Unauthorized
    [24-09-06 21:05:13.4273] Plugins::Spotty::API::__ANON__ (1464) API call: me
    [24-09-06 21:05:13.4282] Plugins::Spotty::API::__ANON__ (1468) error: 401 Unauthorized
    [24-09-06 21:05:13.4334] Plugins::Spotty::API::__ANON__ (1464) API call: browse/featured-playlists?wakeUpBoo=DE&limit=50&locale=de_DE&timestamp=2024-09-06T21%3A00%3A00

To get it working again, I created a 2nd "App" in Spotify Developers and entered this Client ID to Spotty.
This results in Spotty working again for about one hour.
Mind in the log above: Around 20:06 I entered the other Client ID and the error popped up again at 21:05.

If I then again switch to the previous Client ID, it works again for about 1h.

@michaelherger
Copy link
Owner

Yeah, I've seen token expiration issues, too. It's odd, because the code follows the TTL given in the token itself. But in my case Spotty would refresh a minute or two later, and I'd be able to continue to use it without any restart and such.

@cregeland
Copy link

cregeland commented Sep 11, 2024

Is it still working with the «old» spotty version (not the testversion)? It seems the test version is quite a bit slower to navigate through albums etc. Might take a chance and go back to normal release?

by they way @michaelherger - do you have buymeacoffe? Great work keeping the plugin alive😃

@michaelherger
Copy link
Owner

Yes, you should go back to the official release - which IMHO is working more reliably than the new one (again).

But no, I don't drink coffee 😁.

@bbernhard
Copy link

bbernhard commented Sep 14, 2024

Does anyone else have issues that the playback sometimes stop? This happens totally random. Sometimes after one or two tracks, sometimes after an hour or so. Not sure if this is related to the API changes, but I've only experienced that issue after Spotify did some changes on their side. Just curious if anyone else experiences those issues?

Apart from those type of entries (which appear to be happening on a regular basis)

file:///usr/local/slimserver/prefs/clientplaylist_0200750c7276.m3u doesn't exist on disk - skipping!
[24-09-14 11:31:30.2910] Slim::Formats::Playlists::Base::playlistEntryIsValid (125) Warning: spotify://track:03qa9kZ75xgpU478VV6Cjy found in playlist

I do not see anything odd in the server.log. The log level is set to Warn though.

@GodfatherX64
Copy link

Does anyone else have issues that the playback sometimes stop? This happens totally random. Sometimes after one or two tracks, sometimes after an hour or so. Not sure if this is related to the API changes, but I've only experienced that issue after Spotify did some changes on their side. Just curious if anyone else experiences those issues?

Apart from those type of entries (which appear to be happening on a regular basis)

file:///usr/local/slimserver/prefs/clientplaylist_0200750c7276.m3u doesn't exist on disk - skipping!
[24-09-14 11:31:30.2910] Slim::Formats::Playlists::Base::playlistEntryIsValid (125) Warning: spotify://track:03qa9kZ75xgpU478VV6Cjy found in playlist

I do not see anything odd in the server.log. The debug level is set to Warn though.

yes, unfortunately, it happens with my setup too

@michaelherger
Copy link
Owner

Are you still on the test version or back on the release version? I have found an issue in the test version which caused slowness, failed token updates etc. But I didn't bother updating the test repo, as the old version started working again.

@bbernhard
Copy link

Are you still on the test version or back on the release version? I have found an issue in the test version which caused slowness, failed token updates etc. But I didn't bother updating the test repo, as the old version started working again.

I am on the latest release version. Wanted to give the test version a try back then, but at that time the release version already worked again (except for the random playback stops).

@Haloto
Copy link

Haloto commented Sep 14, 2024

I have the same problem as well. Tough I think it happend occasionally before spotify broke playback alltogether for some days. Now it happend very frequently and I did not even manage to have one album play without it stopping at least once. I dug up a somewhat related forum post somewhere that recommended to disable ogg as a file type for spotty. That seems to have fixed the stopping for me even though every 10 or so tracks it skips to the next track in the middle of one track.

Edit: I never used the experimental version

@bearsh
Copy link

bearsh commented Sep 16, 2024

Are you still on the test version or back on the release version? I have found an issue in the test version which caused slowness, failed token updates etc. But I didn't bother updating the test repo, as the old version started working again.

My kids seem to be quit happy with the test version but I also experienced the slowness. So I think it would be nice to have an update on that. We never know if Spotify changes their mind again so I think its good to have a version with follows the upstream project closely.

@michaelherger
Copy link
Owner

How technical would you be? I think I have a fix for the slowness (and 429s - which are related):

diff --git a/API/Token.pm b/API/Token.pm
index 0b4cd7f..9778fcd 100644
--- a/API/Token.pm
+++ b/API/Token.pm
@@ -173,13 +173,13 @@ sub _gotTokenInfo {
 
 	if ( $response && ref $response ) {
 		if ( $token = $response->{accessToken} ) {
-			if ( main::DEBUGLOG && $log->is_debug ) {
-				$log->debug("Received access token: " . Data::Dump::dump($response));
-				$log->debug("Caching for " . ($response->{expiresIn} || 3600) . " seconds.");
-			}
+			my $expiry = $response->{expiresIn} ? ($response->{expiresIn}->{secs} || 3600) : 3600;
+
+			main::DEBUGLOG && $log->is_debug && $log->debug("Received access token: " . Data::Dump::dump($response));
+			main::INFOLOG && $log->is_info && $log->debug("Caching access token for $expiry seconds.");
 
 			# Cache for the given expiry time (less some to be sure...)
-			$cache->set($cacheKey, $token, ($response->{expiresIn} || 3600) - 300);
+			$cache->set($cacheKey, $token, $expiry - 300);
 		}
 	}
 
@@ -218,12 +218,14 @@ sub get {
 	my ($class, $api, $cb, $args) = @_;
 	$args ||= {};
 
-	if (my $token = $cache->get(_getCacheKey($args->{code}, $args->{accountId} || ($api && $api->username) || (main::SCANNER ? '_scanner' : 'generic')))) {
-		main::DEBUGLOG && $log->is_debug && $log->debug("Found cached token: $token");
+	my $cacheKey = _getCacheKey($args->{code}, $args->{accountId} || ($api && $api->username) || (main::SCANNER ? '_scanner' : 'generic'));
+	if (my $token = $cache->get($cacheKey)) {
+		main::INFOLOG && $log->is_info && $log->info("Found cached token: $token");
+		main::DEBUGLOG && $log->is_debug && $log->debug($token);
 		return $cb ? $cb->($token) : $token;
 	}
 	else {
-		main::DEBUGLOG && $log->is_debug && $log->debug("Didn't find cached token. Need to refresh.");
+		$log->warn("Didn't find cached token. Need to refresh.");
 	}
 
 	if (main::SCANNER) {

With this my Spotty has been stable.

Would you happen to be Podcast listeners? I've noticed new issues with the new helper. Some podcasts wouldn't play any more...

@bearsh
Copy link

bearsh commented Sep 16, 2024

Would you happen to be Podcast listeners? I've noticed new issues with the new helper. Some podcasts wouldn't play any more...

sorry, I don't listen to podcast on spotify, so I can't comment on that...

@michaelherger
Copy link
Owner

If you're still using the spotty-test.xml repo, you should get a v4.11.99 with the token caching issue addressed. This was causing delays and request failures due to too many requests.

@MarcPlace
Copy link

MarcPlace commented Sep 19, 2024

Would you happen to be Podcast listeners? I've noticed new issues with the new helper. Some podcasts wouldn't play any more...

I can confirm this issue (and mentioned it already in an earlier posting), that some podcasts won't play anymore with "spotty-test". With stable branch (4.11.2) they just play fine, but recently I've discovered a problem with 4.11.2 on longer episodes, that they stop playing after 30 to 40 minutes or so for no reason.
I will take a closer look in the log file next time if this will happen again, maybe i can find some hints there.

@michaelherger
Copy link
Owner

@MarcPlace there's also a new testing version which should have the podcast issue resolved. I'm also working on some improvements to the "ends at the stop of a track" issue. But still no Connect.

@MarcPlace
Copy link

@michaelherger Just for the record... did a quick test yesterday with librespot from the "spotty-dev" branch (commit 9b8cba5af2ea73034151039557b9a79c5b214448). Podcasts are working again, thanks Michael!

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

No branches or pull requests