Google Music with Last.fm

Google Music Player with Last.fm ScreenshotIf you haven’t experienced it yet, Google Music Beta is pretty awesome and was recently released to an undisclosed number of people as a trial beta period. Happy enough, I was one of those who got an early beta invitation and started developing scripts right away. One of the features I find crucial in any music players is the ability to Last.fm Scrobble, and thus the reason for this script. So here you have it, brand new and released a couple days into the Google Music Beta. Keep in mind this is a growing project, and will grow with the same feature list on my Amazon Cloud Player Last.fm version.

Software Requirements

Installation Directions

  1. If you’re using Firefox you’ll fist need to install Greasemonkey if you haven’t already. If you’re using Google Chrome you’re already set.
  2. Download/Install my script* into Greasemonkey or Chrome by following the simple prompts (You may need to restart your browser!).
  3. Go to your Google Music Player.
  4. In the top right next to Settings, Sign out, and Help you should now see “Last.fm Requires Authentication.” Click on this and grant access to my script to Scrobble for you from Last.fm. You should then be redirected back to your Google Music Player.
  5. You’re done! Enjoy. :)

* In Downloading and/or Installing my script you agree to its Privacy Notice and Terms of Use.

Sponsor Future Development

Future Improvements

Have an idea? Post a comment below.

  • The option for thumbs up clicks to represent a “love” on Last.fm, with the option to turn this feature off.
  • The ability to scrobble the same song when in a loop by itself. Right now it only scrobbles the first play.
  • Support for Safari and Opera

Change Log

November 28, 2011

  • The new Google+ strip caused display issues for people without Google+ accounts. This bug has been fixed and everyone without a Google+ account should now be able to scrobble and/or authorize their account again.

November 23, 2011

  • Google updated the top strip to match the Google+ layout with a black background. I’ve updated the color of the Last.fm text to contrast and match the rest of the Google+ color scheme so the text is readable again. (Thank you Shawn B and Jacob G)

October 7, 2011

  • Fixed a bug in Firefox/Greasemonkey where the script would not load the first time you logged into Google Music Beta. Firefox users will need to re-download the script from this project page and install it for the bug to be fixed. Chrome users need not update to the new client script. (Thank you Josh and Nick)

September 28, 2011

  • Corrected a compatibility issue which caused the script to fail at loading in Firefox 3.5/3.6 with older versions of Greasemonkey. (Thank you Marcos and Holly)

September 27, 2011

  • Changed the way album data is stored locally to optimize the script for users with tens-of-thousands of songs.

September 26, 2011

  • Updated the client script to run over HTTPS properly in newer versions of Greasemonkey/Firefox. This change will not require Chrome users to update their script, but it will not hurt if they do. (Thank you Josh)
  • Updated the server script to run the Scrobbling commands over whatever HTTP/HTTPS you have accessed Google Music from instead of defaulting to HTTP. This was only causing an issue for some Chrome/Firefox users who typed in “HTTPS” when accessing their Google Music Players. (Thank you Josh and Chris)

September 24, 2011

  • Adding Scrobbling of album name. Yay!
  • Fixed a bug where multiple Scrobbles could occur in a row under very rare circumstances.
  • Increased the speed in which the script looks up rather you’ve previously loved the song by 20x (now 1/4 of a second).
  • My server no longer acts as a proxy for Scrobbles, Loves, or Play data allowing for your Last.fm to get updated even faster, and my server not to crash from the large quantity of unexpected users.

July 31, 2011

  • Added a “Super Secret Awesomely Helpful Setting” for anyone who has donated towards the efforts of the script’s development. What is the Super Secret Awesomely Helpful Setting? Well, I can assure you it’s very fancy, but telling you wouldn’t make it Super Secret or Awesome would it? :)

July 28, 2011

  • Fixed a bug causing duplicate scrobbling issues, and server slowdown. I’m sorry for anyone who was affected by this. (Thank you Mike)

July 27, 2011

  • Added a long awaited settings drop-down menu! Hooray!
  • Added “When to Scrobble” as a setting which allows you to specify when during the song it Scrobbles. Defaults to 50%, and has the options: 50, 60, 70, 80, 90.
  • Added “Scrobbling: Yes/No” as a setting which allows you to stop Scrobbling until you re-enable it.
  • Added the ability to un-authenticate your Last.fm account with the script in the event you want to change it, or for whatever reason.
  • Added helpful links to: Donate (hint hint), Contact me (email), Project’s Homepage, and Terms of Service.
  • Have other awesome ideas for additional settings? Yes? Well, then try out the “Contact me” link. :)

June 9, 2011

  • Fixed a bug where “Loving” tracks didn’t work sometimes. (Thank you Caleb)
  • Fixed a bug where songs or artists containing special characters wouldn’t Scrobble. (Thank you Bryan, Caleb)
  • Fixed a bug where the non-existing album art (see: Future Improvements) was pushing to Last.fm as “null” and messing up statistics. Now the album title just isn’t provided, and no statistics on album listens are recorded. Hopefully I’ll find a solution to this soon. (Thank you Doug)

Requirements for a Scrobble

Because I know someone is going to ask, I’m going to put this here. These are the requirements set forth by Last.fm when posting to their servers with a Scrobble. If you don’t see your song marked as being played right away, it’s probably because you haven’t listened to it long enough.

A track should only be scrobbled when the following conditions have been met:

  • The track must be longer than 30 seconds.
  • And the track has been played for at least half its duration, or for 4 minutes (whichever occurs earlier.)

351 Responses to “Google Music with Last.fm”

  • Hugo Says:

    The “Terms of Use” of your extension are insane and totally unneeded! Why not use an MIT license or the Apache license 2.0?

  • ernie Says:

    Hi Daniel,

    This is an awesome extension. Thanks for making it.

    I’m having a problem, though. Starting a a few weeks ago, the extension is scrobbling the wrong album. The artist and track are correct; it is just the album that gets scrobbled wrong.

    I’ve been using your extension for a few months now, and it’s been smooth sailing until now.

    Any ideas?

    Thanks!

    • Daniel Slaughter Says:

      Hello ernie, I’m not sure what may be happening, but it sounds like a few other people have reported a similar issue with album data. I’m going to have to look into fixing this in the near future (it probably wont be for a couple weeks), and I’ll keep you posted.

  • Justin Says:

    Hey Daniel.

    I’m having a problem with songs not scrobbling when played on repeat. For instance, I listened to a song probably ten times in a row and not once was it scrobbled. I then went and listened to a different song and then went back to the song I was playing on repeat to see if it would scrobble now, which it did, but only once again when I played it a few times.

    The song is way over 4 minutes long, so that can’t be the problem.

    Any ideas?

    Thanks!

    • Daniel Slaughter Says:

      Hello Justin – Due to a bug late last year I had to implement a feature which essentially prevents the same song from being looped from ever scrobbling more than once. If you, for instance, have two songs in a playlist it will scrobble both just fine. But as of right now it wont scrobble the same song on loop play more than once. This is something I am intending to re-implement in the future, I just haven’t had an opportunity to do it yet. If you have any other questions please do let me know.

  • Chris Says:

    hey Daniel – great idea! It worked fine for me for months but now I cant get the last.fm to appear in the top right corner no matter what I do. I’ve tried uninstalling and reinstalling the script. Im running firefox 3.6.21. I thought maybe it had to do with me not having a google + account but reinstalled, logged back in, etc, and still nothing. Any ideas? Thanks!

    • Daniel Slaughter Says:

      You may actually have two copies of the script installed. Double check the menu: Tools > Greasemonkey > Manager User Scripts. Make sure only once instance of “Google Music Player Enhancements” is installed. I wouldn’t imagine it’s because you don’t have a Google+ account as it works for others who do not. If that’s not the problem it could simply be that Google is rolling out a new Last.fm layout. I haven’t heard anyone else report it as of date, but it’s possible. Does your layout still have the black top strip like in this screenshot (without the Last.fm text, of course)?

      http://screencast.com/t/kirO7Y9bjzO

      • Chris Says:

        Hey Daniel – thanks for the response. It looks like I do have the same black sidebar, and I only have one instance of the script installed. Captured both in the screenshot linked below. I also verified that Greasemonkey is turned on. Any ideas what the problem might be? Thanks!

        http://twitpic.com/8etxfl

      • Daniel Slaughter Says:

        I wonder if you’re getting script errors when the page first loads, possibly since you’re using Firefox 3.X. There’s something in Firefox called an “Error Console” which will report any errors in red when any page first loads. On Firefox 10.0 it’s located in Tools > Web Developer > Error Console. I believe in Firefox 3.X it’s under the View menu, but I may be wrong. If you can find that, and then clear whatever is in there, and then refresh your Google Music Player to see if it errors that would be very helpful. Please let me know if you need any other assistance with finding this.

      • Chris Says:

        Hey Daniel – I think we’re on to something here! Cleared the logs, and got the following message:
        “www.danielslaugher.com: server does not support RFC 5746, see CVE-2009-3555″

        As well as the following Error:
        “Error: uncaught exception: [Exception... "Security Manager vetoed action" nsresult: "0x80570027 (NS_ERROR_XPC_SECURITY_MANAGER_VETO)" location: "JS frame :: https://music.google.com/music/listen?u=0#NZCA%252FLINES%20-%20Tbc_al :: anonymous :: line 0" data: no]”

        Does that mean anything to you? Thanks so much!

      • Chris Says:

        I forgot to mention that I’m viewing on my work computer. Does that error message mean that something in the administrator settings is probably blocking the plugin from working? I didn’t think about this until now because it used to work just fine at work but maybe security settings have changed.

      • Daniel Slaughter Says:

        That error appears to be happening because of a bug in a recent update to Greasemonkey. You may want to try and install an older version of Greasemonkey (such as 0.9.12) and see if that fixes it:
        https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/versions/

      • Chris Says:

        Hey Daniel – I uninstalled 0.9.15, installed greasemonkey 0.9.12 but am still getting the same messages and errors:

        http://www.danielslaughter.com : server does not support RFC 5746, see CVE-2009-3555

        Error: uncaught exception: [Exception... "Security Manager vetoed action" nsresult: "0x80570027 (NS_ERROR_XPC_SECURITY_MANAGER_VETO)" location: "JS frame :: https://music.google.com/music/listen?u=0#start_pl :: anonymous :: line 0" data: no]

        Should I try a lower version of Greasemonkey?

      • Daniel Slaughter Says:

        Greasemonkey 0.9.12 may have been the version which previously had issues, I cannot remember. Try out 0.9.11 and if that doesn’t fix it I’m not sure if there is any other solution but to upgrade to the newest version of Firefox 10.0 if your work will let you. I looked into this in the past and sadly I couldn’t find a solution. Please do let me know what you find out.

      • Chris Says:

        Still nothing, so I’ll just have IT upgrade my browser. Thanks so much for all your help!

  • TA_Kosice Says:

    Hi, good work.
    But I have problem sometimes with scrobbling – it happens only when I am listening to playlist. Some of playlist tracks are not scrobbled. For example, 2nd, 5th, 7th and so on or 3rd, 5th, 8th are not displayed on last.fm. I don’t know why. I have tried to reinstall script, also reauthentificate, but it still happens sometimes. Do you know where can problem be? I use Chrome.

    • Daniel Slaughter Says:

      Are the tracks that are not being scrobbled less than 30 seconds long? Last.fm will not allow those tracks to be scrobbled as described in their API terms of service.

      • TA_Kosice Says:

        yes, they are longer. It happens sometimes – in this case Friendscrobbler says that I am not listening to any song, although I am. After start of another song it works well. And then after one, two or more songs again fault.

      • Daniel Slaughter Says:

        There are a few things I need to re-write in the scrobbling code which will possibly fix the bug you’re seeing. I wont be able to get to this for a couple weeks, but when I do I’ll let you know.

  • CJ Says:

    Great Script! Any chance of libre.fm support?

    • Daniel Slaughter Says:

      At this time I have not planned on adding libre.fm support, however you are the second person to request it. I’ll add this to my list of possible future scripts and will let you know if I ever do create it. :)

  • Jonathan Says:

    I like the extension a lot; when it works. I keep getting songs skipped while scrobbling. I’ve tried both the chrome and the firefox version. If I’m listening to all the albums of Artist A, at least 1 in every 10 to 15 songs will be skipped (sometimes more, sometimes less) and won’t be scrobbled. Which forces me to go and check what songs were played and which were scrobbled. (which makes me not want to use google music). I can’t seem to find any particular reason why they are being skipped. If I go back and play those songs again they scrobble fine. Feel free to email me with questions or information you need to help diagnosis the issue. I can try and take screenshots of it happening. If that would help.

    • Daniel Slaughter Says:

      There is only one thing I can think of which may cause this problem. Are the songs which are not getting scrobbled less than 30 seconds long? Last.fm requires all songs be longer than 30 seconds, otherwise it will not scrobble them.

  • itsnoel Says:

    Hey, nice work Daniel… you need a +1 for this page ;)

  • Scott Says:

    Hi,

    Thanks for this awesome extension!

    What I think would be a great idea would be the option to share on Google+/Twitter your #NowPlaying status so you could have it post to your configured accounts what you are listening to when you hit the ‘share’ button

    Or something to post to your Google+ stream like the last three songs scrobbled in the past fifteen minutes or so?

    Thanks.

  • marisa Says:

    hi daniel,

    thanks for your awesome script!

    i’m having a problem with double-scrobbling as well. it’s happening for tracks both under and over 04:00. i’m using chrome on OSX.

    • Daniel Slaughter Says:

      The most common issue with double scrobbling is if you have the same script installed twice (usually different/older versions) or another script which does the same thing. To fix this you will need to go to “Window > Extensions” and then disable one of the scripts installed. For instance, you may have a script written by Adam Pash called “Music Plus for Google Music” which includes my script, as well as the stand-alone version of my script. Having both of these two scripts installed will cause conflicts and may cause the double scrobbling you are seeing. If however this is not the problem please do let me know.

Leave a Reply