Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tools for technical analysts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Preservation
tools for technical analysts
Commits
59a79315
Commit
59a79315
authored
1 year ago
by
Andreas Romeyke
Browse files
Options
Downloads
Patches
Plain Diff
- adapted count command
parent
8880e2c9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SLUB/LZA/TA/Command/count.pm
+28
-15
28 additions, 15 deletions
lib/SLUB/LZA/TA/Command/count.pm
with
28 additions
and
15 deletions
lib/SLUB/LZA/TA/Command/count.pm
+
28
−
15
View file @
59a79315
...
@@ -3,15 +3,14 @@ use SLUB::LZA::TA -command;
...
@@ -3,15 +3,14 @@ use SLUB::LZA::TA -command;
use
strict
;
use
strict
;
use
warnings
;
use
warnings
;
use
feature
qw(say)
;
use
feature
qw(say)
;
use
SLUB::LZA::TA::
Rosetta::
common_sru
;
use
SLUB::LZA::TA::
Archivematica::
Elasticsearch
;
use
SLUB::LZA::TA::Rosetta::
SRU
;
use
Data::
Printer
;
# VERSION
# VERSION
# ABSTRACT: count IEs module for ta-tool
# ABSTRACT: count IEs module for ta-tool
sub
abstract
{"
count IEs in Rosetta based Archival Information System
";}
sub
abstract
{"
count IEs in Rosetta based Archival Information System
";}
my
$description
=
<<"DESCR";
my
$description
=
<<"DESCR";
...
@@ -20,15 +19,15 @@ and return counts of matches.
...
@@ -20,15 +19,15 @@ and return counts of matches.
Examples:
Examples:
* Is this dc identifier in
A
rchiv?
* Is this dc identifier in
a
rchiv
e
?
$0 count -d SLUB:LZA:Kitodo:kitodo:422766
$0 count -d SLUB:LZA:Kitodo:kitodo:422766
* How many
IE
s were modified in 2021-05-31?
* How many
AIP
s were modified in 2021-05-31?
$0 count -m 2021-05-31
$0 count -m 2021-05-31
* How many
IE
s have at least one invalid file?
* How many
AIP
s have at least one invalid file?
$0 count --with-invalid-files
$0 count --with-invalid-files
* How many
IE
s with mkv-files are in archive?
* How many
AIP
s with mkv-files are in archive?
$0 count --with-format=fmt/569
$0 count --with-format=fmt/569
* How many
IE
s have at least one file without virus check?
* How many
AIP
s have at least one file without virus check?
$0 count --with-missed-viruscheck
$0 count --with-missed-viruscheck
DESCR
DESCR
...
@@ -37,15 +36,17 @@ sub description {
...
@@ -37,15 +36,17 @@ sub description {
}
}
sub
opt_spec
{
sub
opt_spec
{
return
(
return
(
["
target-version|V
"
=>
"
get current elasticsearch version
"],
["
verbose|v
"
=>
"
enable verbose output
"],
["
verbose|v
"
=>
"
enable verbose output
"],
["
debug
"
=>
"
enable user agent debug output
"],
["
debug
"
=>
"
enable user agent debug output
"],
["
datemode
"
=>
hidden
=>
{
one_of
=>
[
["
datemode
"
=>
hidden
=>
{
one_of
=>
[
["
creationdate|c=s
"
=>
"
search based on creationdate string
"],
["
creationdate|c=s
"
=>
"
search based on creationdate string
"],
["
modificationdate|m=s
"
=>
"
search based on modificationdate string
"]
["
modificationdate|m=s
"
=>
"
search based on modificationdate string
"]
]
}
],
]
}
],
[
"
lzaid|l=s
",
"
count AIPs by given LZA id
"],
["
descriptive|d=s
"
=>
"
count based on string search in descriptive metadata
"],
["
descriptive|d=s
"
=>
"
count based on string search in descriptive metadata
"],
["
source|s=s
"
=>
"
count based on string search in source metadata
"],
["
source|s=s
"
=>
"
count based on string search in source metadata
"],
["
ie|i
=s
"
=>
"
search a specific IE
"],
["
aip|a
=s
"
=>
"
count AIPs by given AIP id
"],
["
format
"
=>
hidden
=>
{
one_of
=>
[
["
format
"
=>
hidden
=>
{
one_of
=>
[
["
with-format=s
"
=>
"
with pronom format id
"],
["
with-format=s
"
=>
"
with pronom format id
"],
# unsupported by Rosetta <= 7.0
# unsupported by Rosetta <= 7.0
...
@@ -71,12 +72,24 @@ sub validate_args {
...
@@ -71,12 +72,24 @@ sub validate_args {
sub
execute
{
sub
execute
{
my
(
$self
,
$opt
,
$args
)
=
@_
;
my
(
$self
,
$opt
,
$args
)
=
@_
;
my
$maxrecords
=
"
0
";
if
(
$opt
->
{
target_version
})
{
my
$startrecord
=
1
;
say
SLUB::LZA::TA::Archivematica::Elasticsearch::
version_elasticsearch
(
my
$query
=
SLUB::LZA::TA::Rosetta::common_sru::
prepare_query
(
$opt
);
$
SLUB::LZA::TA::
config
{
elasticsearchprotocol
},
my
$response
=
SLUB::LZA::TA::Rosetta::SRU::
sru_search
('
ie
',
$query
,
$startrecord
,
$maxrecords
,
$opt
->
{
verbose
},
$opt
->
{
debug
});
$
SLUB::LZA::TA::
config
{
elasticsearchhost
},
$response
=~
s|.*?<numberOfRecords>(\d+)</numberOfRecords.*|$1|s
;
$
SLUB::LZA::TA::
config
{
elasticsearchport
}
say
$response
;
);
exit
(
0
);
}
my
$query
=
SLUB::LZA::TA::Archivematica::Elasticsearch::
prepare_query
(
$opt
);
my
$response
=
SLUB::LZA::TA::Archivematica::Elasticsearch::
query_elasticsearch_count
(
$
SLUB::LZA::TA::
config
{
elasticsearchprotocol
},
$
SLUB::LZA::TA::
config
{
elasticsearchhost
},
$
SLUB::LZA::TA::
config
{
elasticsearchport
},
'
aips
',
# indexname
$query
,
# query_hash ref
);
say
np
(
$response
);
return
1
;
}
}
1
;
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment