MARC::Charset->ignore_errors(1);
-my ($max_uri, $max_cn, $auth, $mfhd, $config, $quiet) =
- (0, 0, 0, 0, '/openils/conf/opensrf_core.xml');
+my ($max_uri, $max_cn, $auth, $config, $quiet) =
+ (0, 0, 0, '/openils/conf/opensrf_core.xml');
GetOptions(
'config=s' => \$config,
'authority' => \$auth,
- 'serial' => \$mfhd,
'quiet' => \$quiet,
'max_uri=i' => \$max_uri,
'max_cn=i' => \$max_cn,
my $meth = 'open-ils.ingest.full.biblio.object.readonly';
$meth = 'open-ils.ingest.full.authority.object.readonly' if ($auth);
-$meth = 'open-ils.ingest.full.serial.object.readonly' if ($mfhd);
$meth = OpenILS::Application::Ingest->method_lookup( $meth );
my $bib = $data->{bib};
my $full_rec = $data->{ingest_data}->{full_rec};
- if (!$auth && !$mfhd) {
+ if (!$auth) {
$field_entries = $data->{ingest_data}->{field_entries};
$fp = $data->{ingest_data}->{fingerprint};
$rd = $data->{ingest_data}->{descriptor};
}
print( OpenSRF::Utils::JSON->perl2JSON($bib)."\n" );
- if (!$auth && !$mfhd) {
+ if (!$auth) {
print( OpenSRF::Utils::JSON->perl2JSON($rd)."\n" );
print( OpenSRF::Utils::JSON->perl2JSON($_)."\n" ) for (@$field_entries);
for my $u (@$uri) {
);
# --------------------------------------------------------------------------------
-# Serial ingest
-
-package OpenILS::Application::Ingest::Serial;
-use base qw/OpenILS::Application::Ingest/;
-use Unicode::Normalize;
-
-sub ro_serial_ingest_single_object {
- my $self = shift;
- my $client = shift;
- my $bib = shift;
- my $xml = OpenILS::Application::AppUtils->entityize($bib->marc);
-
- my $document = $parser->parse_string($xml);
-
- my @mfr = $self->method_lookup("open-ils.ingest.flat_marc.serial.xml")->run($document);
-
- $_->record($bib->id) for (@mfr);
-
- return { full_rec => \@mfr };
-}
-__PACKAGE__->register_method(
- api_name => "open-ils.ingest.full.serial.object.readonly",
- method => "ro_serial_ingest_single_object",
- api_level => 1,
- argc => 1,
-);
-
-sub ro_serial_ingest_single_xml {
- my $self = shift;
- my $client = shift;
- my $xml = OpenILS::Application::AppUtils->entityize(shift);
-
- my $document = $parser->parse_string($xml);
-
- my @mfr = $self->method_lookup("open-ils.ingest.flat_marc.serial.xml")->run($document);
-
- return { full_rec => \@mfr };
-}
-__PACKAGE__->register_method(
- api_name => "open-ils.ingest.full.serial.xml.readonly",
- method => "ro_serial_ingest_single_xml",
- api_level => 1,
- argc => 1,
-);
-
-sub ro_serial_ingest_single_record {
- my $self = shift;
- my $client = shift;
- my $rec = shift;
-
- OpenILS::Application::Ingest->post_init();
- my $r = OpenSRF::AppSession
- ->create('open-ils.cstore')
- ->request( 'open-ils.cstore.direct.serial.record_entry.retrieve' => $rec )
- ->gather(1);
-
- return undef unless ($r and @$r);
-
- my ($res) = $self->method_lookup("open-ils.ingest.full.serial.xml.readonly")->run($r->marc);
-
- $_->record($rec) for (@{$res->{full_rec}});
- $res->{descriptor}->record($rec);
-
- return $res;
-}
-__PACKAGE__->register_method(
- api_name => "open-ils.ingest.full.serial.record.readonly",
- method => "ro_serial_ingest_single_record",
- api_level => 1,
- argc => 1,
-);
-
-sub ro_serial_ingest_stream_record {
- my $self = shift;
- my $client = shift;
-
- OpenILS::Application::Ingest->post_init();
-
- my $ses = OpenSRF::AppSession->create('open-ils.cstore');
-
- while (my ($resp) = $client->recv( count => 1, timeout => 5 )) {
-
- my $rec = $resp->content;
- last unless (defined $rec);
-
- $log->debug("Running open-ils.ingest.full.serial.record.readonly ...");
- my ($res) = $self->method_lookup("open-ils.ingest.full.serial.record.readonly")->run($rec);
-
- $_->record($rec) for (@{$res->{full_rec}});
-
- $client->respond( $res );
- }
-
- return undef;
-}
-__PACKAGE__->register_method(
- api_name => "open-ils.ingest.full.serial.record_stream.readonly",
- method => "ro_serial_ingest_stream_record",
- api_level => 1,
- stream => 1,
-);
-
-sub ro_serial_ingest_stream_xml {
- my $self = shift;
- my $client = shift;
-
- OpenILS::Application::Ingest->post_init();
-
- my $ses = OpenSRF::AppSession->create('open-ils.cstore');
-
- while (my ($resp) = $client->recv( count => 1, timeout => 5 )) {
-
- my $xml = $resp->content;
- last unless (defined $xml);
-
- $log->debug("Running open-ils.ingest.full.serial.xml.readonly ...");
- my ($res) = $self->method_lookup("open-ils.ingest.full.serial.xml.readonly")->run($xml);
-
- $client->respond( $res );
- }
-
- return undef;
-}
-__PACKAGE__->register_method(
- api_name => "open-ils.ingest.full.serial.xml_stream.readonly",
- method => "ro_serial_ingest_stream_xml",
- api_level => 1,
- stream => 1,
-);
-
-sub rw_serial_ingest_stream_import {
- my $self = shift;
- my $client = shift;
-
- OpenILS::Application::Ingest->post_init();
-
- my $ses = OpenSRF::AppSession->create('open-ils.cstore');
-
- while (my ($resp) = $client->recv( count => 1, timeout => 5 )) {
-
- my $bib = $resp->content;
- last unless (defined $bib);
-
- $log->debug("Running open-ils.ingest.full.serial.xml.readonly ...");
- my ($res) = $self->method_lookup("open-ils.ingest.full.serial.xml.readonly")->run($bib->marc);
-
- $_->record($bib->id) for (@{$res->{full_rec}});
-
- $client->respond( $res );
- }
-
- return undef;
-}
-__PACKAGE__->register_method(
- api_name => "open-ils.ingest.full.serial.bib_stream.import",
- method => "rw_serial_ingest_stream_import",
- api_level => 1,
- stream => 1,
-);
-
-
-# --------------------------------------------------------------------------------
# MARC index extraction
package OpenILS::Application::Ingest::XPATH;
my $type = 'metabib';
$type = 'authority' if ($self->api_name =~ /authority/o);
- $type = 'serial' if ($self->api_name =~ /serial/o);
OpenILS::Application::Ingest->post_init();
argc => 1,
stream => 1,
);
-__PACKAGE__->register_method(
- api_name => "open-ils.ingest.flat_marc.serial.xml",
- method => "flat_marc_xml",
- api_level => 1,
- argc => 1,
- stream => 1,
-);
sub flat_marc_record {
my $self = shift;
my $type = 'biblio';
$type = 'authority' if ($self->api_name =~ /authority/o);
- $type = 'serial' if ($self->api_name =~ /serial/o);
OpenILS::Application::Ingest->post_init();
my $r = OpenSRF::AppSession
argc => 1,
stream => 1,
);
-__PACKAGE__->register_method(
- api_name => "open-ils.ingest.flat_marc.serial.record_entry",
- method => "flat_marc_record",
- api_level => 1,
- argc => 1,
- stream => 1,
-);
# --------------------------------------------------------------------------------
# URI extraction