Created
March 20, 2010 14:49
-
-
Save jberkel/338705 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ruby | |
| # | |
| require 'rubygems' | |
| require 'open-uri' | |
| require 'nokogiri' | |
| require 'ruby-growl' | |
| already_notified = [] | |
| while true do | |
| doc = Nokogiri::HTML(open('http://www.bln.fm/feed/podcast/songinfo-alx.html')) | |
| artist = doc.css('div#homeDisplayArtist').first | |
| track = doc.css('div#homeSongTitle').first | |
| current = { :artist=> artist && artist.content, :track => track && track.content } | |
| unless already_notified.include?(current) | |
| already_notified << current | |
| g = Growl.new("127.0.0.1", "ruby-growl", ["ruby-growl Notification"]) | |
| g.notify("ruby-growl Notification", "bln.fm", "#{current[:artist]} - #{current[:track]}") | |
| end | |
| sleep 10 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment