7 use HTML5TV::hCalendar;
10 use HTML::ResolveLink;
12 my $url = 'http://html5tv.rot13.org';
15 <style type="text/css">
18 . read_file('www/css/hCalendar.css')
28 my $html = qq|<!DOCTYPE html>
32 <meta charset="utf-8" />
34 <link rel="alternate" type="application/rss+xml" title="RSS" href="calendar.xml">
36 <link rel="icon" type="image/png" href="media/favicon.png">
38 <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
40 <script src="js/jqueryhcal/jqueryhcal.js" type="text/javascript"></script>
41 <link rel="stylesheet" type="text/css" href="js/jqueryhcal/jqueryhcal.css" />
43 <link rel="stylesheet" type="text/css" href="css/hCalendar.css" />
47 <title>HTML5TV all media available</title>
53 <div id="jhCalendar"></div>
58 my $feed = XML::FeedPP::RSS->new;
59 $feed->title( 'HTML5TV' );
62 my $resolver = HTML::ResolveLink->new( base => $url );
64 foreach my $path ( glob 'media/*/hCalendar.html' ) {
65 next if $path =~ m{_editing};
68 my $hcal = HTML5TV::hCalendar->new( $path );
70 my $media = (split(/\//, $path))[1];
72 if ( ! -e "www/$media.html" ) {
73 warn "NO www/$media.html $!";
77 my $html = $hcal->as_HTML(
78 [ 'span', { class => 'watch' },
79 [ 'a', { href => "$media.html", title => $media, },
80 [ 'img', { src => 'media/favicon.png', border => 0 } ],
85 $vevents->{ $hcal->dtstart_iso . $media } = $html;
87 my $pubDate = $hcal->dtstart_iso;
88 $pubDate =~ s{^(\d\d\d\d)(\d\d)(\d\d).*$}{$1-$2-$3};
90 my $item = $feed->add_item( "$url/$media.html" );
91 $item->title( $hcal->summary );
92 $item->pubDate( $pubDate );
93 $item->description( $resolver->resolve( $html ) );
96 $feed->to_file( 'www/calendar.xml' );
98 $html .= join("\n", map { $vevents->{$_} } sort keys %$vevents );
102 <a href="calendar.xml">rss</a>
109 write_file 'www/calendar.html', $html;