X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=Aleph.pm;h=448beaa19cdaf6e84d53a3551d05f2c01511ad7c;hb=18a4315db8c49fd64ca248a402e471915de12e24;hp=9aa68005b0793592086b68725cb538969684c0ef;hpb=846995fffc4b3618357fb3023bf418dd63b23351;p=Biblio-Z3950.git diff --git a/Aleph.pm b/Aleph.pm index 9aa6800..448beaa 100644 --- a/Aleph.pm +++ b/Aleph.pm @@ -15,9 +15,9 @@ sub diag { # Koha Z39.50 query: # # Bib-1 @and @and @and @and @and @and @and @or -# @attr 1=8 isbn-issn -# @attr 1=7 isbn-issn # @attr 1=4 title +# @attr 1=7 isbn +# @attr 1=8 issn # @attr 1=1003 author # @attr 1=16 dewey # @attr 1=21 subject-holding @@ -50,13 +50,15 @@ sub diag { # WYR - Godina izdavanja sub usemap {{ - 4 => 'WTI', - 1003 => 'AUT', - 16 => 'DDC', - 21 => 'SUB', - 12 => 'LCN', + 4 => 'WTI=', + 7 => 'ISBN=', + 8 => 'ISSN=', + 1003 => 'AUT=', + 16 => 'DDC=', + 21 => 'SUB=', + 12 => 'LCN=', # 1007 => '', - 1016 => 'WRD', + 1016 => 'WRD=', }}; our $session_id; @@ -68,7 +70,7 @@ sub search { $session_id ||= int rand(1000000000); # FIXME allocate session just once - my $url = 'http://161.53.240.197:8992/F?RN=' . $session_id; + my $url = 'http://katalog.nsk.hr/F?RN=' . $session_id; # fake JavaScript code on page which creates random session diag "get $url"; @@ -101,9 +103,11 @@ diag "submit search [$query] on ", $self->{database}; ); my $hits = 0; - if ( $mech->content =~ m{ukupno\s+(\d+).*do\s+(\d+)}s ) { + if ( $mech->content =~ m{ukupno\s+(\d+).*do\s+(\d+)} ) { # FIXME Many results in Crotian $hits = $1; $hits = $2 if $2 && $2 < $1; # correct for max. results + } elsif ( $mech->content =~ m{(\d+)\s+od\s+(\d+)} ) { # FIXME single result in Croatian + $hits = $2; } else { diag "get't find results in ", $mech->content; return; @@ -139,6 +143,7 @@ sub next_marc { warn "parse $nr"; $marc = MARC::Record->new; + $marc->encoding('utf-8'); $hash = {}; my $html = $mech->content; @@ -168,6 +173,8 @@ warn "## ++ ", dump( $f, $v ); my ($i1,$i2) = (' ',' '); ($i1,$i2) = ($2,$3) if $f =~ s/^(...)(.)?(.)?/$1/; + $i1 ||= ' '; + $i2 ||= ' '; my @sf = split(/\|/, $v); @sf = map { s/^(\w)\s+//; { $1 => $_ } } @sf; #warn "## sf = ", dump(@sf);