| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package TMDB::Search; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
####################### |
|
4
|
|
|
|
|
|
|
# LOAD CORE MODULES |
|
5
|
|
|
|
|
|
|
####################### |
|
6
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
26
|
|
|
7
|
1
|
|
|
1
|
|
3
|
use warnings FATAL => 'all'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
28
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use Carp qw(croak carp); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
43
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
####################### |
|
11
|
|
|
|
|
|
|
# LOAD CPAN MODULES |
|
12
|
|
|
|
|
|
|
####################### |
|
13
|
1
|
|
|
1
|
|
4
|
use Params::Validate qw(validate_with :types); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
124
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use Object::Tiny qw(session include_adult max_pages); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
4
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
####################### |
|
17
|
|
|
|
|
|
|
# LOAD DIST MODULES |
|
18
|
|
|
|
|
|
|
####################### |
|
19
|
1
|
|
|
1
|
|
158
|
use TMDB::Session; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
####################### |
|
22
|
|
|
|
|
|
|
# VERSION |
|
23
|
|
|
|
|
|
|
####################### |
|
24
|
|
|
|
|
|
|
our $VERSION = '1.2.1'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
####################### |
|
27
|
|
|
|
|
|
|
# PUBLIC METHODS |
|
28
|
|
|
|
|
|
|
####################### |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
## ==================== |
|
31
|
|
|
|
|
|
|
## Constructor |
|
32
|
|
|
|
|
|
|
## ==================== |
|
33
|
|
|
|
|
|
|
sub new { |
|
34
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
35
|
|
|
|
|
|
|
my %opts = validate_with( |
|
36
|
|
|
|
|
|
|
params => \@_, |
|
37
|
|
|
|
|
|
|
spec => { |
|
38
|
|
|
|
|
|
|
session => { |
|
39
|
|
|
|
|
|
|
type => OBJECT, |
|
40
|
|
|
|
|
|
|
isa => 'TMDB::Session', |
|
41
|
|
|
|
|
|
|
}, |
|
42
|
|
|
|
|
|
|
include_adult => { |
|
43
|
|
|
|
|
|
|
type => SCALAR, |
|
44
|
|
|
|
|
|
|
optional => 1, |
|
45
|
|
|
|
|
|
|
default => 'false', |
|
46
|
|
|
|
|
|
|
callbacks => { |
|
47
|
|
|
|
|
|
|
'valid flag' => |
|
48
|
0
|
0
|
|
0
|
|
|
sub { lc $_[0] eq 'true' or lc $_[0] eq 'false' } |
|
49
|
|
|
|
|
|
|
}, |
|
50
|
|
|
|
|
|
|
}, |
|
51
|
|
|
|
|
|
|
max_pages => { |
|
52
|
|
|
|
|
|
|
type => SCALAR, |
|
53
|
|
|
|
|
|
|
optional => 1, |
|
54
|
|
|
|
|
|
|
default => 1, |
|
55
|
|
|
|
|
|
|
callbacks => { |
|
56
|
0
|
|
|
0
|
|
|
'integer' => sub { $_[0] =~ m{\d+} }, |
|
57
|
|
|
|
|
|
|
}, |
|
58
|
|
|
|
|
|
|
}, |
|
59
|
|
|
|
|
|
|
}, |
|
60
|
0
|
|
|
|
|
|
); |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(%opts); |
|
63
|
0
|
|
|
|
|
|
return $self; |
|
64
|
|
|
|
|
|
|
} ## end sub new |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
## ==================== |
|
67
|
|
|
|
|
|
|
## Search Movies |
|
68
|
|
|
|
|
|
|
## ==================== |
|
69
|
|
|
|
|
|
|
sub movie { |
|
70
|
0
|
|
|
0
|
0
|
|
my ( $self, $string ) = @_; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Get Year |
|
73
|
0
|
|
|
|
|
|
my $year; |
|
74
|
0
|
0
|
|
|
|
|
if ( $string =~ m{.+\((\d{4})\)$} ) { |
|
75
|
0
|
|
|
|
|
|
$year = $1; |
|
76
|
0
|
|
|
|
|
|
$string =~ s{\($year\)$}{}; |
|
77
|
|
|
|
|
|
|
} ## end if ( $string =~ m{.+\((\d{4})\)$}) |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# Trim |
|
80
|
0
|
|
|
|
|
|
$string =~ s{(?:^\s+)|(?:\s+$)}{}; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# Search |
|
83
|
0
|
|
|
|
|
|
my $params = { |
|
84
|
|
|
|
|
|
|
query => $string, |
|
85
|
|
|
|
|
|
|
include_adult => $self->include_adult, |
|
86
|
|
|
|
|
|
|
}; |
|
87
|
0
|
0
|
|
|
|
|
$params->{language} = $self->session->lang if $self->session->lang; |
|
88
|
0
|
0
|
|
|
|
|
$params->{year} = $year if $year; |
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
0
|
|
|
|
|
warn "DEBUG: Searching for $string\n" if $self->session->debug; |
|
91
|
0
|
|
|
|
|
|
return $self->_search( |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
|
|
|
|
|
|
method => 'search/movie', |
|
94
|
|
|
|
|
|
|
params => $params, |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
); |
|
97
|
|
|
|
|
|
|
} ## end sub movie |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
## ==================== |
|
100
|
|
|
|
|
|
|
## Search TV Shows |
|
101
|
|
|
|
|
|
|
## ==================== |
|
102
|
|
|
|
|
|
|
sub tv { |
|
103
|
0
|
|
|
0
|
0
|
|
my ( $self, $string ) = @_; |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Get Year |
|
106
|
0
|
|
|
|
|
|
my $year; |
|
107
|
0
|
0
|
|
|
|
|
if ( $string =~ m{.+\((\d{4})\)$} ) { |
|
108
|
0
|
|
|
|
|
|
$year = $1; |
|
109
|
0
|
|
|
|
|
|
$string =~ s{\($year\)$}{}; |
|
110
|
|
|
|
|
|
|
} ## end if ( $string =~ m{.+\((\d{4})\)$}) |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# Trim |
|
113
|
0
|
|
|
|
|
|
$string =~ s{(?:^\s+)|(?:\s+$)}{}; |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# Search |
|
116
|
0
|
|
|
|
|
|
my $params = { |
|
117
|
|
|
|
|
|
|
query => $string, |
|
118
|
|
|
|
|
|
|
include_adult => $self->include_adult, |
|
119
|
|
|
|
|
|
|
}; |
|
120
|
0
|
0
|
|
|
|
|
$params->{language} = $self->session->lang if $self->session->lang; |
|
121
|
0
|
0
|
|
|
|
|
$params->{year} = $year if $year; |
|
122
|
|
|
|
|
|
|
|
|
123
|
0
|
0
|
|
|
|
|
warn "DEBUG: Searching for $string\n" if $self->session->debug; |
|
124
|
0
|
|
|
|
|
|
return $self->_search( |
|
125
|
|
|
|
|
|
|
{ |
|
126
|
|
|
|
|
|
|
method => 'search/tv', |
|
127
|
|
|
|
|
|
|
params => $params, |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
); |
|
130
|
|
|
|
|
|
|
} ## end sub tv |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
## ==================== |
|
133
|
|
|
|
|
|
|
## Search Person |
|
134
|
|
|
|
|
|
|
## ==================== |
|
135
|
|
|
|
|
|
|
sub person { |
|
136
|
0
|
|
|
0
|
0
|
|
my ( $self, $string ) = @_; |
|
137
|
|
|
|
|
|
|
|
|
138
|
0
|
0
|
|
|
|
|
warn "DEBUG: Searching for $string\n" if $self->session->debug; |
|
139
|
0
|
|
|
|
|
|
return $self->_search( |
|
140
|
|
|
|
|
|
|
{ |
|
141
|
|
|
|
|
|
|
method => 'search/person', |
|
142
|
|
|
|
|
|
|
params => { |
|
143
|
|
|
|
|
|
|
query => $string, |
|
144
|
|
|
|
|
|
|
}, |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
); |
|
147
|
|
|
|
|
|
|
} ## end sub person |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
## ==================== |
|
150
|
|
|
|
|
|
|
## Search Companies |
|
151
|
|
|
|
|
|
|
## ==================== |
|
152
|
|
|
|
|
|
|
sub company { |
|
153
|
0
|
|
|
0
|
0
|
|
my ( $self, $string ) = @_; |
|
154
|
|
|
|
|
|
|
|
|
155
|
0
|
0
|
|
|
|
|
warn "DEBUG: Searching for $string\n" if $self->session->debug; |
|
156
|
0
|
|
|
|
|
|
return $self->_search( |
|
157
|
|
|
|
|
|
|
{ |
|
158
|
|
|
|
|
|
|
method => 'search/company', |
|
159
|
|
|
|
|
|
|
params => { |
|
160
|
|
|
|
|
|
|
query => $string, |
|
161
|
|
|
|
|
|
|
}, |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
); |
|
164
|
|
|
|
|
|
|
} ## end sub company |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
## ==================== |
|
167
|
|
|
|
|
|
|
## Search Lists |
|
168
|
|
|
|
|
|
|
## ==================== |
|
169
|
|
|
|
|
|
|
sub list { |
|
170
|
0
|
|
|
0
|
0
|
|
my ( $self, $string ) = @_; |
|
171
|
|
|
|
|
|
|
|
|
172
|
0
|
0
|
|
|
|
|
warn "DEBUG: Searching for $string\n" if $self->session->debug; |
|
173
|
0
|
|
|
|
|
|
return $self->_search( |
|
174
|
|
|
|
|
|
|
{ |
|
175
|
|
|
|
|
|
|
method => 'search/list', |
|
176
|
|
|
|
|
|
|
params => { |
|
177
|
|
|
|
|
|
|
query => $string, |
|
178
|
|
|
|
|
|
|
}, |
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
); |
|
181
|
|
|
|
|
|
|
} ## end sub list |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
## ==================== |
|
184
|
|
|
|
|
|
|
## Search Keywords |
|
185
|
|
|
|
|
|
|
## ==================== |
|
186
|
|
|
|
|
|
|
sub keyword { |
|
187
|
0
|
|
|
0
|
0
|
|
my ( $self, $string ) = @_; |
|
188
|
|
|
|
|
|
|
|
|
189
|
0
|
0
|
|
|
|
|
warn "DEBUG: Searching for $string\n" if $self->session->debug; |
|
190
|
0
|
|
|
|
|
|
return $self->_search( |
|
191
|
|
|
|
|
|
|
{ |
|
192
|
|
|
|
|
|
|
method => 'search/keyword', |
|
193
|
|
|
|
|
|
|
params => { |
|
194
|
|
|
|
|
|
|
query => $string, |
|
195
|
|
|
|
|
|
|
}, |
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
); |
|
198
|
|
|
|
|
|
|
} ## end sub keyword |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
## ==================== |
|
201
|
|
|
|
|
|
|
## Search Collection |
|
202
|
|
|
|
|
|
|
## ==================== |
|
203
|
|
|
|
|
|
|
sub collection { |
|
204
|
0
|
|
|
0
|
0
|
|
my ( $self, $string ) = @_; |
|
205
|
|
|
|
|
|
|
|
|
206
|
0
|
0
|
|
|
|
|
warn "DEBUG: Searching for $string\n" if $self->session->debug; |
|
207
|
0
|
|
|
|
|
|
return $self->_search( |
|
208
|
|
|
|
|
|
|
{ |
|
209
|
|
|
|
|
|
|
method => 'search/collection', |
|
210
|
|
|
|
|
|
|
params => { |
|
211
|
|
|
|
|
|
|
query => $string, |
|
212
|
|
|
|
|
|
|
}, |
|
213
|
|
|
|
|
|
|
} |
|
214
|
|
|
|
|
|
|
); |
|
215
|
|
|
|
|
|
|
} ## end sub collection |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
## ==================== |
|
218
|
|
|
|
|
|
|
## LISTS |
|
219
|
|
|
|
|
|
|
## ==================== |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
# Latest |
|
222
|
0
|
|
|
0
|
0
|
|
sub latest { return shift->session->talk( { method => 'movie/latest', } ); } |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
# Upcoming |
|
225
|
|
|
|
|
|
|
sub upcoming { |
|
226
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
227
|
0
|
0
|
|
|
|
|
return $self->_search( |
|
228
|
|
|
|
|
|
|
{ |
|
229
|
|
|
|
|
|
|
method => 'movie/upcoming', |
|
230
|
|
|
|
|
|
|
params => { |
|
231
|
|
|
|
|
|
|
language => $self->session->lang |
|
232
|
|
|
|
|
|
|
? $self->session->lang |
|
233
|
|
|
|
|
|
|
: undef, |
|
234
|
|
|
|
|
|
|
}, |
|
235
|
|
|
|
|
|
|
} |
|
236
|
|
|
|
|
|
|
); |
|
237
|
|
|
|
|
|
|
} ## end sub upcoming |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
# Now Playing |
|
240
|
|
|
|
|
|
|
sub now_playing { |
|
241
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
242
|
0
|
0
|
|
|
|
|
return $self->_search( |
|
243
|
|
|
|
|
|
|
{ |
|
244
|
|
|
|
|
|
|
method => 'movie/now-playing', |
|
245
|
|
|
|
|
|
|
params => { |
|
246
|
|
|
|
|
|
|
language => $self->session->lang |
|
247
|
|
|
|
|
|
|
? $self->session->lang |
|
248
|
|
|
|
|
|
|
: undef, |
|
249
|
|
|
|
|
|
|
}, |
|
250
|
|
|
|
|
|
|
} |
|
251
|
|
|
|
|
|
|
); |
|
252
|
|
|
|
|
|
|
} ## end sub now_playing |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
# Popular |
|
255
|
|
|
|
|
|
|
sub popular { |
|
256
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
257
|
0
|
0
|
|
|
|
|
return $self->_search( |
|
258
|
|
|
|
|
|
|
{ |
|
259
|
|
|
|
|
|
|
method => 'movie/popular', |
|
260
|
|
|
|
|
|
|
params => { |
|
261
|
|
|
|
|
|
|
language => $self->session->lang |
|
262
|
|
|
|
|
|
|
? $self->session->lang |
|
263
|
|
|
|
|
|
|
: undef, |
|
264
|
|
|
|
|
|
|
}, |
|
265
|
|
|
|
|
|
|
} |
|
266
|
|
|
|
|
|
|
); |
|
267
|
|
|
|
|
|
|
} ## end sub popular |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
# Top rated |
|
270
|
|
|
|
|
|
|
sub top_rated { |
|
271
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
272
|
0
|
0
|
|
|
|
|
return $self->_search( |
|
273
|
|
|
|
|
|
|
{ |
|
274
|
|
|
|
|
|
|
method => 'movie/top-rated', |
|
275
|
|
|
|
|
|
|
params => { |
|
276
|
|
|
|
|
|
|
language => $self->session->lang |
|
277
|
|
|
|
|
|
|
? $self->session->lang |
|
278
|
|
|
|
|
|
|
: undef, |
|
279
|
|
|
|
|
|
|
}, |
|
280
|
|
|
|
|
|
|
} |
|
281
|
|
|
|
|
|
|
); |
|
282
|
|
|
|
|
|
|
} ## end sub top_rated |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
# Popular People |
|
285
|
|
|
|
|
|
|
sub popular_people { |
|
286
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
287
|
0
|
0
|
|
|
|
|
return $self->_search( |
|
288
|
|
|
|
|
|
|
{ |
|
289
|
|
|
|
|
|
|
method => 'person/popular', |
|
290
|
|
|
|
|
|
|
params => { |
|
291
|
|
|
|
|
|
|
language => $self->session->lang |
|
292
|
|
|
|
|
|
|
? $self->session->lang |
|
293
|
|
|
|
|
|
|
: undef, |
|
294
|
|
|
|
|
|
|
}, |
|
295
|
|
|
|
|
|
|
} |
|
296
|
|
|
|
|
|
|
); |
|
297
|
|
|
|
|
|
|
} ## end sub popular_people |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
# Latest Person |
|
300
|
|
|
|
|
|
|
sub latest_person { |
|
301
|
|
|
|
|
|
|
return shift->session->talk( |
|
302
|
|
|
|
|
|
|
{ |
|
303
|
0
|
|
|
0
|
0
|
|
method => 'person/latest', |
|
304
|
|
|
|
|
|
|
} |
|
305
|
|
|
|
|
|
|
); |
|
306
|
|
|
|
|
|
|
} ## end sub latest_person |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
####################### |
|
309
|
|
|
|
|
|
|
# DISCOVER |
|
310
|
|
|
|
|
|
|
####################### |
|
311
|
|
|
|
|
|
|
sub discover { |
|
312
|
0
|
|
|
0
|
0
|
|
my ( $self, @args ) = @_; |
|
313
|
|
|
|
|
|
|
my %options = validate_with( |
|
314
|
|
|
|
|
|
|
params => [@args], |
|
315
|
|
|
|
|
|
|
spec => { |
|
316
|
|
|
|
|
|
|
sort_by => { |
|
317
|
|
|
|
|
|
|
type => SCALAR, |
|
318
|
|
|
|
|
|
|
optional => 1, |
|
319
|
|
|
|
|
|
|
default => 'popularity.asc', |
|
320
|
|
|
|
|
|
|
callbacks => { |
|
321
|
|
|
|
|
|
|
'valid flag' => sub { |
|
322
|
0
|
0
|
0
|
0
|
|
|
( lc $_[0] eq 'vote_average.desc' ) |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
323
|
|
|
|
|
|
|
or ( lc $_[0] eq 'vote_average.asc' ) |
|
324
|
|
|
|
|
|
|
or ( lc $_[0] eq 'release_date.desc' ) |
|
325
|
|
|
|
|
|
|
or ( lc $_[0] eq 'release_date.asc' ) |
|
326
|
|
|
|
|
|
|
or ( lc $_[0] eq 'popularity.desc' ) |
|
327
|
|
|
|
|
|
|
or ( lc $_[0] eq 'popularity.asc' ); |
|
328
|
|
|
|
|
|
|
}, |
|
329
|
|
|
|
|
|
|
}, |
|
330
|
|
|
|
|
|
|
}, |
|
331
|
|
|
|
|
|
|
year => { |
|
332
|
|
|
|
|
|
|
type => SCALAR, |
|
333
|
|
|
|
|
|
|
optional => 1, |
|
334
|
|
|
|
|
|
|
regex => qr/^\d{4}$/ |
|
335
|
|
|
|
|
|
|
}, |
|
336
|
|
|
|
|
|
|
primary_release_year => { |
|
337
|
|
|
|
|
|
|
type => SCALAR, |
|
338
|
|
|
|
|
|
|
optional => 1, |
|
339
|
|
|
|
|
|
|
regex => qr/^\d{4}$/ |
|
340
|
|
|
|
|
|
|
}, |
|
341
|
|
|
|
|
|
|
'release_date.gte' => { |
|
342
|
|
|
|
|
|
|
type => SCALAR, |
|
343
|
|
|
|
|
|
|
optional => 1, |
|
344
|
|
|
|
|
|
|
regex => qr/^\d{4}\-\d{2}\-\d{2}$/ |
|
345
|
|
|
|
|
|
|
}, |
|
346
|
|
|
|
|
|
|
'release_date.lte' => { |
|
347
|
|
|
|
|
|
|
type => SCALAR, |
|
348
|
|
|
|
|
|
|
optional => 1, |
|
349
|
|
|
|
|
|
|
regex => qr/^\d{4}\-\d{2}\-\d{2}$/ |
|
350
|
|
|
|
|
|
|
}, |
|
351
|
|
|
|
|
|
|
'vote_count.gte' => { |
|
352
|
|
|
|
|
|
|
type => SCALAR, |
|
353
|
|
|
|
|
|
|
optional => 1, |
|
354
|
|
|
|
|
|
|
regex => qr/^\d+$/ |
|
355
|
|
|
|
|
|
|
}, |
|
356
|
|
|
|
|
|
|
'vote_average.gte' => { |
|
357
|
|
|
|
|
|
|
type => SCALAR, |
|
358
|
|
|
|
|
|
|
optional => 1, |
|
359
|
|
|
|
|
|
|
regex => qr/^\d{1,2}\.\d{1,}$/, |
|
360
|
|
|
|
|
|
|
callbacks => { |
|
361
|
0
|
|
|
0
|
|
|
average => sub { $_[0] <= 10 }, |
|
362
|
|
|
|
|
|
|
}, |
|
363
|
|
|
|
|
|
|
}, |
|
364
|
0
|
|
|
|
|
|
with_genres => { |
|
365
|
|
|
|
|
|
|
type => SCALAR, |
|
366
|
|
|
|
|
|
|
optional => 1, |
|
367
|
|
|
|
|
|
|
}, |
|
368
|
|
|
|
|
|
|
with_companies => { |
|
369
|
|
|
|
|
|
|
type => SCALAR, |
|
370
|
|
|
|
|
|
|
optional => 1, |
|
371
|
|
|
|
|
|
|
}, |
|
372
|
|
|
|
|
|
|
}, |
|
373
|
|
|
|
|
|
|
); |
|
374
|
|
|
|
|
|
|
|
|
375
|
0
|
0
|
|
|
|
|
return $self->_search( |
|
376
|
|
|
|
|
|
|
{ |
|
377
|
|
|
|
|
|
|
method => 'discover/movie', |
|
378
|
|
|
|
|
|
|
params => { |
|
379
|
|
|
|
|
|
|
language => $self->session->lang |
|
380
|
|
|
|
|
|
|
? $self->session->lang |
|
381
|
|
|
|
|
|
|
: undef, |
|
382
|
|
|
|
|
|
|
include_adult => $self->include_adult, |
|
383
|
|
|
|
|
|
|
%options, |
|
384
|
|
|
|
|
|
|
}, |
|
385
|
|
|
|
|
|
|
} |
|
386
|
|
|
|
|
|
|
); |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
} ## end sub discover |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
####################### |
|
391
|
|
|
|
|
|
|
# FIND |
|
392
|
|
|
|
|
|
|
####################### |
|
393
|
|
|
|
|
|
|
sub find { |
|
394
|
0
|
|
|
0
|
0
|
|
my ( $self, @args ) = @_; |
|
395
|
0
|
|
|
|
|
|
my %options = validate_with( |
|
396
|
|
|
|
|
|
|
params => [@args], |
|
397
|
|
|
|
|
|
|
spec => { |
|
398
|
|
|
|
|
|
|
id => { |
|
399
|
|
|
|
|
|
|
type => SCALAR, |
|
400
|
|
|
|
|
|
|
}, |
|
401
|
|
|
|
|
|
|
source => { |
|
402
|
|
|
|
|
|
|
type => SCALAR, |
|
403
|
|
|
|
|
|
|
}, |
|
404
|
|
|
|
|
|
|
}, |
|
405
|
|
|
|
|
|
|
); |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
return $self->session->talk( |
|
408
|
|
|
|
|
|
|
{ |
|
409
|
|
|
|
|
|
|
method => 'find/' . $options{id}, |
|
410
|
|
|
|
|
|
|
params => { |
|
411
|
|
|
|
|
|
|
external_source => $options{source}, |
|
412
|
0
|
0
|
|
|
|
|
language => $self->session->lang |
|
413
|
|
|
|
|
|
|
? $self->session->lang |
|
414
|
|
|
|
|
|
|
: undef, |
|
415
|
|
|
|
|
|
|
} |
|
416
|
|
|
|
|
|
|
} |
|
417
|
|
|
|
|
|
|
); |
|
418
|
|
|
|
|
|
|
} ## end sub find |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
####################### |
|
421
|
|
|
|
|
|
|
# PRIVATE METHODS |
|
422
|
|
|
|
|
|
|
####################### |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
## ==================== |
|
425
|
|
|
|
|
|
|
## Search |
|
426
|
|
|
|
|
|
|
## ==================== |
|
427
|
|
|
|
|
|
|
sub _search { |
|
428
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
429
|
0
|
|
|
|
|
|
my $args = shift; |
|
430
|
0
|
|
|
|
|
|
$args->{max_pages} = $self->max_pages(); |
|
431
|
0
|
|
|
|
|
|
return $self->session->paginate_results($args); |
|
432
|
|
|
|
|
|
|
} ## end sub _search |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
####################### |
|
435
|
|
|
|
|
|
|
1; |