From a1e0ca9c88dacf51bd208b7cc6e49f3f5d05ebef Mon Sep 17 00:00:00 2001 From: Ian Walker Date: Mon, 15 Jun 2015 22:13:48 +0900 Subject: [PATCH] Added itunes status command --- plugins/osx/osx.plugin.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index a6e3a83e6..e407404a6 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -161,6 +161,16 @@ function itunes() { vol) opt="set sound volume to $1" #$1 Due to the shift ;; + status) + its_status=`osascript -e 'tell application "iTunes" to player state as string'` + echo "iTunes is currently $its_status" + if [ "$its_status" = "playing" ]; then + artist=`osascript -e 'tell application "iTunes" to artist of current track as string'` + track=`osascript -e 'tell application "iTunes" to name of current track as string'` + echo "Current track: $artist / $track"; + fi + return 0 + ;; shuf|shuff|shuffle) # The shuffle property of current playlist can't be changed in iTunes 12, # so this workaround uses AppleScript to simulate user input instead.