Skip to content
This repository was archived by the owner on Jan 1, 2021. It is now read-only.

Commit 65f3985

Browse files
committed
Readded imdb api stuff
1 parent 12c15f1 commit 65f3985

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

imdb/list.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
include("../api_start.php");
3+
4+
5+
$listId = $_GET["listId"];
6+
7+
$listIds = exec("python IMDBAPI.py list $listId");
8+
//$ids = "1";
9+
$result = $db->query("SELECT m.* FROM movies m WHERE m.imdb_id in ($listIds)");
10+
11+
$response = array();
12+
13+
while ($arr = $result->fetch_assoc()) {
14+
$response[] = $arr;
15+
// var_dump($arr);
16+
}
17+
18+
$res = json_encode(utf8ize($response));
19+
20+
echo $res;
21+
22+
23+
?>

imdb/popular.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
include("../api_start.php");
3+
4+
$limit = $_GET["limit"];
5+
6+
$listIds = exec("python IMDBAPI.py popular $limit");
7+
$exploded = explode(",", $listIds);
8+
$orderedListIds = array();
9+
foreach($exploded as $id) {
10+
$orderedListIds[] = str_ireplace("'", "", $id);
11+
}
12+
//$ids = "1";
13+
$result = $db->query("SELECT m.* FROM movies m WHERE m.imdb_id in ($listIds)");
14+
15+
$response = array();
16+
17+
while ($arr = $result->fetch_assoc()) {
18+
$index = array_search($arr["imdb_id"], $orderedListIds);
19+
//var_dump($index);
20+
$response[$index] = $arr;
21+
// var_dump($arr);
22+
}
23+
24+
$resp = $response;
25+
ksort($resp);
26+
27+
$res = json_encode(utf8ize($resp));
28+
29+
echo $res;
30+
31+
32+
?>

0 commit comments

Comments
 (0)