Added script to ping me when a new mfp track is released
This commit is contained in:
parent
4fa28ac636
commit
3da5e4073c
|
@ -0,0 +1,20 @@
|
|||
require 'rss'
|
||||
require 'open-uri'
|
||||
|
||||
latestFile = "latest.txt"
|
||||
|
||||
latest = File.open(latestFile, "r").read if File::exists?(latestFile)
|
||||
url = 'http://www.musicforprogramming.net/rss.php'
|
||||
open(url) do |rss|
|
||||
feed = RSS::Parser.parse(rss)
|
||||
# puts "Title: #{feed.channel.title}"
|
||||
# puts "Comparing latest with feed"
|
||||
# puts "#{latest} -- #{feed.items[0].title}"
|
||||
|
||||
if latest != feed.items[0].title then
|
||||
puts "Item #{feed.items[0].title} -- #{feed.items[0].guid}"
|
||||
File.open(latestFile, 'w') do |file|
|
||||
file.write(feed.items[0].title)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue