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.
- Ruby 1.9.2 or higher
- selenium-webdriver gem
- Firefox and a profile called ‘lastfm’
Firefox Profile Manager:
- Create your ‘lastfm’ Firefox profile with the Profile Manager.
- 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.
- 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.
- After setting up the ‘lastfm’ profile, quit Firefox and switch back to the default profile with the Profile Manager.
- Run the lastfm-autoresume.rb script. Place the script in your home folder or somewhere on your path for easiest use.
- Enter the name of the station you want to listen to. This can be an Artist, Tag, or Track name.
- 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.