Last active
November 28, 2016 14:32
-
-
Save aleksgapp/493b7fb0872b7ff12cf75951261f172e to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env osascript | |
# Returns the current playing song in Spotify for OSX | |
tell application "Spotify" | |
if it is running then | |
if player state is playing then | |
set track_name to name of current track | |
set artist_name to artist of current track | |
set curVolume to get volume settings | |
if artist_name > 0 | |
# If the track has an artist set it is most likely a song rather than an advert | |
if output muted of curVolume is true then | |
set volume without output muted | |
end if | |
"♫ " & artist_name & " - " & track_name | |
else | |
# If the track doesn't have an artist set it is most likely an advert rather than a song | |
if output muted of curVolume is false then | |
set volume with output muted | |
end if | |
"~ " & track_name | |
end if | |
end if | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment