#!/usr/bin/perl -w
use strict;

my $content = q{<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>OSCON 2006 videos - Perl/Raku track</title>
  </head>
  <body><pre>
};

my(@videos) = glob('*.mp4');
chomp(@videos);
foreach my $filename ( @videos ){
  my ($line) = qx(grep '^$filename' index.txt);
  #oscon2006-2006.07.26_09-55-14.mp4 Here we are at the Oregon Convention Center w/Schwern
  my ($fn, $pfx, $datetimestamp, $description) = ($line =~ /^((\w+2006)-(.+?)\.mp4)(?:\s+(.+))?$/);
  $description //= '';
  $content .= qq{<a href="$filename">$filename</a>\t$description$/};
}

$content .= q{
  </pre></body>
</html>
};

print $content;
