Changeset 38478


Ignore:
Timestamp:
2023-12-06T22:23:05+13:00 (6 months ago)
Author:
anupama
Message:

Related to the previous 2 commits. Removed or commented out most debug statements, only one remains (the final filepath within the cache dir for a file that has been determined by the new subroutine). Adjusted the new subroutine's description.

Location:
main/trunk/greenstone2/perllib/plugins
Files:
3 edited

Legend:

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

    r38477 r38478  
    7676
    7777
    78 # given the file location where media or other product files are generated
    79 # (such as the pages of a PDF file converted to paged images), this returns
    80 # the full path to the document's cache subdirectory they are to be stored
    81 # e.g. collect/<collection>/cached>/<fileRootname>
     78# This method exists to prevent duplication of long filepaths within the cache dir.
     79# Given the file location where media or other product files to be cached are generated
     80# (such as the pages of a PDF file converted to paged images), this subroutine returns
     81# the relative path the document is to be stored as, within the cache subdirectory.
     82# e.g. collect/<collection>/cached/<fileroot/numbered-filename.ext>
     83# will return fileroot/numbered-filename.ext
     84# e.g.#2 collect/<collection>/import/<fileroot.ext> will return fileroot.ext
    8285sub get_cache_filename_for_location
    8386{
     
    114117    # reverse sort as we want to try matching more specific "$coll_dir/$subdir" before $coll_dir
    115118   
    116     print STDERR "@@@ Key and value: $key\n\t $prefixre_to_replacere_map{$key}\n";
     119    #print STDERR "@@@ Key and value: $key\n\t $prefixre_to_replacere_map{$key}\n";
    117120
    118121    my $prefixre = $key;
     
    121124    ($file) = ($filename =~ m/$prefixre/);
    122125    if (!defined $file || $file eq $filename) {
    123         print STDERR "\t#### No match\n"; # keep looping looking for the next match
     126        #print STDERR "\t#### No match\n"; # keep looping looking for the next match
     127        next;
    124128    } else {
    125         print STDERR "\t#### Found match. Applying: $replacere\n";
     129        #print STDERR "\t#### Found match. Applying: $replacere\n";
    126130        if($replacere eq $orig_file_root_replacere) {
    127131        $file = $orig_file_root_replacere.$file if $file;
     
    140144    $file =~ s/^\/|\\//; # get rid of leading slash from relative filename
    141145    $file =~ s@^(\.(\/|\/))*@@; # get rid of any ./ at the start
    142     print STDERR "\tXXXX final file is: $file\n";
     146    print STDERR "\t@@@ Final cache tail file is: $file\n";
    143147
    144148    return $file
     
    160164    $filename =~ s/\\/\//g;
    161165    $base_dir =~ s/\\/\//g;
    162     print STDERR "@@@@ col_dir    : $collect_dir\n";
    163     print STDERR "@@@@ filename: $filename\n";
    164 
     166   
    165167    my $file = $self->get_cache_filename_for_location($filename, $orig_file_root, $base_dir, $collect_dir);
    166168
     
    180182
    181183    my $base_output_dir = &FileUtils::filenameConcatenate($collect_dir,"cached",$dirname);
    182 ##    my $base_output_dir = &FileUtils::filenameConcatenate($collect_dir,"cached",$dirname);
    183184
    184185    if (!-e $base_output_dir ) {
     
    190191
    191192
    192     print STDERR "@@@@ base_output_dir: $base_output_dir\n";
    193     print STDERR "@@@@ file_root: $file_root\n";
     193    #print STDERR "@@@@ base_output_dir: $base_output_dir\n";
     194    #print STDERR "@@@@ file_root: $file_root\n";
    194195
    195196    my $output_dir = &FileUtils::filenameConcatenate($base_output_dir,$file_root);
  • main/trunk/greenstone2/perllib/plugins/ImageConverter.pm

    r38476 r38478  
    213213    my ($filename_full_path, $filename_encoded_full_path, $doc_obj, $section, $filename_encoding) = @_;
    214214
    215     print STDERR "##### generate_images: filename full path = $filename_full_path\n";
    216    
    217215    my ($unused_fefp,$filename_encoded_no_path)
    218216    = &util::get_full_filenames("",$filename_encoded_full_path);
  • main/trunk/greenstone2/perllib/plugins/PagedImagePlugin.pm

    r38476 r38478  
    477477    my $url_encoded_full_filename
    478478        = &unicode::raw_filename_to_url_encoded($filename_full_path);
    479     print STDERR "#### process_image filename_full_path: $filename_full_path vs $self->{'orig_filename_full_path'}\n";
     479    #print STDERR "#### process_image filename_full_path: $filename_full_path vs $self->{'orig_filename_full_path'}\n";
    480480    $result = $self->generate_images($filename_full_path, $url_encoded_full_filename, $doc_obj, $section);
    481481    }
Note: See TracChangeset for help on using the changeset viewer.