move screenshots to s/shot/time path
[HTML5TV.git] / bin / mplayer.pl
index 446597a..3fceaff 100755 (executable)
@@ -255,7 +255,7 @@ sub html5tv {
                },
        };
 
-       $html5tv->{video_tags} =
+       $html5tv->{html}->{video_tags} =
                join("\n",
                        map {
                                my $s = $_;
@@ -302,7 +302,7 @@ sub html5tv {
 
        warn "last customEvent $index\n";
 
-       $html5tv->{subtitles_table}
+       $html5tv->{html}->{subtitles_table}
                = qq|<table id="subtitles">|
                . join("\n",
                        map { qq|
@@ -317,10 +317,10 @@ sub html5tv {
                . qq|</table><a href="$media_dir/video.srt">download subtitles</a>|
                ;
 
-       my $hcalendar = '<div style="color: red">Create <tt>hcalendar.html</tt> to fill this space</div>';
-       my $hcal_path = '$media_dir/hcalendar.html';
+       my $hCalendar = '<div style="color: red">Create <tt>hCalendar.html</tt> to fill this space</div>';
+       my $hcal_path = '$media_dir/hCalendar.html';
        if ( -e $hcal_path ) {
-               $html5tv->{hcalendar} = read_file $hcal_path;
+               $html5tv->{hCalendar} = read_file $hcal_path;
                my $tree = HTML::TreeBuilder->new;
                $tree->parse_file($hcal_path);
                if ( my $vevent = $tree->look_down( class => 'vevent' ) ) {
@@ -608,6 +608,23 @@ while ( my $events = epoll_wait($epfd, 10, 1000) ) { # Max 10 events returned, 1
                                                        $subtitles[ $#subtitles ]->[1] = $pos;
                                                }
                                        }
+                               } elsif ( $line =~ m{(shot\d+.png)} ) {
+                                       my $shot = $1;
+                                       my $t = time_pos;
+                                       warn "shot $t $shot\n";
+                                       my $dir = "$media_dir/s/shot";
+                                       if ( ! -e $dir ) {
+                                               mkdir $dir;
+                                               warn "created $dir\n";
+                                       }
+                                       rename $1, "$dir/$t.png";
+
+                                       my $hires = "media_dir/s/hires";
+                                       mkdir $hires unless -e $hires;
+                                       my $max_slide = scalar( glob("$hires/*") ) || 0;
+                                       symlink "$dir/$t.png", "$hires/s$max_slide.png";
+                                       push @subtitles, [ $t, $t, "[$max_slide] video time $t slide $max_slide" ];
+                                       warn "created slide $max_slide at $t from $shot\n";
                                }
 
                                $line = '';