Scripting Magic
It’s amazing how much can be achieved with the help of a few scripts. If you come to think of it, scripts are the original mashups that Web 2.0 has venerated in recent times.
Today, I decided that I would have a “Now Listening” box shown on my blog — I’m not sure if it is visible at this moment — which would display the name of the artist of the currently playing track on my computer. So here’s what I came up with -
- A Bash script that would use DCOP to query Amarok, determine the currently playing song, and update a temporary file accordingly.
- A small PHP script that would read the file and display this information, but only if it is available.
- A set of CSS rules to format the generated XHTML.
- A cron job to execute the script every minute.
Voila! It’s done…almost like magic.
