Created
July 7, 2015 01:14
-
-
Save wtfaremyinitials/140f28be294b5e8bd2d1 to your computer and use it in GitHub Desktop.
Play any song in your iTunes library from the CLI
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
#!/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