Skip to content

Instantly share code, notes, and snippets.

@pdxmph
Created October 14, 2013 02:29
Show Gist options
  • Save pdxmph/6969791 to your computer and use it in GitHub Desktop.
Save pdxmph/6969791 to your computer and use it in GitHub Desktop.
Get the current 'net radio track info from iTunes, make it a todo in Things
#!/usr/bin/env ruby
require "rubygems"
require "appscript"
include Appscript
itunes = app("iTunes")
things = app("Things")
list = "Things to Look Up"
project = things.projects[list]
todos = things.to_dos
track = itunes.current_stream_title.get
url = itunes.current_stream_URL.get
source = itunes.current_track.name.get
unless todos[its.name.eq(track)].get.length > 0
task = things.make(:at => project.beginning, :new => :to_do, :with_properties => {
:name => track,
:tag_names => "music,#{source}",
:notes => "Heard on [url=#{url}]#{source}[/url] at #{Time.now}"
})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment