The script will return the currently playing track(s) in iTunes and / or Spotify in the format: song by artist (e.g. Juanita Kiteless To Dream Of Love by Underworld).
osascript path/to/currentlyPlaying.scpt osascript path/to/currentlyPlaying.scpt /path/to/my/image.tiff
In the rare case that both iTunes as well as Spotify will be playing (for example iTunes is streaming to an Airport Express while Spotify is playing locally) the output will be multiline:
song by artist (Spotify) song by artist (iTunes)
When nothing is playing, or when the players are paused, an empty string will be returned.
In addition to returning information on the currently playing track, the script will also store the album artwork in a file. By default this is ~/albumArt.tiff, but by specifying an argument you are able to change this default path.
When nothing is playing, or a track does not have any artwork associated to it, the album artwork wil be set to a 1x1 transparent pixel.
The script is optimized to only update the artwork when the track has changed. To accomplish this it uses a temporary cache file in /tmp/albumArt.txt which contains the id of the current track or the player state.
Skype Mood Message
In addition, by default the script will update your skype's mood message (if it is running) with the song information:
It is possible to disable this by changing the configuration flag
useSkype to false. To do so, open
currentlyPlaying.scpt in the AppleScript editor (from terminal:
open currentlyPlaying.scpt), change
false and save the script.
This script is particularly useful when combined and used with Geektool. You could create a script 'geeklet', executing the curentlyPlaying script every 10 seconds to print the currently playing track(s):
You could then create an image 'geeklet', reading the image file from ~/albumArt.tiff (or: /Users/yourname/albumArt.tiff) every 10 seconds.
You can tweak the time, but at the moment I don't see any performance issues with the 10 second interval and the updates seem quite responsive to the changing of the tracks as it now only has a 10 second delay (at max).
Copyright 2011 Jeroen Wesbeek
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.