Bash script to retrieve info about current playing track on ARM.FM

I am a big fan of ARM.FM.
Their playlist contains the freshest tracks in the dance music.
I wanted to keep track of the tunes I like the most, so I made a little script to update a file on my desktop with the name of the track currently playing.
Here is the script, you may use and/or modify it as you please.

#!/bin/bash
 
## arm_fm.sh 1.0
## Keep track of the best tracks playing on http://armageddonfm.net/
## It creates the file 'tracks' on your desktop
##
## Also, the file _output.html can be used on your site
## to display last 3 tracks played on ARM FM
 
 
curl -s http://armageddonfm.net/ -o _arm.txt
start_line=`grep -n 'current' _arm.txt | cut -f1 -d':'`
html_tag='
<table align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td valign="top">
 
      <div style="width: 250px; margin: 20px 0px 0px 0px;">
        <div style="margin: 10px 0px 0px 0px;">
          <table cellspacing="0">
                                          <tr>
              <td style="padding: 10px;"></td>
'
echo $html_tag > _output.html
sed -n "$start_line,81p" _arm.txt >> _output.html
 
sed -i -e 's/<img src="\/tpl\/images\/dot.jpg">//g' _output.html
 
sed -n '2,2p' _output.html > _temp
sed -i -e 's/              <td valign="top" style="border: 1px solid #ccc; border-top: 0px; border-right: 0px; padding: 10px; font-size: 11px; color: #444"><b><font style="color: #900">//g' _temp
sed -i -e 's/<\/font><\/b><br> //g' _temp
sed -i -e 's/<br><\/td>//g' _temp
sed -i -e 's/  (current)/ - /g' _temp
 
artist=`cut -f1 -d '-' _temp`
track=`cut -f2 -d '-' _temp | sed 's/^ *//'`
 
echo $artist - $track >> $HOME/Desktop/tracks
rm _output.html _arm.txt _temp

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close