Added script to ping me when a new mfp track is released

This commit is contained in:
Russell 2018-02-28 21:15:06 +00:00
parent 4fa28ac636
commit 3da5e4073c
1 changed files with 20 additions and 0 deletions

View File

@ -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