MeGa/Item/Video.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 34 CC 4 SCAR 25.1
CC
4
Cov
0%
thumbnail_source
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 12.3
1 # $Id: Video.pm 193 2009-01-16 13:42:25Z fish $
2 package WWW::MeGa::Item::Video;
3 use strict;
4 use warnings;
5  
6 =head1 NAME
7  
8 WWW::MeGa::Item::Video - Representing a video in L<WWW::MeGa>
9  
10 =head1 DESCRIPTION
11  
12 See L<WWW::MeGa::Item>
13  
14 =head1 CHANGED METHODS
15  
16 =cut
17  
18 use base 'WWW::MeGa::Item';
19  
20 our $VERSION = '0.11';
21  
22  
23 =head2 thumbnail_source
24  
25 extracts a frame from the video file and place it in the thumbnail-dir for
26 creating thumbnails of it. After that it return the path to that file.
27  
28 =cut
29  
30 sub thumbnail_source
31 {
32 my $self = shift;
33 if ($self->{config}->param('video-thumbs'))
34 {
35 my $type = $self->{config}->param('thumb-type');
36 my $frame = File::Spec->catdir($self->{config}->param('cache'), $self->{path} .'.'. $type);
37 warn "trying access $frame" if $self->{config}->param('debug');
38  
39 unless (-e $frame)
40 {
41 $self->prepare_dir($frame) or die "could not create dir for $frame";
42 system($self->{config}->param('ffmpeg-path'), '-i', $self->{path}, '-f', 'image2', '-ss', $self->{config}->param('video-thumbs-offset'), '-vframes', 1, $frame);
43 }
44 return $frame;
45 }
46 return;
47 }
48  
49 1;