support m4v as well as flv
markie [Sun, 8 Aug 2010 19:14:48 +0000 (12:14 -0700)]
lib/App/IdiotBox.pm

index 0f28b4a..2b79dee 100644 (file)
@@ -5,6 +5,7 @@ use Method::Signatures::Simple;
 use FindBin;
 use HTML::Zoom;
 use HTML::Zoom::FilterBuilder::Template;
+use List::Util qw(first);
 
 {
   package App::IdiotBox::Announcement;
@@ -88,6 +89,7 @@ method show_front_page {
             my $obj = $_;
             sub {
               $_->select('.bucket-name')->replace_content($obj->bucket->name)
+                ->select('.made-at')->replace_content($obj->made_at)
                 ->select('.bucket-link')->set_attribute({
                     name => 'href', value => $obj->bucket->slug.'/'
                   })
@@ -118,10 +120,15 @@ method show_bucket ($bucket) {
 }
 
 method show_video ($video) {
+  my $video_file = first {
+    -e join('/', $self->config->{base_dir}, $_)
+  } map {
+    join('/', $video->bucket->slug, $video->slug, $video->file_name.".$_")
+  } qw(flv m4v);
   $self->html_response(video => sub {
     my $video_url = 
       $self->base_url
-      .join('/', $video->bucket->slug, $video->slug, $video->file_name.'.flv');
+      .$video_file;
 
     $_->select('.video-name')->replace_content($video->name)
       ->select('.author-name')->replace_content($video->author)