Created
October 20, 2012 04:54
-
-
Save pboucher/3922052 to your computer and use it in GitHub Desktop.
iTunes plugin for oh-my-zsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------------------------ | |
# FILE: iTunes.plugin.zsh | |
# DESCRIPTION: oh-my-zsh plugin file to control iTunes | |
# AUTHOR: Patrick Boucher (pboucher@patrickboucher.com) | |
# VERSION: 1.0 | |
# ------------------------------------------------------------------------------ | |
function play() { | |
osascript 2>/dev/null <<EOF | |
tell application "iTunes" to play | |
EOF | |
} | |
function pause() { | |
osascript 2>/dev/null <<EOF | |
tell application "iTunes" to pause | |
EOF | |
} | |
function stop() { | |
osascript 2>/dev/null <<EOF | |
tell application "iTunes" to stop | |
EOF | |
} | |
function playlists() { | |
osascript 2>/dev/null <<EOF | |
tell application "iTunes" | |
set output to "" | |
set newLine to ASCII character 10 | |
repeat with i from 1 to count of playlists | |
set playlistName to name of playlist i | |
set output to output & i & ": " & playlistName & newLine | |
end repeat | |
copy output to stdout | |
end tell | |
EOF | |
} | |
function playlist() { | |
osascript 2>/dev/null <<EOF | |
tell application "iTunes" | |
play playlist $1 | |
end tell | |
EOF | |
} | |
function skip() { | |
osascript 2>/dev/null <<EOF | |
tell application "iTunes" | |
next track | |
end tell | |
EOF | |
} | |
alias itunes="open -a iTunes" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment