Skip to content

Instantly share code, notes, and snippets.

@nbqx
Created October 16, 2011 04:18
Show Gist options
  • Select an option

  • Save nbqx/1290503 to your computer and use it in GitHub Desktop.

Select an option

Save nbqx/1290503 to your computer and use it in GitHub Desktop.
itunes.rb
# -*- coding: utf-8 -*-
require 'rbosa' ##gem install rubyosa or rubyosa19
def playing
OSA.utf8_strings = true
itunes = OSA.app('iTunes')
if itunes.player_state == OSA::ITunes::EPLS::PLAYING
track = itunes.current_track
" ♪ "+track.artist.force_encoding("utf-8") + " - " + track.name.force_encoding("utf-8")
else
""
end
end
Earthquake.init do
command %r|^:itunes\s+(.+)$|, :as => :itunes do |m|
t = playing
input(":update #{m[1]}#{t}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment