warn "using media/_editing -> $movie\n";
} elsif ( -d $movie && $movie =~ m{media/} ) {
$movie .= '/video.ogv';
-} elsif ( -f $movie && $movie =~ m{\.og[vg]$}i ) {
+} elsif ( -f $movie && $movie =~ m{\.og[vg]\b}i ) {
my $movie_master = $movie;
$movie = base_dir($movie) . '/video.ogv';
unlink $movie;
return sprintf('%02d:%02d', int($t/60), int($t%60));
}
+my %escape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"');
+my $escape_re = join '|' => keys %escape;
+sub html_escape {
+ my $what = join('',@_);
+ $what =~ s/($escape_re)/$escape{$1}/gs;
+ warn "XXX html_escape $what\n";
+ return $what;
+}
+
sub html5tv {
if ( ! $prop->{width} || ! $prop->{height} ) {
- warn "SKIP no size yet\n";
+ warn "SKIP no size yet\n" if $debug;
return;
}
push @videos, [ @$s, $video ];
}
} elsif ( $s->[2] =~ m{slide:(\d+)\s+shot:(\d+\.\d+)} ) {
- push @frames, [ $2, $1 ] unless -e "$media_dir/hires/f$1.jpg";
+ push @frames, [ $2, $1 ] unless -e "$media_dir/s/hires/f$1.jpg";
next;
}
}
- my ($slide_width, $slide_height, $size, $format) = Graphics::Magick->new->Ping( slide_jpg( $slide_factor => 1 ) );
+ my ($slide_width, $slide_height, $size, $format) = Graphics::Magick->new->Ping( slide_jpg( 1 => 1 ) );
+ my ($c_slide_width, $c_slide_height) = Graphics::Magick->new->Ping( slide_jpg( $slide_factor => 1 ) );
my $html5tv = {
sync => $sync,
width => $slide_width,
height => $slide_height,
},
+ carousel => {
+ width => $c_slide_width,
+ height => $c_slide_height,
+ },
};
$html5tv->{html}->{video_tags} =
id => $id,
title => $s->[2],
description => $s->[2],
- src => "$media_dir/s/1/00000001.jpg",
+ src => "$media_dir/s/$s->[3]/00000001.jpg",
href => '',
},
};
warn "last customEvent $index\n";
$html5tv->{html}->{subtitles_table}
- = qq|<table id="subtitles">|
+ = qq|
+ <table id="subtitles">
+ <tr><th>⇤</th><th>⇥</th><th>#</th><th>slide</th></tr>
+ |
. join("\n",
map {
- my $s = fmt_mmss( $_->{startTime} );
- my $e = fmt_mmss( $_->{endTime} );
+ my $s = $_->{startTime};
+ my $e = $_->{endTime};
+ my $i = $_->{index};
+ my $t = html_escape( $_->{args}->{title} );
+ my $slide = '';
+ $slide = $1 if $t =~ s{\s*\[(\d+)\]\s*}{};
+
+ my ( $s_f, $e_f ) = map { fmt_mmss $_ } ( $s, $e );
+
qq|
- <tr id="sub_$_->{index}">
- <td class="seek_video"><a href="#$_->{startTime}">$s</a></td>
- <td class="seek_video"><a href="#$_->{endTime}">$e</a></td>
- <td>$_->{args}->{title}</td>
+ <tr id="sub_$i">
+ <td class="seek_video"><a href="#$s">$s_f</a></td>
+ <td class="seek_video"><a href="#$e">$e_f</a></td>
+ <td class="slide">$slide</td>
+ <td>$t</td>
</tr>
|
}
@customEvents_sorted
)
- . qq|</table><a href="$media_dir/video.srt">download subtitles</a>|
+ . qq|</table>|
;
my $hCalendar = '<div style="color: red">Create <tt>hCalendar.html</tt> to fill this space</div>';
$html5tv->{title} = $hcal->summary;
}
+ foreach my $file ( qw/video.ogv presentation.pdf video.srt video.srt.yaml/ ) {
+ my $path = "$media_dir/$file";
+ my $type = 'binary';
+ $type = $1 if $file =~ m{\.([^\.]+)$};
+ my $size = -s $path;
+ $html5tv->{html}->{download} .= qq|<a href="$path" title="$file $size bytes">$type</a> |;
+ }
+
warn "# html5tv ", dump $html5tv if $debug;
my $html = read_file 'www/tv.html';
warn "sync $sync_path ", -s $sync_path, " bytes\n";
# video + full-sized slide on right
- my $carousel_width = $prop->{width} + ( $slide_width * $slide_factor );
- $carousel_width -= $carousel_width % ( $slide_width + 6 ); # round to full slide
- my $carousel_height = $slide_height + 2;
+ my $carousel_width = $prop->{width} + $slide_width;
+ $carousel_width -= $carousel_width % ( $c_slide_width + 6 ); # round to full slide
+ my $carousel_height = $c_slide_height + 2;
+
write_file "$media_dir/video.css", qq|
}
.jcarousel-skin-ie7 .jcarousel-item {
- width: ${slide_width}px;
- height: ${slide_height}px;
+ width: ${c_slide_width}px;
+ height: ${c_slide_height}px;
margin: 0 2px 0 2px;
}
-.active {
- background-color: #ffc;
-}
-
div#videoContainer {
- width: $prop->{width}px;
- height: $prop->{height}px;
- font-family: Arial, Helvetica, sans-serif;
+// width: $prop->{width}px;
+// height: $prop->{height}px;
margin: 0 10px 0px 0;
- position: relative;
- display: inline;
}
-div#subtitle {
- bottom: 24px;
- color: white;
- font-size: 100%;
- font-weight: bold;
- height: 22px;
- line-height: 1em;
- margin: 0 0 0 0;
- padding: 1px 10px 5px 10px ;
- position: absolute;
- text-align: center;
- width: $html5tv->{video}->{width}px;
+div#slide_border, div#slide {
+ width: ${slide_width}px;
+ height: ${slide_height}px;
}
-
-.jcarousel-skin-ie7 .jcarousel-item img:hover {
-// border-color: #555 !important;
+div#subtitle {
+ width: $html5tv->{video}->{width}px;
}
-.jcarousel-skin-ie7 .jcarousel-item:hover div.thumbnailOverlay {
- visibility: visible !important;
-}
-.jcarousel-skin-ie7 .jcarousel-item div.thumbnailOverlay {
- background: black;
- bottom: 1px;
- color: #00EEFF;
- visibility: hidden;
- font-size: 10px;
- font-family: Arial, Verdana;
- font-weight: bold;
- line-height: 0.9em;
- opacity: 0.5;
- position: absolute;
- text-align: center;
- z-index: 10;
- padding: 2px 0 2px 0;
- width: ${slide_width}px;
-}
-.seek_video {
- text-align: right;
- font-family: monospace;
+.jcarousel-skin-ie7 .jcarousel-item div.thumbnailOverlay {
+ width: ${c_slide_width}px;
}
|;
sub edit_subtitles {
print $to_mplayer qq|pause\n|;
focus_term;
- system( qq|vi "$subtitles.yaml"| ) == 0 and load_subtitles;
+ my $line = 1;
+ my $jump_to = 1;
+ open( my $fh, '<', "$subtitles.yaml" ) || die $1;
+ while(<$fh>) {
+ last if /^-\s([\d\.]+)/ && $1 > $pos;
+ $jump_to = $line - 1 if /^---/;
+ $line++;
+ }
+ close($fh);
+ system( qq|vi +$jump_to "$subtitles.yaml"| ) == 0 and load_subtitles;
focus_mplayer;
}
} elsif ( $line =~ m{File not found} ) {
die $line;
} else {
- warn "IGNORE $line";
+ warn "IGNORE $line\n"; # if $debug;
}
}
-push @to_mplayer, "get_property $_\n" foreach grep { ! $prop->{$_} } ( qw/metadata video_codec video_bitrate width height fps length/ );
+my @mplayer_prop = ( qw/metadata video_codec video_bitrate width height fps/ );
+warn "XXX $movie\n";
+if ( my $l = `oggLength $movie` ) {
+ $l = $l / 1000;
+ $prop->{length} = $l;
+ warn "$movie length ", fmt_mmss( $l );
+}
+push @mplayer_prop, 'length' unless $prop->{length};
+
+push @to_mplayer, "get_property $_\n" foreach grep { ! $prop->{$_} } @mplayer_prop;
my $t = time;
my $line;