| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Catmandu::Importer::MediaHaven; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
50846
|
use Catmandu::Sane; |
|
|
1
|
|
|
|
|
124286
|
|
|
|
1
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
292
|
use Moo; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
8
|
1
|
|
|
1
|
|
284
|
use Cpanel::JSON::XS; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
61
|
|
|
9
|
1
|
|
|
1
|
|
310
|
use Catmandu::MediaHaven; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use namespace::clean; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
6
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Importer'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'url' => (is => 'ro' , required => 1); |
|
15
|
|
|
|
|
|
|
has 'username' => (is => 'ro' , required => 1); |
|
16
|
|
|
|
|
|
|
has 'password' => (is => 'ro' , required => 1); |
|
17
|
|
|
|
|
|
|
has 'mediahaven' => (is => 'lazy'); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _build_mediahaven { |
|
20
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
21
|
0
|
|
|
|
|
|
Catmandu::MediaHaven->new( |
|
22
|
|
|
|
|
|
|
url => $self->url, |
|
23
|
|
|
|
|
|
|
username => $self->username, |
|
24
|
|
|
|
|
|
|
password => $self->password, |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub generator { |
|
29
|
|
|
|
|
|
|
my ($self) = @_; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $res = $self->mediahaven->search(); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub { |
|
34
|
|
|
|
|
|
|
state $results = $res->{mediaDataList}; |
|
35
|
|
|
|
|
|
|
state $total = $res->{totalNrOfResults}; |
|
36
|
|
|
|
|
|
|
state $index = 0; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$index++; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
if (@$results > 0) { |
|
41
|
|
|
|
|
|
|
return shift @$results; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
elsif ($index < $total) { |
|
44
|
|
|
|
|
|
|
my $res = $self->mediahaven->search(undef, start => $index+1); |
|
45
|
|
|
|
|
|
|
$results = $res->{mediaDataList}; |
|
46
|
|
|
|
|
|
|
$index++; |
|
47
|
|
|
|
|
|
|
return shift @$results; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
return undef; |
|
50
|
|
|
|
|
|
|
}; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Catmandu::Importer::MediaHaven - a importer that extracts Zeticon MediaHaven records |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# From the commandline |
|
66
|
|
|
|
|
|
|
$ cat catmandu.yml |
|
67
|
|
|
|
|
|
|
--- |
|
68
|
|
|
|
|
|
|
importer: |
|
69
|
|
|
|
|
|
|
mh: |
|
70
|
|
|
|
|
|
|
package: MediaHaven |
|
71
|
|
|
|
|
|
|
options: |
|
72
|
|
|
|
|
|
|
url: https://archief.viaa.be/mediahaven-rest-api/resources/media |
|
73
|
|
|
|
|
|
|
username: ... |
|
74
|
|
|
|
|
|
|
password: ... |
|
75
|
|
|
|
|
|
|
fix: | |
|
76
|
|
|
|
|
|
|
... |
|
77
|
|
|
|
|
|
|
<fixes required to translate MediaHaven records to metadata> |
|
78
|
|
|
|
|
|
|
... |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$ catmandu convert YAML to mh < records.yml |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 METHODS |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 new(%connection_parameters) |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Create a new Catmandu::Store::File::MediaHaven with the following connection |
|
87
|
|
|
|
|
|
|
parameters: |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=over |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item url |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Required. The URL to the MediaHaven REST endpoint. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item username |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Required. Username used to connect to MediaHaven. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item password |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Required. Password used to connect to MediaHaven. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 INHERITED METHODS |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This Catmandu::Exporter::MediaHaven implements |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=over 3 |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item L<Catmandu::Importer> |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item L<Catmandu::Logger> |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item L<Catmandu::Iterable> |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item L<Catmandu::Fixable> |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item L<Catmandu::Serializer> |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=back |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L<Catmandu::Exporter::MediaHaven> |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |