source: gs3-extensions/pharos-videois/trunk/perllib/plugins/PharosVideoPlugin.pm@ 21600

Last change on this file since 21600 was 21600, checked in by davidb, 13 years ago

index each keyframe for each section

File size: 3.3 KB
Line 
1###########################################################################
2#
3# PharosVideoPlugin - an VideoPlugin that can also do pharos related tasks.
4#
5# A component of the Greenstone digital library software
6# from the New Zealand Digital Library Project at the
7# University of Waikato, New Zealand.
8#
9# Copyright (C) 2008 New Zealand Digital Library Project
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24#
25###########################################################################
26package PharosVideoPlugin;
27
28use VideoPlugin;
29use PharosImageIndexer;
30
31use strict;
32no strict 'refs'; # allow filehandles to be variables and viceversa
33
34use gsprintf 'gsprintf';
35
36BEGIN {
37 @PharosVideoPlugin::ISA = ('VideoPlugin', 'PharosImageIndexer');
38}
39
40my $arguments = [
41 ];
42
43my $options = { 'name' => "PharosVideoPlugin",
44 'desc' => "{PharosVideoPlugin.desc}",
45 'abstract' => "no",
46 'inherits' => "yes",
47 'args' => $arguments };
48
49sub new {
50 my ($class) = shift (@_);
51 my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
52 push(@$pluginlist, $class);
53
54 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
55 push(@{$hashArgOptLists->{"OptList"}},$options);
56
57 new PharosImageIndexer($pluginlist, $inputargs, $hashArgOptLists);
58 my $self = new VideoPlugin($pluginlist, $inputargs, $hashArgOptLists);
59
60
61 return bless $self, $class;
62
63}
64
65# needs to be called after BasePlugin init, so that outhandle is set up.
66sub init {
67 my $self = shift(@_);
68 my ($verbosity, $outhandle, $failhandle) = @_;
69
70 $self->SUPER::init(@_);
71 $self->PharosImageIndexer::init();
72
73}
74
75sub remove_all {
76 my $self = shift (@_);
77 my ($pluginfo, $base_dir, $processor, $maxdocs) = @_;
78
79 $self->SUPER::remove_all(@_);
80 $self->PharosImageIndexer::remove_all(@_);
81
82}
83
84sub remove_one {
85 my $self = shift (@_);
86 my ($file, $oids, $archivedir) = @_;
87 return undef if (!$self->can_process_this_file($file));
88
89 $self->PharosImageIndexer::remove_one(@_);
90 return $self->SUPER::remove_one(@_);
91
92}
93
94
95sub post_process_doc_obj {
96 my $self = shift (@_);
97 # options??
98 my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
99
100 my $topsection = $doc_obj->get_top_section();
101
102 my $assoc_files = $doc_obj->get_assoc_files();
103
104
105 my $docid = $doc_obj->get_OID();
106
107 foreach my $ar (@$assoc_files) {
108 my ($real_filename,$afile,$mimetype,$section) = @$ar;
109 if ($afile =~ m/^keyframe/) {
110
111 my $secid = $docid;
112 if ($section ne "") {
113 $secid .= ".$section";
114 }
115
116 $self->pharos_index_image($real_filename, $doc_obj, $secid);
117 }
118 }
119}
120
121
122
1231;
Note: See TracBrowser for help on using the repository browser.