9 use Data::Dump qw(dump);
12 open(my $json, '<', 'report_62836_1046_ZavrsniRadovi.json');
17 $json = decode_json($data);
19 #warn dump($json->[0]);
21 open(my $marc_fh, '>', 'radovi.marc');
25 foreach my $rad ( @$json ) {
27 print dump($rad), "\n";
29 if ( ! $rad->{naslovhr} ) {
30 $stat->{no_naslovhr}++;
35 my $marc = MARC::Record->new;
36 $marc->encoding( 'UTF-8' );
39 grep { ref($_) eq 'ARRAY' }
40 [ '100', '1', '#', a => $rad->{prezime} . ', ' . $rad->{ime}, g => 'JMBAG:' . $rad->{jmbag} ],
41 [ '245', '1', '0', a => $rad->{naslovhr} ],
43 $rad->{nasloven} =~ m/The / ? 4 :
44 $rad->{nasloven} =~ m/A / ? 2 : ' ' # FIXME?
45 , a => $rad->{nasloven}, i => 'Naslov na engleskom: '
47 $rad->{'brojstranica'} ? [ '300', '#', '#', a => $rad->{'brojstranica'} . ' str. ;', c => '30 cm' ] : '',
48 [ '502', '#', '#', b => $rad->{studij} . ' studij', c => 'Fakultet elektrotehnike i računarstva u Zagrebu', g => 'smjer: ' . $rad->{smjer}, g => 'šifra smjera: ' . $rad->{sifsmjer}, d => $rad->{datumzavrsetka} ],
49 $rad->{sazetakhr} ? [ '520', '3', '#', a => 'Sažetak na hrvatskom: ' . $rad->{sazetakhr} ] : '',
50 $rad->{sazetaken} ? [ '520', '3', '#', a => 'Sažetak na engleskom: ' . $rad->{sazetaken} ] : '',
51 $rad->{keywords} ? [ '653', '#', '#', map { ( a => $_ ) } split(/;\s*/, $rad->{keywords} ) ] : '',
52 $rad->{keywords_en} ? [ '653', '#', '#', map { ( a => $_ ) } split(/;\s*/, $rad->{keywords_en}) ] : '',
53 [ '700', '1', '#', a => $rad->{prezmentor} . ', ' . $rad->{imementor}, 4 => 'ths' ],
54 $rad->{prezmentor2} ? [ '700', '1', '#', a => $rad->{prezmentor2} . ', ' . $rad->{imementor2}, 4 => 'ths' ] : ''
57 print $marc_fh $marc->as_usmarc;
59 print $marc->as_formatted, "\n\n"; # FIXME
61 # last if $stat->{radova} == 10; # FIXME
64 print "# stat = ",dump($stat);
68 ($recordid, $biblioitemnumber) = AddBiblio($marc_record, $framework);