Lines 25-31
oai_sets_mappings, and then fill table oai_sets_biblios with builded infos.
Link Here
|
25 |
|
25 |
|
26 |
=head1 USAGE |
26 |
=head1 USAGE |
27 |
|
27 |
|
28 |
build_oai_sets.pl [-h] [-v] [-r] [-i] [-l LENGTH [-o OFFSET]] |
28 |
build_oai_sets.pl [-h] [-v] [-r] [-i] [-l LENGTH [-o OFFSET]] [-s set_id] |
29 |
-h Print help message; |
29 |
-h Print help message; |
30 |
-v Be verbose |
30 |
-v Be verbose |
31 |
-r Truncate table oai_sets_biblios before inserting new rows |
31 |
-r Truncate table oai_sets_biblios before inserting new rows |
Lines 33-38
oai_sets_mappings, and then fill table oai_sets_biblios with builded infos.
Link Here
|
33 |
on item fields |
33 |
on item fields |
34 |
-l LENGTH Process LENGTH biblios |
34 |
-l LENGTH Process LENGTH biblios |
35 |
-o OFFSET If LENGTH is defined, start processing from OFFSET |
35 |
-o OFFSET If LENGTH is defined, start processing from OFFSET |
|
|
36 |
-s set_id If set_id is defined, only add records for this OAI-PMH set |
36 |
|
37 |
|
37 |
=cut |
38 |
=cut |
38 |
|
39 |
|
Lines 58-64
use Koha::Biblio::Metadata;
Link Here
|
58 |
|
59 |
|
59 |
my %opts; |
60 |
my %opts; |
60 |
$Getopt::Std::STANDARD_HELP_VERSION = 1; |
61 |
$Getopt::Std::STANDARD_HELP_VERSION = 1; |
61 |
my $go = getopts('vo:l:ihr', \%opts); |
62 |
my $go = getopts('vo:l:ihrs:', \%opts); |
62 |
|
63 |
|
63 |
if(!$go or $opts{h}){ |
64 |
if(!$go or $opts{h}){ |
64 |
&print_usage; |
65 |
&print_usage; |
Lines 70-80
my $offset = $opts{o};
Link Here
|
70 |
my $length = $opts{l}; |
71 |
my $length = $opts{l}; |
71 |
my $embed_items = $opts{i}; |
72 |
my $embed_items = $opts{i}; |
72 |
my $reset = $opts{r}; |
73 |
my $reset = $opts{r}; |
|
|
74 |
my $set = $opts{s}; |
75 |
|
76 |
my $selective_set = {}; |
77 |
if ($set){ |
78 |
$selective_set->{set_id} = $set; |
79 |
} |
73 |
|
80 |
|
74 |
my $dbh = C4::Context->dbh; |
81 |
my $dbh = C4::Context->dbh; |
75 |
|
82 |
|
76 |
# Get OAI sets mappings |
83 |
# Get OAI sets mappings |
77 |
my $mappings = GetOAISetsMappings; |
84 |
my $mappings = GetOAISetsMappings($selective_set); |
78 |
|
85 |
|
79 |
# Get all biblionumbers and marcxml |
86 |
# Get all biblionumbers and marcxml |
80 |
print "Retrieving biblios... " if $verbose; |
87 |
print "Retrieving biblios... " if $verbose; |
Lines 102-108
my $results = $sth->fetchall_arrayref({});
Link Here
|
102 |
print "done.\n" if $verbose; |
109 |
print "done.\n" if $verbose; |
103 |
|
110 |
|
104 |
# Build lists of parents sets |
111 |
# Build lists of parents sets |
105 |
my $sets = GetOAISets; |
112 |
my $sets = GetOAISets($selective_set); |
106 |
my $parentsets; |
113 |
my $parentsets; |
107 |
foreach my $set (@$sets) { |
114 |
foreach my $set (@$sets) { |
108 |
my $setSpec = $set->{'spec'}; |
115 |
my $setSpec = $set->{'spec'}; |
Lines 179-188
print "done.\n";
Link Here
|
179 |
|
186 |
|
180 |
sub print_usage { |
187 |
sub print_usage { |
181 |
print "build_oai_sets.pl: Build OAI-PMH sets, according to mappings defined in Koha\n"; |
188 |
print "build_oai_sets.pl: Build OAI-PMH sets, according to mappings defined in Koha\n"; |
182 |
print "Usage: build_oai_sets.pl [-h] [-v] [-i] [-l LENGTH [-o OFFSET]]\n\n"; |
189 |
print "Usage: build_oai_sets.pl [-h] [-v] [-i] [-l LENGTH [-o OFFSET]] [ -s set_id]\n\n"; |
183 |
print "\t-h\t\tPrint this help and exit\n"; |
190 |
print "\t-h\t\tPrint this help and exit\n"; |
184 |
print "\t-v\t\tBe verbose\n"; |
191 |
print "\t-v\t\tBe verbose\n"; |
185 |
print "\t-i\t\tEmbed items informations, mandatory if you defined mappings on item fields\n"; |
192 |
print "\t-i\t\tEmbed items informations, mandatory if you defined mappings on item fields\n"; |
186 |
print "\t-l LENGTH\tProcess LENGTH biblios\n"; |
193 |
print "\t-l LENGTH\tProcess LENGTH biblios\n"; |
187 |
print "\t-o OFFSET\tIf LENGTH is defined, start processing from OFFSET\n\n"; |
194 |
print "\t-o OFFSET\tIf LENGTH is defined, start processing from OFFSET\n"; |
|
|
195 |
print "\t-s set_id\tIf set_id is defined, only add recods for this OAI-PMH set\n\n"; |
188 |
} |
196 |
} |