Changeset 15872 for gsdl/trunk/perllib/plugins/PSPlugin.pm
- Timestamp:
- 2008-06-05T09:29:32+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/PSPlugin.pm
r15865 r15872 1 1 ########################################################################### 2 2 # 3 # PSPlug .pm -- this might look VERY similar to the PDF plugin...3 # PSPlugin.pm -- this might look VERY similar to the PDF plugin... 4 4 # A component of the Greenstone digital library software 5 5 # from the New Zealand Digital Library Project at the … … 26 26 # 12/05/02 Added usage datastructure - John Thompson 27 27 28 package PSPlug; 29 30 use ConvertToPlug; 28 package PSPlugin; 29 30 use ConvertBinaryFile; 31 use ReadTextFile; # for read_file in convert_post_process. do we need it? 31 32 use sorttools; 32 33 … … 35 36 36 37 sub BEGIN { 37 @PSPlug ::ISA = ('ConvertToPlug');38 @PSPlugin::ISA = ('ConvertBinaryFile', 'ReadTextFile'); 38 39 } 39 40 40 41 my $convert_to_list = 41 42 [ { 'name' => "auto", 42 'desc' => "{Convert ToPlug.convert_to.auto}" },43 'desc' => "{ConvertBinaryFile.convert_to.auto}" }, 43 44 { 'name' => "text", 44 'desc' => "{Convert ToPlug.convert_to.text}" },45 'desc' => "{ConvertBinaryFile.convert_to.text}" }, 45 46 { 'name' => "pagedimg_jpg", 46 'desc' => "{Convert ToPlug.convert_to.pagedimg_jpg}" },47 'desc' => "{ConvertBinaryFile.convert_to.pagedimg_jpg}" }, 47 48 { 'name' => "pagedimg_gif", 48 'desc' => "{Convert ToPlug.convert_to.pagedimg_gif}" },49 'desc' => "{ConvertBinaryFile.convert_to.pagedimg_gif}" }, 49 50 { 'name' => "pagedimg_png", 50 'desc' => "{Convert ToPlug.convert_to.pagedimg_png}" }51 'desc' => "{ConvertBinaryFile.convert_to.pagedimg_png}" } 51 52 ]; 52 53 53 54 my $arguments = 54 55 [ { 'name' => "convert_to", 55 'desc' => "{Convert ToPlug.convert_to}",56 'desc' => "{ConvertBinaryFile.convert_to}", 56 57 'type' => "enum", 57 58 'reqd' => "yes", … … 59 60 'deft' => "text" }, 60 61 { 'name' => "process_exp", 61 'desc' => "{Bas Plug.process_exp}",62 'desc' => "{BasePlugin.process_exp}", 62 63 'type' => "regexp", 63 64 'deft' => &get_default_process_exp(), 64 65 'reqd' => "no" }, 65 66 { 'name' => "block_exp", 66 'desc' => "{Bas Plug.block_exp}",67 'desc' => "{BasePlugin.block_exp}", 67 68 'type' => 'regexp', 68 69 'deft' => &get_default_block_exp() }, 69 70 { 'name' => "extract_date", 70 'desc' => "{PSPlug .extract_date}",71 'desc' => "{PSPlugin.extract_date}", 71 72 'type' => "flag" }, 72 73 { 'name' => "extract_pages", 73 'desc' => "{PSPlug .extract_pages}",74 'desc' => "{PSPlugin.extract_pages}", 74 75 'type' => "flag" }, 75 76 { 'name' => "extract_title", 76 'desc' => "{PSPlug .extract_title}",77 'desc' => "{PSPlugin.extract_title}", 77 78 'type' => "flag" } ]; 78 79 79 my $options = { 'name' => "PSPlug ",80 'desc' => "{PSPlug .desc}",80 my $options = { 'name' => "PSPlugin", 81 'desc' => "{PSPlugin.desc}", 81 82 'abstract' => "no", 82 83 'inherits' => "yes", … … 94 95 push(@$inputargs,'^(Page\s+\d+)?(\s*1\s+)?'); 95 96 96 if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}97 if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};98 99 my $self = new Convert ToPlug($pluginlist, $inputargs, $hashArgOptLists);97 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments}); 98 push(@{$hashArgOptLists->{"OptList"}},$options); 99 100 my $self = new ConvertBinaryFile($pluginlist, $inputargs, $hashArgOptLists); 100 101 101 102 if ($self->{'info_only'}) { … … 104 105 } 105 106 107 $self->{'filename_extension'} = "ps"; 108 $self->{'file_type'} = "PS"; 109 106 110 my $secondary_plugin_options = $self->{'secondary_plugin_options'}; 107 111 108 if (!defined $secondary_plugin_options->{'T EXTPlug'}) {109 $secondary_plugin_options->{'T EXTPlug'} = [];110 } 111 112 my $text_options = $secondary_plugin_options->{'T EXTPlug'};112 if (!defined $secondary_plugin_options->{'TextPlugin'}) { 113 $secondary_plugin_options->{'TextPlugin'} = []; 114 } 115 116 my $text_options = $secondary_plugin_options->{'TextPlugin'}; 113 117 114 118 if (defined $self->{'convert_to'} && $self->{'convert_to'} =~ /pagedimg.*/i) { 115 if (!defined $secondary_plugin_options->{'PagedIm gPlug'}){116 $secondary_plugin_options->{'PagedIm gPlug'} = [];117 my $pagedimg_options = $secondary_plugin_options->{'PagedIm gPlug'};119 if (!defined $secondary_plugin_options->{'PagedImagePlugin'}){ 120 $secondary_plugin_options->{'PagedImagePlugin'} = []; 121 my $pagedimg_options = $secondary_plugin_options->{'PagedImagePlugin'}; 118 122 push(@$pagedimg_options, "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?'); 119 123 } … … 148 152 } 149 153 154 # this has been commented out in other plugins. do we need it here? 150 155 sub convert_post_process 151 156 { … … 179 184 my $date_found = 0; 180 185 181 print STDERR "PSPlug : extracting PostScript metadata from \"$filename\"\n"186 print STDERR "PSPlugin: extracting PostScript metadata from \"$filename\"\n" 182 187 if $self->{'verbosity'} > 1; 183 188 … … 237 242 } 238 243 239 # do plugin specific processing of doc_obj for HTML type244 # do plugin specific processing of doc_obj 240 245 sub process { 241 246 my $self = shift (@_); 242 my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_; 243 244 # my $outhandle = $self->{'outhandle'}; 245 246 # print $outhandle "PSPlug: passing $file on to $self->{'converted_to'}Plug\n" 247 # if $self->{'verbosity'} > 1; 248 # print STDERR "<Processing n='$file' p='PSPlug'>\n" if ($gli); 247 my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_; 249 248 250 249 my $filename = &util::filename_cat($base_dir,$file); 251 250 $self->extract_metadata_from_postscript($filename, $doc_obj); 252 251 253 return $self->process_type("ps",$base_dir,$file,$doc_obj); 252 return $self->SUPER::process(@_); 253 254 254 } 255 255
Note:
See TracChangeset
for help on using the changeset viewer.