-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsearch.php
39 lines (30 loc) · 1.01 KB
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require_once('_include.php');
$query = trim($query);
if(strlen($query) < 3) return;
// Search
$search = file_get_contents($host.'/api/'.$api.'/movie.search/?q=' . urlencode($query));
$results = json_decode($search);
foreach($results->movies as $result){
$in_wanted = null;
$in_library = null;
if($result->in_wanted)
$in_wanted = 'In wanted: ' . $result->in_wanted->profile->label;
if($result->in_library){
$in_library = '';
if($in_wanted) $in_library = ', ';
$in_library .= 'In library: ';
$in_library .= $result->in_library->releases[0]->quality->label;
}
$w->result(array(
'uid' => $result->imdb,
'arg' => $result->imdb,
'title' => $result->original_title . ($result->year ? ' ('.$result->year.')' : ''),
'subtitle' => $in_wanted . ' ' . $in_library,
'icon' => $result->images->poster[0],
'valid' => 'yes',
'autocomplete' => 'autocomplete'
));
}
header('Content-type: text/xml; charset=utf-8');
echo $w->toXML();