Spotify scrobbler for Mac OS X

    • berder ha detto...
    • Utente
    • Nov 9 2008, 18:16

    Spotify scrobbler for Mac OS X

    I spent some time today looking at solutions for scrobbling Spotify plays on Mac OS X. Here's the deal:

    Making a Growl display which intercepts what Spotify sends is very easy, but unfortunately the track length is not included, and I have found no clean way of getting a hold it. The Windows version reads the stored metadata file, but on Mac OS X this is not updated in real time, so in general it is of no use. (This may be true on Windows too, I don't know.)

    As a hack, one could try to write something which digs into the guts of Spotify to get the track length, but I don't have the time to do that. A very easy, and clean, solution would be if Spotify would display an extra line in Growl, say "Title; Trackname; Album; Year -- MM:SS". Ideally they should implement AppleScript too, but adding an extra line is something they could do in 10 seconds or so. (Read: suggest to Spotify that they do so!)

    What one can do is "guess" the track length, assume that all songs are 2 minutes long, say, and scrobble based on that. If scrobbling after 50% of play time, this means that songs longer than 1 minute would get scrobbled, others not.

    The problem with this approach is that it's against the AudioScrobbler rules (meaning: you could potentially lose your scrobbles). Even if one had the correct times it would be impossible, without AppleScript support (or whatever) in Spotify, to handle some cases, for instance: stopping all playback after less than 50% of play time would get the song scrobbled although it shouldn't. In the long run, guessed times may also be bad for's database, but I'm not sure.

    Anyhow, after getting the song information one must decide how to actually send it to's servers. Doing a "one shot" kind of deal is easy enough, but caching if servers are down etc is not so easy.

    I believe the most popular scrobbler (and what I generally use) for Mac OS X is iScrobbler. Unfortunately, I was unable to interface with it, and instead wrote something which uses the official (bloated?) player.

    If you want to try it, despite all the warnings above, you'll need to install Growl and the client (versions 1.1.4 and, respectively, on Mac OS X 10.4.11 and 10.5.5 is what I use). Then install SpotifyScrobbler.growlView (a 12 kB file on Megaupload, there's something wrong about that) and configure Growl to display Spotify's messages using this display. Finally launch the player and Spotify to see if it works, some error messages may appear in the console log. It uses the client id "tst", since that's what it is.

    Please note: I have no interest in supporting this, so consider it orphaned from now on. If you want to take over, please do so. I'm sure you can rewrite it far better than I have based on the instructions above (information on how it interfaces with player can be found here), but if you really want the source, just ask.

    • DMR ha detto...
    • Utente
    • Nov 10 2008, 22:35
    Cool. But your right. 12 kB file on Megaupload is madness. I uploaded it to my web. Not sure Im gonna use it thought. Dont want to loose my scrobbles. :) I have a strong gut feeling that it will become better much much soon. Spotify people knows about us. And us are getting strong. Euhm ... Or something like that. Thanks anyway! :)

    *** WARNING ***
    This post will probably contain poorly written English.
    Modificato da DMR in data Nov 13 2008, 14:40
    • berder ha detto...
    • Utente
    • Nov 11 2008, 11:18
    Not sure Im gonna use it thought. Dont want to loose my scrobbles.Perhaps I should clarify: AFAICT the Windows scrobbler has the exact same problem when it comes to the timing issues, at least in my setup. My metadata-file doesn't update in real time on Windows either, so Scrobblify almost always ends up using the "guessed" track time of 5 minutes.

    The AudioScrobbler protocol has pretty strict requirement on when a track should be scrobbled: no scrobbling must take place until playback has stopped and the effective play time must be at least 4 minutes or, alternatively, 50% of track length.

    Properly implementing this is impossible unless the Spotify player would be willing to communicate all relevant events (including pausing) to third party plugins.

    However, the really bad thing that both the the Growl-plugin and Scroblify do at the moment is submitting known bad data (namely incorrect track length) to the server. The proper way around this is implementing version 1.2.1 of the AudioScrobbler protocol: one can then set the "source id" to "Non-personalised broadcast" and not incude the track length at all. This could be done rather easily using some finished AudioScrobbler library, but it requires running a local daemon (in place of the official player).

    (An idea for a temporary fix would be to randomize the track length: instead of submitting all track lengths as 5 minutes, one could at random select a time 5 minutes +/- 2 minutes, say, and use submit this track length. Unfortunately, the track length is submitted in seconds, so with a couple of hundered users this will probably be pointless. If actually uses the submitted track lengths fake track lengths will become a problem, especially for "Spotify exclusives".)

    In a nutshell: The Mac and the Windows scrobblers have essentially the same qualities and problems. (To be fair, Scroblify at least makes an effort to read the metadata file.)

    • liesen ha detto...
    • Utente
    • Nov 11 2008, 22:25

    Guessing track length

    The metadata cache is certainly not updated in real time, that would not make sense. On my machine, Scrobblify uses the correct track length about 60% of the time. Meaning: 40% of the songs scrobbled will have a track length of five minutes.

    The fallback on a five minute track length is debatable.

    • kapina ha detto...
    • Utente
    • Nov 11 2008, 22:48


    Works for me. Thanks for the effort.

    Losing scrobbles later does not sound nice, but I'm hoping that crew will tolerate this behaviour for now. I'm trying my best to not cheat, atleast. :)

  • Thanx for the effort, but I think I'll wait for something a little easier... ;)

    • DMR ha detto...
    • Utente
    • Nov 12 2008, 14:28
    I dont think it will be long before Spotify gives "us" the possibility to make these plugins much better. And by "us" I mean, ofc, "you guys" ... :)

    Both Scroblify and this here OSX version is as good as it gets for now. And we appriciate your work gentlemen. ^^,

    *** WARNING ***
    This post will probably contain poorly written English.
  • I don't know if this can be used or not, but Spotify Mac is sending stuff to system.log

    Can any of this be of us to us? It seems like it's spitting it the hash of track names, not sure if the length is in there or even if we can read syslog

    • Goblim ha detto...
    • Utente
    • Dic 4 2008, 14:47
    This doesn't seem to work for me. I have the Growl plugin, and it's toggled on for the Spotify application. But the program doesn't seem to react. Any idea why?

    • Ropert ha detto...
    • Utente
    • Dic 12 2008, 13:01
    Can anyone please post a foolproof step by step instruction on how you get this to work? No offence to berder, but it is a lot of text and not really a guide for people like me, who knows very little about programming. Now I have installed growl and updated my old client (I just use Iscrobbler and havent used the client for ages). I downloaded the growl script and then what?

  • Ropert, just go to System Preferences pane, click on Growl and then Applications. You should see Spotify in the list. Select SpotifyScrobbler as its Display Style and you're done!

    • Ropert ha detto...
    • Utente
    • Dic 13 2008, 0:20
    Thanks arkona3000! Working great now. I see that it submits everything as 2:00 minutes. Anyone who has lost scrobbles yet because of this?

  • After configuring all things above, you need to restart growl for some reason. That is...

    - Install
    - Start and enter your login details
    - Download SpotifyScrobbler.growlView
    - Put SpotifyScrobbler.growlView in ~/Library/Application support/Growl/Plugins
    - Open System Preferences: Growl: Applications: Spotify, and select Application's display style: SpotifyScrobbler
    - Restart Growl
    - Restart client

    That's it. Enjoy!

    • _psu ha detto...
    • Utente
    • Dic 13 2008, 16:51

    Nice work!

    Even if it is experimental, it will do for me until we get an API..

    Just one thought, is there a way to make it both send the data to the AND display the Growl message?? Kind of like having them showing up on song change.

  • Thanks, it does work!

    _psu a dit :
    Just one thought, is there a way to make it both send the data to the AND display the Growl message?? Kind of like having them showing up on song change.

    Although I have to agree with _psu, both would be great.

  • Lovely it works!

    Thank you!

  • An alternative Spotify Scrobbler

    As part of the Hack Day yesterday I started work on a scrobbling plugin for Spotify using SIMBL (the same plugin system that's used for Safari extensions like PithHelmet)

    It works in a very similar way to the growlView method, but it intercepts the Growl message from within Spotify which has two advantages:
    1) It can access the real track length
    2) The Growl message still gets displayed as normal

    It was hacked together pretty quickly and it's not perfect; it relies on the desktop app to handle logging in to and Scrobbling tracks and it's also not great at telling the app that Spotify's stopped playing, so if you quit Spotify 2 seconds into a track it'll probably get Scrobbled anyway.

    If anyone wants to try it out you'll find a ready-to-use version, all the source code and a README with usage instructions over on GitHub:

    • asbjornu ha detto...
    • Utente
    • Dic 15 2008, 9:04


    George Brock, thank you so much! Your Spotify-Scrobbler works brilliantly. Having it available on github gives the opportunity for other hackers to contribute to the code as well, which is just fantastic. Keep up the good work and thank you again so much for doing this wonderful hack! :-)

    «He's a loathsome offensive brute, yet I can't look away»
    • liesen ha detto...
    • Utente
    • Dic 15 2008, 10:45
    That's pretty cool stuff, georgebrock. I recently got my first Mac, and have just started coding stuff for/on OS X, so thanks for putting it on github!

  • Works!

    Thanks, George! This worked at first try!

    Talk to me at
  • Re: An alternative Spotify Scrobbler

    georgebrock said:
    1) It can access the real track length
    2) The Growl message still gets displayed as normal

    Sounds great, especially the track length-part. I'll give this a try later today!

  • gg georgebrock, great use of simbl :)

    test, code, refactor.
  • noob

    Argh, I can't get george's SIMBL-plugin to work though I followed the guide. Still at it...

  • It works! Thanks all.
  • ...I got the Growl-plugin to work.. but I thought I should try the SIMBL instead, no luck though. Any ideas? Do I have to something with my SIMBL-installation, I just ran the installatino package...
Gli utenti anonimi non possono inviare messaggi. Per inserire messaggi nei forum, accedi o crea il tuo account.