Skip to content

Instantly share code, notes, and snippets.

@mikz
Created November 3, 2011 22:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikz/1337933 to your computer and use it in GitHub Desktop.
Save mikz/1337933 to your computer and use it in GitHub Desktop.
Rate current song in iTunes - Alfred Extension - requires macruby
read -s -r -d '' SCRIPT <<"EOF"
framework 'ScriptingBridge'
rating = ARGV.pop
itunes = SBApplication.applicationWithBundleIdentifier("com.apple.itunes")
track = itunes.currentTrack
track.rating = rating.to_f*20
puts "#{track.artist} - #{track.name} rated #{rating} stars"
EOF
/usr/bin/env macruby -e "$SCRIPT" {query}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment