Skip to content

Instantly share code, notes, and snippets.

@jberkel
Created March 20, 2010 14:49
Show Gist options
  • Select an option

  • Save jberkel/338705 to your computer and use it in GitHub Desktop.

Select an option

Save jberkel/338705 to your computer and use it in GitHub Desktop.
#!/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