iTunes current track name and album on your OSX MenuBar.

Track a name and album of what is currently played through your speakers!

Posted by Gediminas Siutilas on December 29, 2014

Preface

This script will show you a current track which is played underlining the name and the album or your current playable track.

Credits for an idea goes to Patron!

Current track name and album

Thanks to osascript it's very easy to extract the name, album and other information about the track which currently played through iTunes. Take a look for a script bellow.

In case nothing is played an according icon will be shown.

* If you downloaded ShellWrangler app this scripts will be packed along with the downloaded application.

Script:

Download
#!/bin/bash

#   ____ __        __ __ _      __                       __         
#  / __// /  ___  / // /| | /| / /____ ___ _ ___  ___ _ / /___  ____
# _\ \ / _ \/ -_)/ // / | |/ |/ // __// _ `// _ \/ _ `// // -_)/ __/
#/___//_//_/\__//_//_/  |__/|__//_/   \_,_//_//_/\_, //_/ \__//_/   
#                                               /___/               
#    _ ______                  ____        
#   (_)_  __/_ _____  ___ ___ / __/__ _____
#  / / / / / // / _ \/ -_|_- / _// _ `/ __/
# /_/ /_/  \_ _/_//_/\__/___/___/\_ _/_/   
# Script author: gadominas@gmail.com   
#
#$$${ Current iTunes track name, album on your MenuBar }
                                                                                  
currentTrack() {	
	currenTrack=$(osascript -e 'tell application "iTunes" to if player state is playing then "" & name of current track & " 🔸 " & artist of current track' )

	if [ ! -z "$currenTrack" -a "$currenTrack"!=" " ];
		then {
			printf "🔊|$currenTrack"			
		} else
			printf "🔇"
	fi	
}

run() {
	currentTrack
}

run