Save to a file wherever it please you (I saved it to ~/scripts/apod.sh)
Maybe make sure it is executable: chmod 755 ~/scripts/apod.sh
#!/bin/bash
# apod.sh| if application "Spotify" is running and application "iTunes" is not running then | |
| tell application "Spotify" | |
| if player state is stopped then | |
| set display to "No Track Playing" | |
| else | |
| set track_artist to artist of current track | |
| set track_name to name of current track | |
| set track_duration to duration of current track | |
| set seconds_played to player position | |
| set state to "" |