/[local]/isis2stream.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /isis2stream.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by dpavlin, Mon Jun 24 13:46:53 2002 UTC revision 1.17 by dpavlin, Tue Jun 25 13:42:54 2002 UTC
# Line 8  use common; Line 8  use common;
8    
9  my %opts;  my %opts;
10    
11  getopt('dm', \%opts);  getopts('d:m:q', \%opts);
12    
13  die "usage: $0 -d [database_dir] -m [database1,database2] " if (! %opts);  die "usage: $0 -d [database_dir] -m [database1,database2] " if (! %opts);
14    
# Line 84  sub c_852_iso { Line 84  sub c_852_iso {
84          return $tmp;          return $tmp;
85  }  }
86    
87    sub c_iso_852 {
88            my $tmp = $_[0];
89            $tmp =~ tr/ܫꔼȺ̪㍐슂ٝ// if ($tmp);
90            return $tmp;
91    }
92    
93  sub c_852_czs {  sub c_852_czs {
94          my $tmp = $_[0];          my $tmp = $_[0];
95          $tmp =~ tr//ܫꔼȺ̪㍐슂ٝ/;          $tmp =~ tr//ܫꔼȺ̪㍐슂ٝ/;
# Line 319  foreach my $isis_db (@isis_dbs) { Line 325  foreach my $isis_db (@isis_dbs) {
325          my $row = OpenIsis::read( $db, $row_id );          my $row = OpenIsis::read( $db, $row_id );
326          if (my $tmp = $row->{'200'}->[0]) {          if (my $tmp = $row->{'200'}->[0]) {
327    
328                  my $bib = "%MFN $row->{mfn}\n";                  my $bib;
329                  my $mps = "W $row->{mfn} 14\n";                  my $mps = "W $row->{mfn} 14\n";
330    
331                  my $pcnt = int($row->{mfn} * 100 / $max_rowid);                  my $pcnt = int($row->{mfn} * 100 / $max_rowid);
332                  if ($pcnt != $last_pcnt) {                  if ($pcnt != $last_pcnt) {
333                          printf MPS ("M %5d / %5d -- %-2d %%\n",$row->{mfn},$max_rowid,$pcnt);                          printf MPS ("M %5d / %5d -- %-2d %%\n",$row->{mfn},$max_rowid,$pcnt) if (! $opts{q});
334                          $last_pcnt = $pcnt;                          $last_pcnt = $pcnt;
335                  }                  }
336    
# Line 334  foreach my $isis_db (@isis_dbs) { Line 340  foreach my $isis_db (@isis_dbs) {
340                  $headline .= isis_sf($row,'200','f'," / ");                  $headline .= isis_sf($row,'200','f'," / ");
341                  $headline .= isis_sf($row,'210','d'," , ");                  $headline .= isis_sf($row,'210','d'," , ");
342    
343                    # remove newlines, compress spaces
344                    $headline =~ s/[\n\r]//g;
345                    $headline =~ s/^\s+//g;
346                    $headline =~ s/\s+$//g;
347    
348                  # author                  # author
349                  $bib .= isis_to_bib($row,'700','%700+','*',2,'<');                  $bib .= isis_to_bib($row,'700','%700+','ab',undef,'>',', ');
350                  $bib .= isis_to_bib($row,'701','%700+','*',2,'<');                  $bib .= isis_to_bib($row,'701','%700+','ab',undef,'>',', ');
351                  $bib .= isis_to_bib($row,'710','%700+','*',2,'<');                  $bib .= isis_to_bib($row,'701','%700+','cd',undef,'>',', ');
352                  $bib .= isis_to_bib($row,'711','%700+','*',2,'<');  
353                  $bib .= isis_to_bib($row,'503','%700+','*',2,'<');                  my $tmp;
354                    $tmp = isis_sf($row,'710','abc', '', '', (' : ',', '));
355                    $tmp .= isis_sf($row,'710','dfe', ' (', ')', ('', ' ; ',' ; '));
356                    $bib .= "%700+ $tmp\n" if ($tmp);
357    
358                    $tmp = isis_sf($row,'711','abc', '', '', (' : ',', '));
359                    $tmp .= isis_sf($row,'711','dfe', ' (', ')', ('', ' ; ',' ; '));
360                    $bib .= "%700+ $tmp\n" if ($tmp);
361    
362                    $bib .= isis_to_bib($row,'503','%700+','ab',undef,'>',', ');
363    
364                  $mps .= isis_to_mps($row,'700',1);                  $mps .= isis_to_mps($row,'700',1);
365                  $mps .= isis_to_mps($row,'701',1);                  $mps .= isis_to_mps($row,'701',1);
# Line 375  foreach my $isis_db (@isis_dbs) { Line 395  foreach my $isis_db (@isis_dbs) {
395                  $mps .= isis_to_mps($row,'233',2,"ae");                  $mps .= isis_to_mps($row,'233',2,"ae");
396    
397    
                 my $tmp;  
398                  $tmp =  isis_sf($row,'230','v').                  $tmp =  isis_sf($row,'230','v').
399                          isis_sf($row,'230','a',' : ').                          isis_sf($row,'230','a',' : ').
400                          isis_sf($row,'250',undef,'. - ').                          isis_sf($row,'250',undef,'. - ').
# Line 426  foreach my $isis_db (@isis_dbs) { Line 445  foreach my $isis_db (@isis_dbs) {
445                  if (my $year = isis_sf($row,'210','d')) {                  if (my $year = isis_sf($row,'210','d')) {
446                          $year =~ s/^\s*cop\.*\s*//i;                          $year =~ s/^\s*cop\.*\s*//i;
447                          $year =~ s/[\[\]]*//g;                          $year =~ s/[\[\]]*//g;
448                            $year =~ s/[\n\r]//g;   # remove cr
449                          $mps .= "D ${year}\n" if ($year !~ m/\?/ && $year =~ /\d{4}/);                          $mps .= "D ${year}\n" if ($year !~ m/\?/ && $year =~ /\d{4}/);
450                  }                  }
451    
# Line 460  foreach my $isis_db (@isis_dbs) { Line 480  foreach my $isis_db (@isis_dbs) {
480                  $bib .= isis_to_bib($row,'610','%610');                  $bib .= isis_to_bib($row,'610','%610');
481                  $mps .= isis_to_mps($row,'610',8);                  $mps .= isis_to_mps($row,'610',8);
482    
483                  $bib .= isis_to_bib($row,'675','%675+');                  $bib .= isis_to_bib($row,'675','%675+','a');
484                  $mps .= isis_to_mps($row,'675',9);                  $mps .= isis_to_mps($row,'675',9);
485                  $bib .= isis_to_bib($row,'686','%675+');                  $bib .= isis_to_bib($row,'686','%675+','a');
486                  $mps .= isis_to_mps($row,'686',10);                  $mps .= isis_to_mps($row,'686',10);
487    
488                  $bib .= isis_to_bib($row,'990','%990');                  $bib .= isis_to_bib($row,'990','%990');
# Line 471  foreach my $isis_db (@isis_dbs) { Line 491  foreach my $isis_db (@isis_dbs) {
491                  $bib .= isis_to_bib($row,'991','%991');                  $bib .= isis_to_bib($row,'991','%991');
492                  $mps .= isis_to_mps($row,'991',12);                  $mps .= isis_to_mps($row,'991',12);
493    
494                    # Jezik
495                    $bib .= isis_to_bib($row,'101','%101');
496                    $mps .= isis_to_mps($row,'101',16);
497                    # Pismo
498                    $bib .= isis_to_bib($row,'998','%101', 'a');
499    
500                  sub isis_isn_to_mps {                  sub isis_isn_to_mps {
501                          my $row = shift @_ || die;                          my $row = shift @_ || die;
502                          my $isis_id = shift @_ || die;                          my $isis_id = shift @_ || die;
# Line 479  foreach my $isis_db (@isis_dbs) { Line 505  foreach my $isis_db (@isis_dbs) {
505                          my $mps='';                          my $mps='';
506                          while (my $isn=$row->{$isis_id}->[$i]) {                          while (my $isn=$row->{$isis_id}->[$i]) {
507                                  $isn =~ s/ +//g;        # remove spaces                                  $isn =~ s/ +//g;        # remove spaces
508                                    $isn =~ s/[\n\r]//g;    # remove cr
509                                  $mps .= "W $isn $nr\n";                                  $mps .= "W $isn $nr\n";
510                                  if ($isn =~ s/-//g) {                                  if ($isn =~ s/-//g) {
511                                          $mps .= "W $isn $nr\n";                                          $mps .= "W $isn $nr\n";
# Line 501  foreach my $isis_db (@isis_dbs) { Line 528  foreach my $isis_db (@isis_dbs) {
528    
529                  $mps .= isis_to_mps($row,'532',1);                  $mps .= isis_to_mps($row,'532',1);
530    
531                  $bib .= isis_to_bib($row,'994','%994a','a');                  $bib .= '%knjiz '.$DatabaseDescriptions{$db_dir}.", ".$row->{mfn}."\n";
   
532                  # headline                  # headline
533                  if ($headline) {                  if ($headline) {
534                          $headline .= " <i>(".$DatabaseDescriptions{$db_dir}.", ".$row->{mfn}.")</i>";   ## debug MFN!                          $headline .= " <i>(".$DatabaseDescriptions{$db_dir}.", ".$row->{mfn}.")</i>";   ## debug MFN!
535                          $headline =~ s/&/&and;/g;                          $headline =~ s/&/&and;/g;
536                          $headline =~ s/</&lt;/g;                          $headline =~ s/</&lt;/g;
537                          $headline =~ s/>/&gt;/g;                          $headline =~ s/>/&gt;/g;
                         $headline =~ s/&lt;(\/?[bi])&gt;/<$1>/g;  
538                          $mps .= "H ".c_852_iso($headline)."\n";                          $mps .= "H ".c_852_iso($headline)."\n";
539                  } else {                  } else {
540                          $mps .= "H nepoznato\n";                          $mps .= "H nepoznato\n";

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.26