Posted By

pdxmph on 07/13/10


Tagged

ruby itunes Appscript


Versions (?)

Make a Things Todo Out of the Current iTunes Net Radio Track


 / Published in: Ruby
 

  1. #!/usr/bin/env ruby
  2.  
  3. require "rubygems"
  4. require "appscript"
  5. include Appscript
  6.  
  7. itunes = app("iTunes")
  8. things = app("Things")
  9. list = "Things to Look Up"
  10. project = things.projects[list]
  11. todos = things.to_dos
  12.  
  13. track = itunes.current_stream_title.get
  14. url = itunes.current_stream_URL.get
  15. source = itunes.current_track.name.get
  16.  
  17.  
  18. unless todos[its.name.eq(track)].get.length > 0
  19.  
  20. task = things.make(:at => project.beginning, :new => :to_do, :with_properties => {
  21. :name => track,
  22. :tag_names => "music,#{source}",
  23. :notes => "Heard at [url=#{url}]#{source}[/url]"
  24. })
  25. end
  26.  

Report this snippet  

You need to login to post a comment.