Changeset 22900

Show
Ignore:
Timestamp:
14.09.2010 14:12:16 (9 years ago)
Author:
kjdon
Message:

getting this to work properly

Files:
1 modified

Legend:

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

    r19493 r22900  
    2626 
    2727### Note this plugin currently can't download source documents from outside if you are behind a firewall. 
     28# Unless, you set the http_proxy environment variable to be your proxy server,  
     29# and set proxy_user and proxy_password in .wgetrc file in home directory.  
     30# (does that work on windows??) 
    2831 
    2932package LOMPlugin; 
     
    155158    $lom_srcdoc =~ s/^$base_dir($dirsep)//; 
    156159    $self->{'extra_blocks'}->{$file}++; 
    157  
    158160    $file_re = $lom_srcdoc; 
    159161    } 
     
    161163    $file_re = $tail; 
    162164    } 
    163     $file_re =~ s/\./\\\./g; 
    164  
     165    $file_re = &util::filename_to_regex($file_re); 
    165166    $self->{'lom_srcdoc'} = undef; # reset for next file to be processed 
    166167 
    167168    push(@$extrametakeys,$file_re); 
    168169    $extrametadata->{$file_re} = $self->{'saved_metadata'}; 
    169  
     170    if (defined $lom_srcdoc) { 
     171    # copied from oaiplugin 
     172    if (!defined $extrametafile->{$file_re}) { 
     173        $extrametafile->{$file_re} = {}; 
     174    } 
     175     #maps the file to full path 
     176    $extrametafile->{$file_re}->{$file} = $filename_full_path; 
     177    } 
     178     
    170179    return 1; 
    171180} 
     
    268277    my $outhandle = $self->{'outhandle'}; 
    269278 
    270     print STDERR "<Processing n='$file' p='LOMPlugin'>\n" if ($gli); 
    271  
    272     print $outhandle "LOMPLug: processing $file\n"; 
    273  
    274279    my $cursection = $doc_obj->get_top_section(); 
    275280    $doc_obj->add_utf8_text($cursection, $$textref); 
     
    583588 
    584589    my $full_file_url = &util::filename_cat($output_dir,$file_url); 
    585  
     590    # the path to srcdoc will be used later in extrametadata to associate 
     591    # the lom metadata with the document. Needs to be relative to current 
     592    # directory. 
     593    my $srcdoc_path = &util::filename_cat("_gsdldown.all", $file_url); 
    586594    my $check_timestamp = $self->{'check_timestamp'}; 
    587595    my $status; 
     
    610618        $wget_cmd = "wget -nv -P \"$output_dir\" --timestamping -k -p \"$doc_url\"";  
    611619    } 
    612     #my $wget_cmd = "wget -nv -P$output_dir --timestamping -k -p \"$doc_url\"";  
    613     ### my $full_dir_url = &File::Basename::dirname($full_file_url); 
    614  
    615     ## my $wget_cmd = "wget -O $full_file_url --timestamping -k \"$doc_url\""; 
    616     #my $wget_cmd = "wget -nv -P$output_dir --timestamping -x -k \"$doc_url\""; 
    617     print STDERR "**** wget = $wget_cmd\n"; 
     620    ##print STDERR "**** wget = $wget_cmd\n"; 
    618621 
    619622     
     
    623626    } 
    624627    if ($status==0) { 
    625         $self->{'lom_srcdoc'} = $full_file_url;  
     628        $self->{'lom_srcdoc'} = $srcdoc_path;    
    626629    } 
    627630    else { 
     
    633636    # not time-stamping and file already exists 
    634637    $status=0; 
    635     $self->{'lom_srcdoc'} = $full_file_url;  
     638    $self->{'lom_srcdoc'} = $srcdoc_path;    
    636639    } 
    637640