dotfiles/spotify.applescript
2024-02-06 08:44:48 +01:00

21 lines
671 B
AppleScript
Executable file

#!/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
if artist_name > 0
# If the track has an artist set and is therefore most likely a song rather than an advert
" ♫ " & artist_name & " - " & track_name
else
# If the track doesn't have an artist set and is therefore most likely an advert rather than a song
" ~ " & track_name
end if
else
" ⏸︎ Spotify is paused"
end if
end if
end tell