line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# mamgal - a program for creating static image galleries |
2
|
|
|
|
|
|
|
# Copyright 2007, 2008 Marcin Owsiany |
3
|
|
|
|
|
|
|
# See the README file for license information |
4
|
|
|
|
|
|
|
# The picture encapsulating class |
5
|
|
|
|
|
|
|
package App::MaMGal::Entry::Picture::Film; |
6
|
1
|
|
|
1
|
|
12439
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
8
|
1
|
|
|
1
|
|
5
|
use base 'App::MaMGal::Entry::Picture'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
486
|
|
9
|
1
|
|
|
1
|
|
672
|
use App::MaMGal::VideoIcon; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
10
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
11
|
1
|
|
|
1
|
|
8
|
use Scalar::Util 'blessed'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
271
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $thumbnail_extension = '.png'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub refresh_scaled_pictures |
16
|
|
|
|
|
|
|
{ |
17
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
18
|
0
|
|
|
|
|
|
return $self->refresh_miniatures([$self->thumbnails_dir, 200, 150, $thumbnail_extension]); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _new_video_icon |
22
|
|
|
|
|
|
|
{ |
23
|
0
|
|
|
0
|
|
|
my $self = shift; |
24
|
0
|
|
|
|
|
|
my $s = Image::Magick->new(magick => 'png'); |
25
|
0
|
|
|
|
|
|
$s->BlobToImage(App::MaMGal::VideoIcon->img); |
26
|
0
|
|
|
|
|
|
$s; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub read_image |
30
|
|
|
|
|
|
|
{ |
31
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
32
|
0
|
0
|
|
|
|
|
my $tools = $self->tools or croak "Tools were not injected."; |
33
|
0
|
0
|
|
|
|
|
my $w = $tools->{mplayer_wrapper} or croak "MplayerWrapper required."; |
34
|
0
|
|
|
|
|
|
my $s; |
35
|
0
|
|
|
|
|
|
eval { $s = $w->snapshot($self->{path_name}); }; |
|
0
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if ($@) { |
37
|
0
|
0
|
0
|
|
|
|
if (blessed($@) and ( |
|
|
|
0
|
|
|
|
|
38
|
|
|
|
|
|
|
$@->isa('App::MaMGal::MplayerWrapper::NotAvailableException') |
39
|
|
|
|
|
|
|
or |
40
|
|
|
|
|
|
|
$@->isa('App::MaMGal::MplayerWrapper::ExecutionFailureException') |
41
|
|
|
|
|
|
|
)) { |
42
|
0
|
|
|
|
|
|
$self->logger->log_exception($@, $self->{path_name}); |
43
|
0
|
|
|
|
|
|
$s = $self->_new_video_icon; |
44
|
|
|
|
|
|
|
} else { |
45
|
0
|
|
|
|
|
|
die $@; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
return $s; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
0
|
|
sub thumbnail_path { $_[0]->SUPER::thumbnail_path.$thumbnail_extension } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |