Changeset 9067 for trunk/gsdl/perllib/plugins/BasPlug.pm
- Timestamp:
- 2005-02-16T16:26:34+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/plugins/BasPlug.pm
r8915 r9067 69 69 'type' => "regexp", 70 70 'deft' => "", 71 'reqd' => "no" }, 72 { 'name' => "smart_block", 73 'desc' => "{BasPlug.smart_block}", 74 'type' => "flag", 71 75 'reqd' => "no" }, 72 76 { 'name' => "associate_ext", … … 428 432 } 429 433 434 # default implementation is to do nothing. 435 sub store_block_files 436 { 437 my $self =shift (@_); 438 my ($filename) = @_; 439 return; 440 } 441 442 #default implementation is to block a file with same name as this, but extension jpg or JPG, if cover_images is on. 443 sub block_cover_image 444 { 445 my $self =shift (@_); 446 my ($filename) = @_; 447 if ($self->{'cover_image'}) { 448 my $coverfile = $filename; 449 $coverfile =~ s/\.[^\\\/\.]+$/\.jpg/; 450 if (!-e $coverfile) { 451 $coverfile =~ s/jpg$/JPG/; 452 } 453 if (-e $coverfile) { 454 $self->{'file_blocks'}->{$coverfile} = 1; 455 } 456 } 457 458 return; 459 } 460 430 461 sub metadata_read { 431 462 my $self = shift (@_); 432 463 my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_; 433 434 464 # Keep track of filenames with same root but different extensions 435 # Used to support -asso icate_ext465 # Used to support -associate_ext 436 466 437 467 my $associate_ext = $self->{'associate_ext'}; … … 460 490 } 461 491 } 462 463 return undef; 492 493 # now check whether we are actually processing this 494 my $filename = $file; 495 $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/; 496 if ($self->{'process_exp'} eq "" || $filename !~ /$self->{'process_exp'}/ || !-f $filename) { 497 return undef; # can't recognise 498 } 499 500 # do smart blocking if appropriate 501 if (defined $self->{'smart_block'}) { 502 $self->block_cover_image($filename); 503 $self->store_block_files($filename); 504 } 505 506 return 1; 464 507 } 465 508
Note:
See TracChangeset
for help on using the changeset viewer.