This simple ruby script parse http://www.metalstorm.ee/ and create ical file with new and upcoming releases.
You can find it here.
If you want to see it in action, click here.
Because of hosting problem, script is unavailable, but check new version here.
Here is whole cgi script:
'rubygems'
require 'net/http'
require 'cgi'
require
"Content-Type: text/plain"
puts
puts
"BEGIN:VCALENDAR"
puts "VERSION:2.0"
puts "PRODID:-//hacksw/handcal//NONSGML v1.0//EN"
puts "X-WR-CALNAME:Metal Storm Releases"
puts "X-WR-CALDESC:New and Upcomming Music Metal Releases taken from http://www.metalstorm.ee. Made by FaziBear."
>puts Net::HTTP.get_response( URI.parse('http://www.metalstorm.ee/events/new_releases.php'))
new = Net::HTTP.get_response( URI.parse('http://www.metalstorm.ee/events/new_releases.php?upcoming=1'))
upc =
""
text =
text << new.body
text << upc.body
0;
year =
/<span class=title>.*?(\d\d\d\d).*?<\/span><br>|<br><span class=dark>(\d\d).(\d\d).*?<\/span><a href=#(.*?)>(.*?)<\/a>/i) do |is_year, day,month, id ,desc|
text.scan(if (! is_year.nil?) then<
#puts "|#{is_year}|#{day}|#{month}|#{id}|#{desc}"
year = is_yearelse
"BEGIN:VEVENT"
puts "DTSTART:#{year}#{month}#{day}"
puts "DTEND:#{year}#{month}#{day}"
puts "SUMMARY:#{CGI::unescapeHTML(desc)}"
puts "URL:http://www.metalstorm.ee/events/new_releases.php##{id}"
puts "END:VEVENT"
puts end
end
"END:VCALENDAR" puts