use FindBin;
use HTML::Zoom;
use HTML::Zoom::FilterBuilder::Template;
+use List::Util qw(first);
{
package App::IdiotBox::Announcement;
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.'/'
})
}
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)