Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Play any song in your iTunes library from the CLI
#!/usr/bin/env osascript -l JavaScript
function run(argv) {
if(argv.length == 0) {
console.log('Usage: play [ track ]');
} else {
Application('iTunes').playlists[0].tracks.whose({ name: { _contains: argv.join(' ') } })[0].play();
}
ObjC.import("stdlib")
$.exit(0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.