Created
August 13, 2012 21:02
-
-
Save ngopal/3344086 to your computer and use it in GitHub Desktop.
Setup your mac to use Spotify as your alarm clock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In order to use this script, you must replace 'YOURUSERNAMEHERE' with your Spotify username. | |
# Execute this script like so: 'osascript alarm_clock_spotify.scpt' (without single-quotes obviously) | |
# Full explanation here: http://www.nikhilgopal.com/2011/08/show-and-tell-applescript-spotify-alarm.html | |
# If you would like to specify a playlist, please refer to this gist: https://gist.github.com/3344118 | |
set volume 2 | |
open location "spotify:user:YOURUSERNAMEHERE:playlist:muzic" | |
tell application "Spotify" | |
set the sound volume to 0 | |
play | |
repeat 10 times | |
if sound volume is less than 80 then | |
set sound volume to (sound volume + 10) | |
delay 3 | |
end if | |
end repeat | |
end tell |
Open a terminal window and type EDITOR=nano crontab -e
to enter cron editor.
Then add this line of code 55 6 * * * osascript /path-to-file/alarm_clock_spotify.scpt
Click ctrl+x to exit, then click y to save. It should run automatically at this time now
The numbers 55 refer to the minute it will run, and the number 6 refers to the hour it will be run. Change these however you would like.
If you want to learn more about cron and how to set the time, there is a good guide here
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First, big kudos for the explanation!
I try setting it up right now, but on your website (https://nikhilgopal.com/2011/08/03/show-and-tell-applescript-a-spotify-alarm-clock-on-mac/) I cannot see the pic with the code for the VI editor. Could you post the code line here?