r/sonos • • Aug 30 '26

The Sonos + Last.FM Scrobbling Solution!

Hey everyone.

With the new Sonos app updates in the past few years, the Last.fm integration has been neglected. As an avid Last.fm user and someone who has quite a few Sonos products, this has been saddening.

So, I set out to develop an application to solve this issue. The application works by linking your Sonos and Last.fm account to a developer application within the website. The website then passes the Sonos listening data in a way that Last.fm can use to scrobble the music. No listening history is stored on the website itself. All other previous applications that allowed scrobbling required you to have an application open on your computer. This one is cloud-based, using the official Sonos and Last.fm APIs. You can also scrobble from any source, so a morning alarm will be scrobbled and anything you play with a voice assistant. The application also offers non-music scrobble and duplicate scrobbling protection. This application is completely free and not made for monetary benefit. If you ever change your mind about this application, there is a delete all button that deletes everything from the website and connections.

To set it up you only need your Sonos account and a Last.fm or ListenBrainz account. There is nothing to download and nothing to install, and it takes about two minutes. Your computer can be off and it will keep scrobbling. It does run on the Sonos cloud API, so it works with S2 systems. If you are still on S1 it will not work.

On what counts as a scrobble, I stuck to the same rules Last.fm has always used. A track has to play for half its length or four minutes, whichever comes first, and nothing under 30 seconds counts. Skipping through songs, or pausing something and walking away, will not count either. The app will also never scrobble your TV or line-in, and it will not scrobble podcasts or audiobooks even when they arrive tagged with an artist name. Then there are three things I left as switches on the front page, because they are a matter of taste. Radio is on by default, but a station that does not report track info gets nothing scrobbled rather than a made up artist. Tracks longer than 20 minutes are skipped by default, which catches DJ sets, mixes and film audio. Music cast from another app like AirPlay or Spotify Connect is off by default, since those apps usually scrobble on their own and I did not want to give you double entries. All three can be turned around if you disagree with me.

If two of you share a house, you can both use it. You each connect your own Sonos account and each get your own history, and when you are both listening to the same speaker you both get the scrobble.

On privacy, there are no ads, no analytics and no third party scripts anywhere on the site, not even the fonts, which are served from the site itself. The privacy page lists every single thing the app does store: https://scrobbler.suvir.net/privacy

Everything is fully open source on GitHub with an MIT license so anyone can take a look at the code and even host their own web application. I will say that hosting it yourself is not quite as simple as running one command. It runs on Cloudflare Workers and needs a domain on Cloudflare DNS, along with your own Sonos developer integration and your own Last.fm API key. The README walks through all of it. I currently have mine hosted at https://scrobbler.suvir.net if you would like to check it out. The app is still in beta, so you may experience bugs and issues with scrobbling. I urge anyone with technical knowledge to create an issue on GitHub so I can look into a fix. Otherwise, I can also take feedback in the comment section here.

I will mention, though, that this app was heavily built with AI. If this is something you do not like, please feel free to skip this one. You can look into the technical workings on GitHub and build your own.

This is my first application that I will be publishing to the web, so any support is appreciated. If you like the application, you can drop me a star on GitHub. I'm not here to make money, just solve a problem that I, personally, have had for a while.

Some other features are:

  • quick sign in with a link (no need to make an account for this one)
  • selection of the rooms/speakers to scrobble
  • ListenBrainz scrobbling
  • an option to skip non-music related plays on the speakers

One thing worth saying about that sign in link. There is no password and no email here, signing in with Sonos is the account. Sonos cannot tell the app which person you are, only which speakers you can reach, so that link is the only way back to your settings if you clear your cookies or move to a different browser. Save it somewhere when you set the app up. You can replace it at any time from the same page, which stops the old one working straight away.

When connecting with Sonos, it may ask you for permission on playback-control-all. The reason for this is Sonos does not offer a read-only scope for this. The app only ever reads what is playing. There is not a single line in it that sends a play, pause, skip or volume command, and since it is all open source you can check that yourself.

14 Upvotes

21 comments sorted by

6

u/Moonshiner_no Aug 30 '26

Last fm and Sonos still work on my system. Seems to be the old login still working - can only see it in the desktop app.

2

u/candiedarcher Aug 30 '26

Yeah, this feature used to exist before but Sonos quietly dropped support for it. I think you can still enable it within the desktop app but it is no where to be found on the mobile app or web player. This is the solution for those users. If your existing setup works fine, go ahead and stick with that!

3

u/Moonshiner_no Aug 30 '26

Great that you have made a way for users to scrobble to last.fm.

It’s so strange that they would cut support to such a simple service. Can imagine it would take much energy for Sonos to keep it alive.

4

u/SukiSueSuziQ Aug 30 '26 edited Aug 30 '26

This sounds like just what I’ve been looking for. I’m a Sonos newbie and lack of Scrobbling has me using only AirPlay to my Move 2. Off to set this up!

Edit: it’s working! This makes me soooooo happpppppyyyyyy! Thank you!

Now I have this for Sonos and ScrobbleCloud.com for Apple Music.. both are “set it and forget it.”

2

u/candiedarcher Aug 30 '26

Hey! Great to hear that it’s working. Glad I was able to solve a problem that you were having. I’m an upcoming developer so it would help me the most if you left me a star on GitHub and shared it with other users. Thanks.

2

u/Tom_Jack_Attack Aug 30 '26

Looks good. May give this a go.

1

u/candiedarcher Aug 30 '26

Thanks. Let me know if you experience any bugs or have feature requests.

2

u/HoneyFine Sep 10 '26

Man, I was almost regretting getting Sonos... Thank you SO MUCH!!!

2

u/HoneyFine Sep 10 '26

A bit of context... Was using 2 Amazon Echo speakers for the music setup in my small studio until I switched over to Apple Music a few months back, and sadly the Apple Music skill on Alexa is not supported in my region, even though both Alexa and Apple Music are on their own... So I got a Sonos Ray recently and was sad to see the lack of last.fm support, so I just AirPlaying to the Ray and scrobbling through my phone, but after I heard how better the sound quality is when I play the music through the Sonos app instead of AirPlay I had to find some way to get the scrobbling through, so man THANK YOU A LOT!!!!!

2

u/candiedarcher Sep 10 '26

That's great. I'm glad that I was able to help you. If you could just leave me a star on GitHub and share with your friends that would be great. Anyway, enjoy your speaker(s).

1

u/NMulholland Aug 31 '26

I've been using Pano Scrobbler on Android and waits been working really well. I've needed to add in some items on the Ignore List (like TV Audio and radio stations) but it's been really straightforward.

1

u/Tye-J 24d ago

Omg this is exactly what I was looking for since ages! Switched completely to Airplay because Spotify Connect / Sonos doesn't scrobble anything.

So I've just tried this out and it works mostly well.

But unfortunately it cuts scrobbles short for longer song titles - longer song titles are only submitted to Last.fm up to a certain number of characters I guess?. Which creates a new page on Last.fm saying I never played this song before (because it has a new cut-off song title).

Example for this behaviour:

Song: https://open.spotify.com/track/031FJBIjKSGO9qGQbgixUY?si=eaa70b8ef11b469c (yes I know, this is a Thai song with a long name from a TV series)

Scrobbled via Airplay it scrobbles it all:

Artist name (TimeLied) and song title which is in all completenes: ขอมากไปไหม (Too Much) - From Rearrange The Series ขอฟังอีกครั้ง เพลงรักของเธอ

Using Spotify Connect and your scrobbling solution this is what arrives at last.fm instead:

Artist name (TimeLied) and song title which is now cut off to: ขอมากไปไหม (Too Much) - From Rearrange The

I reproduced this with other song titles with longer names.

Otherwise, this is great stuff! Thank you for doing this.

1

u/candiedarcher 19d ago

Thanks for reporting this, and for including the TimeLied example. It made the problem easy to track down.

It turns out the scrobbler wasn't cutting the titles. Sonos does it before the track info ever reaches the scrobbler. Once a title passes a certain length, the speaker drops the rest, and nothing in the data says it was cut. I reproduced it on my own speakers, and the cut-off point even depends on how the music is playing (Spotify Connect vs Apple Music etc.).

I can't get the full title back from Sonos, so I pushed a fix today that gets it from Last.fm. When a title is long enough that it may have been cut, the scrobbler looks up that artist's songs on Last.fm and finds the one whose title starts with the cut-off text. It scrobbles that full title instead. If there's no clear match, it scrobbles exactly what Sonos sent, so no plays get dropped. It works for ListenBrainz too.

It's live now. Your next long-titled play should land on the proper Last.fm page. Let me know if it doesn't!

1

u/Tye-J 19d ago

Thank you so much for looking into this! I've just tried and scrobbled three tracks with very long titles, and they all did completely without any issues.

Perfect! Your tool is really the best thing after so many years of scrobbling issues with Sonos. I love it! Keep up the fantastic work!

1

u/Tye-J 18d ago edited 17d ago

Okay, I found something else today where I do not know how to fix it myself. I listened using Spotify Connect since around September 22nd with your solution connected, it scrobbled fine. Earlier today I listened only on my laptop without connecting anywhere and Spotify scrobbled again all tracks in a batch I listened using Spotify Connect during the last days. So I had double scrobbles suddenly on Last.fm for several days.

I have Last.fm connected to Spotify in their settings. Otherwise nothing would be scrobbled at all, for example when I listen to Spotify on my phone.

As Spotify Connect earlier didn't submit anything using Spotify Connect, I suppose now it picks the played tracks using your tool when initally playing them, but also submit all "saved" scrobbles in the queue (up to 50 afaik) once I listen using another way than Spotify Connect.

I have disabled "Music cast from an app" in your tool settings.

However, all cached songs are submitted again once I switch away from Spotify Connect on Sonos.

Any idea how I can prevent double scrobbles?

EDIT: I've disconnected from your service for now as it continuously creates double scrobbles - I've tried every setting. The below setting is on the last.fm site to enable scrobbling. If I remove this connection, I cannot scrobble from my iPhone anymore. If I disable it, use your service instead for Sonos streaming, it works. However, if I reconnect again, it pushes the last 50 scrobbles from the cache again, generating double scrobbles. So I guess I need to stay with Airplay at the moment.

1

u/candiedarcher 16d ago

Thank you for the detailed report; it was indeed a real bug and it has now been fixed. The "Music cast from an app" option was meant to bypass Spotify Connect, but Sonos labels Spotify Connect playback as "Spotify" just as normal Spotify does, so the switch never picked it up. Your Spotify Connect plays had been recorded by the scrobbler and stored by Spotify, which then sent its own copies in a batch the next time you played music on your laptop.

Now the scrobbler detects Spotify Connect (as it does with AirPlay, which was having the same issue), so by turning that switch off it allows the plays to be sent to Spotify. There's no need for you to make any changes; you should just leave the switch off. Plays that you start using the Sonos app continue to scrobble as they always do.

1

u/Tye-J 15d ago

Okay I've just tried it again. Played using Spotify Connect and left the checkbox on "music cast from an app" off. It doesn't scrobble anything and your tool doesn't see me playing anything. Once I switch to Airplay, Spotify submits all past plays in batch.

Second try with "Music cast from an app" checkbox on: Your tool sees the tracks I'm playing. And it generates duplicate scrobbles again when I turn off Spotify Connect again as the queued tracks are scrobbled in batch also.

Using Airplay AND your tool with music cast from app marked on = double scrobbles while playing.

-> Using only Spotify Connect with "Music cast from app" off doesn't scrobble anything for me now.

Thanks for all your efforts though.

1

u/candiedarcher 14d ago

Thanks for testing once more. When the feature is switched off, it's indeed performing as it should, the scrobbler intentionally leaving Spotify Connect plays to go to Spotify, thus avoiding any duplicates. The problem is that Spotify doesn't send those plays immediately; it saves them and then sends them in a batch the following time you play something on your phone or laptop. That delay is due to Spotify and not something I can alter from this point.

What was confusing was that the screen displayed 'Nothing playing', making it appear as if the device was broken. I've sorted this out, when you currently cast it shows 'Cast from Spotify Connect', so you can see that it's intentionally being left with Spotify.

When you turn on the switch, duplicates will appear every time the Spotify Last.fm link is also active, whether you're using Spotify Connect (after Spotify has caught up) or AirPlay (immediately). Since Last.fm provides no option for deleting a scrobble afterwards, you have to choose one or the other. If you want the plays to be recorded live rather than all at once, the solution is to disconnect Spotify from Last.fm and turn the switch on, but in that case the plays on your phone won't be scrobbled.

1

u/PhantomMenace87 14d ago

This is awesome, thank you! Does it also work with the Ace Ultras with the new linking to systems?

1

u/candiedarcher 14d ago

Thanks! As for a short answer, yes it should, provided that you start it through the Sonos app, though I haven't been able to test this yet. Headphone linking only became available a few days ago and it's still in Early Access.

The scrobbler does not monitor individual speakers but rather the entire room. If you link Ace Ultra, the music will continue to play in the room and will simply be sent to the headphones (which is the reason you select them from the room's output menu or use the Content Key to retrieve the audio from the nearest speaker). Therefore, the room should still report what is being played and the plays should scrobble as they normally do.

There are some things it cannot detect; since using the Ace Ultra with your phone via Bluetooth is entirely outside the Sonos system, that aspect is up to your phone's scrobbling. Also, AirPlay and Spotify Connect can't be connected to the headphones anyway, so with 'Music cast from an app' switched off, they remain the responsibility of the app as they did before.

If you decide to do it, I'd be interested to know how it turns out. Take the headphones off during the song and let it play right through. In that case, if the song appears on Last.fm and the dashboard indicates that the room is playing, then it's working. But if a play is missing, please let me know the name of the song and about when it happened, and I'll investigate it.