Actualiser api.php
This commit is contained in:
@@ -205,12 +205,38 @@ function fetchPhysicalFromUpcmdb($ean, $pdo) {
|
||||
}
|
||||
|
||||
function fetchPhysicalByEan($ean, $pdo = null) {
|
||||
// 1. Essayer UPCitemdb
|
||||
$res = fetchPhysicalFromUpcitemdb($ean);
|
||||
if (!empty($res['title'])) return $res;
|
||||
if (!empty($res['title'])) {
|
||||
// 2. Chercher sur MovieCovers avec le titre trouvé
|
||||
$mc = fetchFromMovieCovers($res['title'], $res['year']);
|
||||
if (!empty($mc['poster'])) {
|
||||
$res['poster'] = $mc['poster'];
|
||||
}
|
||||
if (!empty($mc['director'])) {
|
||||
$res['director'] = $mc['director'];
|
||||
}
|
||||
if (!empty($mc['actors'])) {
|
||||
$res['actors'] = $mc['actors'];
|
||||
}
|
||||
if (!empty($mc['description'])) {
|
||||
$res['description'] = $mc['description'];
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
// 3. Fallback UPCMDB
|
||||
if ($pdo) {
|
||||
$fb = fetchPhysicalFromUpcmdb($ean, $pdo);
|
||||
if (!empty($fb['title'])) return $fb;
|
||||
if (!empty($fb['title'])) {
|
||||
$mc = fetchFromMovieCovers($fb['title'], $fb['year']);
|
||||
if (!empty($mc['poster'])) {
|
||||
$fb['poster'] = $mc['poster'];
|
||||
}
|
||||
return $fb;
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user