Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
AppleScript which outputs the information and album art of the current track in iTunes / Spotify
AppleScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
LICENSE
README.md
currentlyPlaying.applescript
currentlyPlaying.scpt
geektool example.png

README.md

currentlyPlaying

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).

Usage

    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:

skype

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 useSkype from true to false and save the script.

Geek Tool

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):

    osascript path/to/currentlyPlaying.scpt

screenshot

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).

desktop

Copyright

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

   http://www.apache.org/licenses/LICENSE-2.0

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.

Something went wrong with that request. Please try again.