update poster service
This commit is contained in:
parent
6198a0732c
commit
cf8e33ec65
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
$id = $_GET['id'];
|
||||
$data = json_decode(file_get_contents("http://rlx:luxor@0xdb.org/$id/posterData.json"), true);
|
||||
$data = json_decode(file_get_contents("http://0xdb.org/$id/posterData.json"), true);
|
||||
$director = utf8_decode($data['director']);
|
||||
$title = utf8_decode($data['title']);
|
||||
$url = "http://rlx:luxor@0xdb.org/$id/posterStill.png";
|
||||
$url = "http://0xdb.org/$id/posterStill.png";
|
||||
|
||||
$md5 = md5("$director/$title");
|
||||
$rPoster = round(hexdec(substr($md5, 0, 2)) / 2);
|
||||
|
@ -125,4 +125,4 @@ function formatString($string, $width) {
|
|||
return explode("\n", wordwrap($string, $width));
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,25 @@
|
|||
<?
|
||||
|
||||
$i = 0;
|
||||
$path = 'posters/0xdb.org';
|
||||
$dir = dir($path);
|
||||
while ($file = $dir->read()) {
|
||||
if (substr($file, 0, 1) != '.') {
|
||||
$subdir = dir($path . '/' . $file);
|
||||
while ($subfile = $subdir->read()) {
|
||||
if (substr($subfile, 0, 1) != '.') {
|
||||
$url = "http://services.0xdb.org/posters/$path/$file/$subfile";
|
||||
$size = getimagesize($url);
|
||||
echo "poster[$i] = [];\n";
|
||||
echo "poster[$i]['url'] = '$url';\n";
|
||||
echo "poster[$i]['width'] = " . $size[0] . ";\n";
|
||||
echo "poster[$i]['height'] = " . $size[1] . ";\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rnd = floor(mt_rand() / mt_getrandmax() * count($poster));
|
||||
|
||||
?>
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
|
||||
|
||||
$id = str_pad($_GET['id'], 7, '0', STR_PAD_LEFT);
|
||||
$id = $_GET['id'];
|
||||
if (strlen($id) < 7)
|
||||
$id = str_pad($id, 7, '0', STR_PAD_LEFT);
|
||||
$size = $_GET['size'];
|
||||
if ($size != 'large')
|
||||
$size = 'small';
|
||||
|
@ -85,7 +87,7 @@ function returnPoster($id, $size) {
|
|||
}
|
||||
|
||||
foreach ($source as $value) {
|
||||
if ($file[$value])
|
||||
if ($file[$value] && substr($file[$value], 0, 1) != '_')
|
||||
returnImage($id, $size, $file[$value]);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?
|
||||
<?php
|
||||
|
||||
include('php/library.php');
|
||||
|
||||
if (!$id)
|
||||
die('poster.php returns a poster for a given IMDb id<br />usage: poster.php?id=ID[&size=SIZE]<br />ID: IMDb id<br />POSTER: small [128px] or large [512px]');
|
||||
if (!in_array(strlen($id), array(7, 34)))
|
||||
die ('poster.php returns a poster for a given IMDb id<br />usage: poster.php?id=ID[&size=SIZE]<br />ID: IMDb id<br />SIZE: small [128px] or large [512px]');
|
||||
|
||||
returnPoster($id, $size);
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
add posters
|
||||
|
||||
--This line, and those below, will be ignored--
|
||||
|
||||
A .
|
Loading…
Reference in New Issue