DR3WH0.png DR3WH0

Time Travel & Other Anomalies


    Ruby script for loading the free Last.Fm web radio service from the command line, tweeting recently listened tracks, and generating a Markdown formatted radio station blog post for a Jekyll site.


  • Load & auto-resume free Last.fm web radio from the command line
  • Tweet tracks and free MP3 downloads to Twitter timeline
  • Generate a Markdown formatted radio station blog post for Jekyll


Install Instructions

  1. Set up a ‘lastfm’ profile with the Firefox Profile Manager.
  2. Create a Last.fm API key and add it to the _config.yml for your Jekyll site along with your Last.fm username. (You may use my key for testing purposes.)
  3. Authenticate Twurl with a Twitter API Key. You will need to set up a Twitter Dev Application for your account and enable it to ‘Read & Write.’ Stack Overflow has a walk-through.
  4. Place _radioblog.rb in the root directory of your Jekyll site.
  5. Run ruby _radioblog.rb.
  6. Push the radio station post to your site with git after the station has ended.

Possible Modifications

This software is tailored for my personal use and may require modification beyond what is described here.

I’ve installed the SCM Music Player on DR3WH0.NET, and I added some code to write free download tracks to _config.yml for automatic playlist updates. You may want to remove these lines in the free_download function if you have no use for that feature. If want to use the SCM playlist feature on your site, see SCM Music Player for GitHub Pages for installation instructions.

The track tweets are not really necessary, although it takes a bit of doing to remove them. I may create NoTweet branch if there’s any interest. To stop the tweets, skip step 3 of the Install Instructions and remove the following functions: format_hash & get_tags. Then remove the lines of code here, here, here, here, here, here, here, here, here, here, and here. Whew! Almost done. Finally, remove the variables hashtags, tweet, tcolen, here and @hashtags, tweet, tcolen, here and the variable (#{textlen}) here. Let me know if there’s anything I missed or if there’s a way to rubify the code to make it more modular.

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