Created
March 8, 2017 10:25
-
-
Save mlex/18f9c22d3cff7319303b2d84db001959 to your computer and use it in GitHub Desktop.
spotify-instana-notification.scpt
This file contains hidden or 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
| -- Post event with information about the currently playing track to instana | |
| set oldPlayingTrack to getCurrentlyPlayingTrack() | |
| repeat while true | |
| set currentlyPlayingTrack to getCurrentlyPlayingTrack() | |
| if currentlyPlayingTrack is not oldPlayingTrack then | |
| set curl_data to "{\\\"title\\\":\\\"Listening to Track\\\",\\\"text\\\":\\\"Currently playing " & currentlyPlayingTrack & "\\\",\\\"duration\\\":60,\\\"severity\\\":-1}" | |
| set curl_command to "curl -XPOST -d \"" & curl_data & "\" http://127.0.0.1:42699/com.instana.plugin.generic.event" | |
| -- display notification curl_command | |
| do shell script curl_command | |
| end if | |
| set oldPlayingTrack to currentlyPlayingTrack | |
| delay 5 | |
| end repeat | |
| on getCurrentlyPlayingTrack() | |
| tell application "Spotify" | |
| set currentArtist to artist of current track as string | |
| set currentTrack to name of current track as string | |
| return currentArtist & " - " & currentTrack | |
| end tell | |
| end getCurrentlyPlayingTrack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment