source: gs3-extensions/pharos-imageis/trunk/perllib/plugins/PharosImagePlugin.pm@ 21302

Last change on this file since 21302 was 21294, checked in by kjdon, 14 years ago

pharos plugin moved to extension folder rather than cluttering up main gs plugins. Now there are two: PharosImagePlugin is a top level plugin that inherits from ImagePLugin, and adds in the image similarity indexing functionality provided by PharosImageIndexer helper plugin. PharosImageINdexer will be used in future by PharosVideoPlugin. PharosIMagePlugin may include in future pharos annotation help plugin

File size: 2.7 KB
Line 
1###########################################################################
2#
3# PharosImagePlugin - an ImagePlugin 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 PharosImagePlugin;
27
28use ImagePlugin;
29use PharosImageIndexer;
30
31use strict;
32no strict 'refs'; # allow filehandles to be variables and viceversa
33
34use gsprintf 'gsprintf';
35
36BEGIN {
37 @PharosImagePlugin::ISA = ('ImagePlugin', 'PharosImageIndexer');
38}
39
40my $arguments = [
41 ];
42
43my $options = { 'name' => "PharosImagePlugin",
44 'desc' => "{PharosImagePlugin.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 ImagePlugin($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 removeold {
76 my $self = shift (@_);
77 my ($pluginfo, $base_dir, $processor, $maxdocs) = @_;
78
79 $self->SUPER::removeold(@_);
80 $self->PharosImageIndexer::removeold(@_);
81
82}
83
84sub post_process_doc_obj {
85 my $self = shift (@_);
86 # options??
87 my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
88 $self->pharos_index_image(&util::filename_cat($base_dir, $file), $doc_obj);
89}
90
91
92
931;
Note: See TracBrowser for help on using the repository browser.