Ignore:
Timestamp:
2017-06-29T16:27:37+12:00 (7 years ago)
Author:
ak19
Message:

Moved function generate_item_file that's shared between PowerPointPlugin and the new UnknownConverterPlugin into their shared base class ConvertBinaryFile.pm. 2. In UnknownConverterPlugin, removed unnecessary plugin uption, made the file return 1 as all other Plugin/pm files do, and now some debug stmts are only printed when the verbosity is >2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/PowerPointPlugin.pm

    r31742 r31761  
    398398}
    399399
    400 sub generate_item_file
    401 {
    402     my $self = shift(@_);
    403     my ($input_filename) = @_;
    404     my $outhandle = $self->{'outhandle'};
    405     my ($tailname, $dirname, $suffix)
    406     = &File::Basename::fileparse($input_filename, "\\.[^\\.]+\$");
    407 
    408     my $plugin_name = $self->{'plugin_type'};
    409 
    410     # find all the files in the directory
    411     if (!opendir (DIR, $dirname)) {
    412     print $outhandle "$plugin_name: Couldn't read directory $dirname\n";
    413     return $input_filename;
    414     }
    415 
    416     my @dir = readdir (DIR);
    417     closedir (DIR);
    418 
    419     # start the item file
    420     my $itemfile_name = &util::filename_cat($dirname, "$tailname.item");
    421 
    422     # encoding specification????
    423     if (!open (ITEMFILE, ">$itemfile_name")) {
    424     print $outhandle "$plugin_name: Couldn't open $itemfile_name for writing\n";
    425     }
    426     print ITEMFILE "<GeneratedBy>$plugin_name\n";
    427     # print the first page
    428     my @sorted_dir = sort alphanum_sort @dir;
    429     for (my $i = 0; $i < scalar(@sorted_dir); $i++) {
    430     my $file = $sorted_dir[$i];
    431     if ($file =~ /^img(\d+)\.jpg$/) {
    432         my $num = $1;
    433         $self->tidy_up_html(&util::filename_cat($dirname, "text$num.html"));
    434         print ITEMFILE "$num:img$num.jpg:text$num.html:\n";
    435     }
    436     }
    437     close ITEMFILE;
    438     return $itemfile_name;
    439 
    440    
    441 }
    442 
    443400# want to sort img1, img2, ...img10, img11 etc.
    444401sub alphanum_sort {
Note: See TracChangeset for help on using the changeset viewer.