Earlier this week, I wrote a tiny little app, which tweets my favorite music. You can read more about the concept here. This is a technical post to explain how you can leverage this app for your own enjoyment.
First, you will need to download the code. Then you will need to obtain the following items:
- A twitter account
- A last.fm account with API key
- A bit.ly account and API Key
- PHP 5.2+ Cli
- An Internet connection
Once you have obtained these items, you will need a computer that is always plugged into the internet or a web server where you can run cron jobs. I am running the script on this server.
Open the track_lover.php file, which you should have gotten from here, and update the following lines, replacing ‘xxx’ with real values:
// TWITTER define("TWITTER_USERNAME", "xxx"); define("TWITTER_PASSWORD", "xxx"); // last.fm define("LASTFM_USER", "xxx"); define("LASTFM_API", "xxx"); // bit.ly via j.mp define("BITLY_USER", "xxx"); define("BITLY_API", "xxx");
Once you save the file, you will be all set to turn on The cron job entry may look as follows
# run every two minutes */2 * * * * /usr/local/bin/php /path/to/the/script/trackLover/track_lover.php > /dev/null 2>&1
That’s it, you should be up and running tweeting your favorite tracks. Enjoy!