Skip to content

Instantly share code, notes, and snippets.

@j6s
Created May 7, 2014 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j6s/2cc690fd6877f1eae80c to your computer and use it in GitHub Desktop.
Save j6s/2cc690fd6877f1eae80c to your computer and use it in GitHub Desktop.
Mutes Spotify when Ads are playing
repeat
tell application "Spotify"
set cur_vol to sound volume
set trackk to track number of current track
set namme to name of current track
set pop to popularity of current track
set dur to duration of current track
set pos to player position
end tell
if pop is 0 and dur is less than 31 then
tell application "Spotify"
pause
set sound volume to 0
play
end tell
delay dur - pos + 1
tell application "Spotify"
set sound volume to cur_vol
end tell
else
if dur - pos is less than 30 then
delay dur - pos
else
delay 30
end if
end if
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment