Skip to content

Instantly share code, notes, and snippets.

@mattimatti
Forked from alisonailea/AwakenSpotify.scpt
Created July 19, 2018 13:43
Show Gist options
  • Select an option

  • Save mattimatti/ed353eabd9a2c2342e3783e99bebfa70 to your computer and use it in GitHub Desktop.

Select an option

Save mattimatti/ed353eabd9a2c2342e3783e99bebfa70 to your computer and use it in GitHub Desktop.

Revisions

  1. @alisonailea alisonailea revised this gist Apr 4, 2015. 4 changed files with 57 additions and 54 deletions.
    57 changes: 57 additions & 0 deletions AwakenSpotify.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    --current time in seconds since midnight
    set currentTime to (time of (current date))

    ## Morning
    -- (04:00 - 10:30)
    set morning to 37800
    set morningVolume to 80
    -- Happy: Wake Up in a Good Mood
    set morningTrack to "spotify:user:116779154:playlist:5sYrf2RnhPY22meUSS5fUu"

    ## Afternoon
    -- (10:30 - 16:30)
    set afternoon to 54800
    set afternoonVolume to 80
    -- Totally Stress Free
    set afternoonTrack to "spotify:user:spotify:playlist:7jq9hVhkNUyFLN1XivhLvK"

    ## Evening
    -- (16:30 - 22:00)
    set evening to 79200
    set eveningVolume to 60
    -- Evening Chill
    set eveningTrack to "spotify:user:spotify:playlist:0eDq2STmk8tKcD7qWCwrze"

    ## Night
    -- (22:00 - 04:00)
    set night to 14400
    set nightVolume to 50
    -- Sleep Tight
    set nightTrack to "spotify:user:spotify:playlist:1YRQAGw7qVJCLxWFGDsS3l"
    set scriptVolume to null
    set scriptTrack to null


    if currentTime is less than night and currentTime is greater than 0 then
    set scriptVolume to nightVolume
    set scriptTrack to nightTrack
    else if currentTime is less than morning and currentTime is greater than night then
    set scriptVolume to morningVolume
    set scriptTrack to morningTrack
    else if currentTime is less than afternoon and currentTime is greater than morning then
    set scriptVolume to afternoonVolume
    set scriptTrack to afternoonTrack
    else if currentTime is less than evening and currentTime is greater than afternoon then
    set scriptVolume to eveningVolume
    set scriptTrack to eveningTrack
    else
    set scriptVolume to nightVolume
    set scriptTrack to nightTrack
    end if

    tell application "Spotify"
    launch
    delay 3
    set sound volume to (scriptVolume)
    play track scriptTrack
    end tell
    16 changes: 0 additions & 16 deletions assignValues.scpt
    Original file line number Diff line number Diff line change
    @@ -1,16 +0,0 @@
    if currentTime is less than night and currentTime is greater than 0 then
    set scriptVolume to nightVolume
    set scriptTrack to nightTrack
    else if currentTime is less than morning and currentTime is greater than night then
    set scriptVolume to morningVolume
    set scriptTrack to morningTrack
    else if currentTime is less than afternoon and currentTime is greater than morning then
    set scriptVolume to afternoonVolume
    set scriptTrack to afternoonTrack
    else if currentTime is less than evening and currentTime is greater than afternoon then
    set scriptVolume to eveningVolume
    set scriptTrack to eveningTrack
    else
    set scriptVolume to nightVolume
    set scriptTrack to nightTrack
    end if
    6 changes: 0 additions & 6 deletions tellSpotify.scpt
    Original file line number Diff line number Diff line change
    @@ -1,6 +0,0 @@
    tell application "Spotify"
    launch
    delay 3
    set sound volume to (scriptVolume)
    play track scriptTrack
    end tell
    32 changes: 0 additions & 32 deletions variables.scpt
    Original file line number Diff line number Diff line change
    @@ -1,32 +0,0 @@
    --current time in seconds since midnight
    set currentTime to (time of (current date))

    ## Morning
    -- (04:00 - 10:30)
    set morning to 37800
    set morningVolume to 80
    -- Happy: Wake Up in a Good Mood
    set morningTrack to "spotify:user:116779154:playlist:5sYrf2RnhPY22meUSS5fUu"

    ## Afternoon
    -- (10:30 - 16:30)
    set afternoon to 54800
    set afternoonVolume to 80
    -- Totally Stress Free
    set afternoonTrack to "spotify:user:spotify:playlist:7jq9hVhkNUyFLN1XivhLvK"

    ## Evening
    -- (16:30 - 22:00)
    set evening to 79200
    set eveningVolume to 60
    -- Evening Chill
    set eveningTrack to "spotify:user:spotify:playlist:0eDq2STmk8tKcD7qWCwrze"

    ## Night
    -- (22:00 - 04:00)
    set night to 14400
    set nightVolume to 50
    -- Sleep Tight
    set nightTrack to "spotify:user:spotify:playlist:1YRQAGw7qVJCLxWFGDsS3l"
    set scriptVolume to null
    set scriptTrack to null
  2. @alisonailea alisonailea revised this gist Apr 4, 2015. 4 changed files with 54 additions and 56 deletions.
    16 changes: 16 additions & 0 deletions assignValues.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    if currentTime is less than night and currentTime is greater than 0 then
    set scriptVolume to nightVolume
    set scriptTrack to nightTrack
    else if currentTime is less than morning and currentTime is greater than night then
    set scriptVolume to morningVolume
    set scriptTrack to morningTrack
    else if currentTime is less than afternoon and currentTime is greater than morning then
    set scriptVolume to afternoonVolume
    set scriptTrack to afternoonTrack
    else if currentTime is less than evening and currentTime is greater than afternoon then
    set scriptVolume to eveningVolume
    set scriptTrack to eveningTrack
    else
    set scriptVolume to nightVolume
    set scriptTrack to nightTrack
    end if
    56 changes: 0 additions & 56 deletions launchSpotify
    Original file line number Diff line number Diff line change
    @@ -1,56 +0,0 @@
    --current time in seconds since midnight
    set currentTime to (time of (current date))

    ## Morning
    -- (04:00 - 10:30)
    set morning to 37800
    set morningVolume to 80
    -- Happy: Wake Up in a Good Mood
    set morningTrack to "spotify:user:116779154:playlist:5sYrf2RnhPY22meUSS5fUu"

    ## Afternoon
    -- (10:30 - 16:30)
    set afternoon to 54800
    set afternoonVolume to 80
    -- Totally Stress Free
    set afternoonTrack to "spotify:user:spotify:playlist:7jq9hVhkNUyFLN1XivhLvK"

    ## Evening
    -- (16:30 - 22:00)
    set evening to 79200
    set eveningVolume to 60
    -- Evening Chill
    set eveningTrack to "spotify:user:spotify:playlist:0eDq2STmk8tKcD7qWCwrze"

    ## Night
    -- (22:00 - 04:00)
    set night to 14400
    set nightVolume to 50
    -- Sleep Tight
    set nightTrack to "spotify:user:spotify:playlist:1YRQAGw7qVJCLxWFGDsS3l"
    set scriptVolume to null
    set scriptTrack to null

    if currentTime is less than night and currentTime is greater than 0 then
    set scriptVolume to nightVolume
    set scriptTrack to nightTrack
    else if currentTime is less than morning and currentTime is greater than night then
    set scriptVolume to morningVolume
    set scriptTrack to morningTrack
    else if currentTime is less than afternoon and currentTime is greater than morning then
    set scriptVolume to afternoonVolume
    set scriptTrack to afternoonTrack
    else if currentTime is less than evening and currentTime is greater than afternoon then
    set scriptVolume to eveningVolume
    set scriptTrack to eveningTrack
    else
    set scriptVolume to nightVolume
    set scriptTrack to nightTrack
    end if

    tell application "Spotify"
    launch
    delay 3
    set sound volume to (scriptVolume)
    play track scriptTrack
    end tell
    6 changes: 6 additions & 0 deletions tellSpotify.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    tell application "Spotify"
    launch
    delay 3
    set sound volume to (scriptVolume)
    play track scriptTrack
    end tell
    32 changes: 32 additions & 0 deletions variables.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    --current time in seconds since midnight
    set currentTime to (time of (current date))

    ## Morning
    -- (04:00 - 10:30)
    set morning to 37800
    set morningVolume to 80
    -- Happy: Wake Up in a Good Mood
    set morningTrack to "spotify:user:116779154:playlist:5sYrf2RnhPY22meUSS5fUu"

    ## Afternoon
    -- (10:30 - 16:30)
    set afternoon to 54800
    set afternoonVolume to 80
    -- Totally Stress Free
    set afternoonTrack to "spotify:user:spotify:playlist:7jq9hVhkNUyFLN1XivhLvK"

    ## Evening
    -- (16:30 - 22:00)
    set evening to 79200
    set eveningVolume to 60
    -- Evening Chill
    set eveningTrack to "spotify:user:spotify:playlist:0eDq2STmk8tKcD7qWCwrze"

    ## Night
    -- (22:00 - 04:00)
    set night to 14400
    set nightVolume to 50
    -- Sleep Tight
    set nightTrack to "spotify:user:spotify:playlist:1YRQAGw7qVJCLxWFGDsS3l"
    set scriptVolume to null
    set scriptTrack to null
  3. @alisonailea alisonailea created this gist Apr 4, 2015.
    56 changes: 56 additions & 0 deletions launchSpotify
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    --current time in seconds since midnight
    set currentTime to (time of (current date))

    ## Morning
    -- (04:00 - 10:30)
    set morning to 37800
    set morningVolume to 80
    -- Happy: Wake Up in a Good Mood
    set morningTrack to "spotify:user:116779154:playlist:5sYrf2RnhPY22meUSS5fUu"

    ## Afternoon
    -- (10:30 - 16:30)
    set afternoon to 54800
    set afternoonVolume to 80
    -- Totally Stress Free
    set afternoonTrack to "spotify:user:spotify:playlist:7jq9hVhkNUyFLN1XivhLvK"

    ## Evening
    -- (16:30 - 22:00)
    set evening to 79200
    set eveningVolume to 60
    -- Evening Chill
    set eveningTrack to "spotify:user:spotify:playlist:0eDq2STmk8tKcD7qWCwrze"

    ## Night
    -- (22:00 - 04:00)
    set night to 14400
    set nightVolume to 50
    -- Sleep Tight
    set nightTrack to "spotify:user:spotify:playlist:1YRQAGw7qVJCLxWFGDsS3l"
    set scriptVolume to null
    set scriptTrack to null

    if currentTime is less than night and currentTime is greater than 0 then
    set scriptVolume to nightVolume
    set scriptTrack to nightTrack
    else if currentTime is less than morning and currentTime is greater than night then
    set scriptVolume to morningVolume
    set scriptTrack to morningTrack
    else if currentTime is less than afternoon and currentTime is greater than morning then
    set scriptVolume to afternoonVolume
    set scriptTrack to afternoonTrack
    else if currentTime is less than evening and currentTime is greater than afternoon then
    set scriptVolume to eveningVolume
    set scriptTrack to eveningTrack
    else
    set scriptVolume to nightVolume
    set scriptTrack to nightTrack
    end if

    tell application "Spotify"
    launch
    delay 3
    set sound volume to (scriptVolume)
    play track scriptTrack
    end tell