DR3WH0.png DR3WH0

Time Travel & Other Anomalies

LastFm AutoResume (Part 2)

    Instructions for auto-resuming the free Last.fm Web service with Ruby and Firefox.

In a previous post, I outlined a rough method for auto-resuming the free Last.fm Web service. Today I wrote a more robust auto-resume solution with Ruby and Selenium-WebDriver. This was developed on a Ubuntu 10.04 box. Your mileage with other systems may vary.


Command Line

Firefox Profile Manager:

firefox -P

LastFm AutoResume:

ruby lastfm-autoresume.rb


  1. Create your ‘lastfm’ Firefox profile with the Profile Manager.
  2. For best results with the new profile, install the Adblock Plus add-on, hide all toolbars, and deselect ‘Always show the tab bar’ in Preferences > Tabs.
  3. If you want to scrobble to an existing Last.fm account, log in to Last.fm in the new ‘lastfm’ profile, remain logged in (i.e. don’t click the Logout link), and be sure to select ‘Play music in-page’ in the Website Settings.
  4. After setting up the ‘lastfm’ profile, quit Firefox and switch back to the default profile with the Profile Manager.
  5. Run the lastfm-autoresume.rb script. Place the script in your home folder or somewhere on your path for easiest use.
  6. Enter the name of the station you want to listen to. This can be an Artist, Tag, or Track name.
  7. Enter ‘quit’ when you want to end the AutoResume script. Last.fm will continue to play in the browser.

Update (2013-08-23): There is a “we collect data” privacy nag that shows up in Firefox until you dismiss it, including for each new profile. Be sure to dismiss that dialog by clicking the CHOOSE button with the ‘lastfm’ profile loaded in the Profile Manager. Otherwise it will appear every time you run LastFm AutoResume.

Update (2013-08-30): I built on this application to produce lastfm-autotweet, which also posts listened tracks to Twitter.

Saturday, August 17, 2013 Creative Commons License
This post is licensed under a Creative Commons Attribution 3.0 Unported License.