Diff for /nsdl/nsdlloncapaorg/harvester.pl between versions 1.4 and 1.7

version 1.4, 2003/07/29 14:37:51 version 1.7, 2003/10/21 15:58:26
Line 28  my $content_regex = 'File Not Found'; Line 28  my $content_regex = 'File Not Found';
 # Configuration  # Configuration
   
 my $debug = 0;  my $debug = 0;
 my $url = 'http://s10.lite.msu.edu/cgi-bin/metadata_harvest.pl';  
 # The list of servers is from the LON-CAPA CVS repository in /loncapa/loncom/production_hosts.tab  # The list of servers is from the LON-CAPA CVS repository in /loncapa/loncom/production_hosts.tab
 my @servers = ( 'newscience.westshore.cc.mi.us', 's10.lite.msu.edu', 's12.lite.msu.edu', 'lon-capa.chem.sunysb.edu', 'schubert.tmcc.edu', 'dalton.chem.sfu.ca', 'capa2.phy.ohiou.edu', 'pollux.physics.fsu.edu', 'loncapa.physics.sc.edu', 'loncapa.math.ucf.edu', 'zappa.ags.udel.edu', 'loncapa.gwu.edu');  my @servers = (
   'newscience.westshore.cc.mi.us',
   's10.lite.msu.edu',
   's12.lite.msu.edu',
   'lon-capa.chem.sunysb.edu',
   'schubert.tmcc.edu',
   'dalton.chem.sfu.ca',
   'capa2.phy.ohiou.edu',
   'pollux.physics.fsu.edu',
   'loncapa.physics.sc.edu',
   'loncapa.math.ucf.edu',
   'zappa.ags.udel.edu',
   'loncapa.gwu.edu',
   'neptune.physics.ndsu.nodak.edu',
   'capa1.uwsp.edu',
   'natasha.it.fit.edu',
   'loncapa.Mines.EDU',
   'loncapa.chm.nau.edu');
   
   foreach (@servers) {
       my $url='http://'.$_.'/cgi-bin/metadata_harvest.pl';
 # End Configuration  # End Configuration
   
 my $ua = new LWP::UserAgent;  my $ua = new LWP::UserAgent;
Line 43  $request->authorization_basic('reaper', Line 62  $request->authorization_basic('reaper',
 my $response = $ua->request( $request );  my $response = $ua->request( $request );
   
 if ( $response->is_success ) {  if ( $response->is_success ) {
        print 'SUCCESS: ' . $response->message.' for '.$url."\n\n";
  $content = $response->content;   $content = $response->content;
 # Delete all blank lines  # Delete all blank lines
  $content =~ s/(?<!.)\n//g;   $content =~ s/(?<!.)\n//g;
Line 51  if ( $response->is_success ) { Line 71  if ( $response->is_success ) {
 # Push the content into an array  # Push the content into an array
  @loncapa = split /\n/, $content;   @loncapa = split /\n/, $content;
 } else {  } else {
  die 'LON-CAPA request failed: ' . $response->message;       print 'LON-CAPA request failed: ' . $response->message.' for '.$url."\n\n";
        next;
 }  }
   
 #@loncapa=undef;  #@loncapa=undef;
Line 96  foreach my $metadata (@loncapa) { Line 117  foreach my $metadata (@loncapa) {
  my $version = $tkline[5];   my $version = $tkline[5];
  my $notes = $tkline[6];   my $notes = $tkline[6];
  my $abstract = $tkline[7];   my $abstract = $tkline[7];
  next if ($abstract eq '');   unless ($abstract) { $abstract=$subject; }
    unless ($abstract) { $abstract=$title; }
    unless ($abstract) { $abstract=$keywords; }
  my $type = $tkline[8];   my $type = $tkline[8];
  my $learning_resource_type;   my $learning_resource_type;
  if ( $type eq 'problem' ) {   if ( $type eq 'problem' ) {
Line 153  foreach my $metadata (@loncapa) { Line 176  foreach my $metadata (@loncapa) {
  # Defaults mean access open to any registered LON-CAPA user   # Defaults mean access open to any registered LON-CAPA user
  # Private means open only to author of material   # Private means open only to author of material
  next if ( $copyright eq 'private');   next if ( $copyright eq 'private');
    next if ( $copyright eq 'domain');
  my $platform = "5";     # HTML Browser (not specified but construed from metadata)   my $platform = "5";     # HTML Browser (not specified but construed from metadata)
 #  #
 # Create path  # Create path
Line 183  foreach my $metadata (@loncapa) { Line 207  foreach my $metadata (@loncapa) {
 ENDMETA  ENDMETA
       close (XML);        close (XML);
 }  }
   }

Removed from v.1.4  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>