I don’t know about you guys, but I’ve really been enjoying Spotify. Being one of the first American users has been a real treat. Making the switch from iTunes wasn’t painful at all. Sorry iTunes, sometimes the best things in life are free…
A few weeks ago, I used this applescript tutorial to setup iTunes to be my morning alarm clock. I love this. Nothing makes it easier to get out of bed than waking up to a song that energizes you.
I’ve found a way to use Spotify instead of iTunes in the alarm clock script, and this post is going to be a quick show and tell. It’s not as easy as just replacing "iTunes" with "Spotify" in the iTunes alarm clock script.
I would suggest following the tutorial in the link I provided earlier, substituting the script provided for the one I provide in step 1 below. Otherwise, you can follow my attempt at a walkthrough.
- Open up spotlight and open up "AppleScript Editor." Copy the code below into your editor and save it (with an easy-to-remember name).
- Edit out my username with yours
- Edit out my playlist "muzic" with the name of your playlist
- Press the Run button to make sure it actually works.
- Update 8/13/2012: I’ve added the code in the image below to github as a gist.
- Next, pop open your terminal window and type in "crontab -e" without the quotes
- Now you will be in VI editor, so press "i" on your keyboard to "insert," and type in the following line (the one line at the bottom is all you need). Make sure the path points to the script you just made in step 1. Also note that the pound sign on the first line "comments out" the line, so that line of code is ignored.
- After you are done typing in the code, press "esc" so that a colon show up in the bottom left corner of the screen. Then type in "wq!" to save and quit the editor.
- As a note, my alarm confguration (shared in the image above) is set to wake me up at 6:01AM. I would look here to find out how to edit the cron job to awaken you at a time of your own choosing.
- Next, you have to make sure your computer is on maybe 5 minutes before your alarm goes off. This can be done in the "System Preferences" application.
- Click on the "Energy Saver" option
- You don’t have to mess with your sleep and display configuration, but you do need to click the "Schedule…" button on the bottom right hand corner
- Set your mac to wake up or start up 5 minutes before your cron job kicks off. You’re all done!