- Timestamp:
- 2023-12-06T22:23:05+13:00 (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugins/BaseMediaConverter.pm
r38477 r38478 76 76 77 77 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 82 85 sub get_cache_filename_for_location 83 86 { … … 114 117 # reverse sort as we want to try matching more specific "$coll_dir/$subdir" before $coll_dir 115 118 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"; 117 120 118 121 my $prefixre = $key; … … 121 124 ($file) = ($filename =~ m/$prefixre/); 122 125 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; 124 128 } else { 125 print STDERR "\t#### Found match. Applying: $replacere\n";129 #print STDERR "\t#### Found match. Applying: $replacere\n"; 126 130 if($replacere eq $orig_file_root_replacere) { 127 131 $file = $orig_file_root_replacere.$file if $file; … … 140 144 $file =~ s/^\/|\\//; # get rid of leading slash from relative filename 141 145 $file =~ s@^(\.(\/|\/))*@@; # get rid of any ./ at the start 142 print STDERR "\t XXXX final file is: $file\n";146 print STDERR "\t@@@ Final cache tail file is: $file\n"; 143 147 144 148 return $file … … 160 164 $filename =~ s/\\/\//g; 161 165 $base_dir =~ s/\\/\//g; 162 print STDERR "@@@@ col_dir : $collect_dir\n"; 163 print STDERR "@@@@ filename: $filename\n"; 164 166 165 167 my $file = $self->get_cache_filename_for_location($filename, $orig_file_root, $base_dir, $collect_dir); 166 168 … … 180 182 181 183 my $base_output_dir = &FileUtils::filenameConcatenate($collect_dir,"cached",$dirname); 182 ## my $base_output_dir = &FileUtils::filenameConcatenate($collect_dir,"cached",$dirname);183 184 184 185 if (!-e $base_output_dir ) { … … 190 191 191 192 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"; 194 195 195 196 my $output_dir = &FileUtils::filenameConcatenate($base_output_dir,$file_root);
Note:
See TracChangeset
for help on using the changeset viewer.