Actualiser api.php
This commit is contained in:
@@ -473,7 +473,7 @@ function fetchFromMovieCovers($title, $year = '') {
|
||||
return $empty;
|
||||
}
|
||||
|
||||
// ── AGGREGATEUR PHYSIQUE (VERSION MODIFIÉE AVEC GO-UPC ET UPCINDEX) ──
|
||||
// Dans la fonction fetchPhysicalByEan - Ligne ~780
|
||||
function fetchPhysicalByEan($ean, $pdo = null) {
|
||||
error_log("=== DEBUT fetchPhysicalByEan EAN=$ean ===");
|
||||
|
||||
@@ -532,21 +532,25 @@ function fetchPhysicalByEan($ean, $pdo = null) {
|
||||
if (!empty($blurayData['aspect_ratio'])) $res['aspect_ratio'] = $blurayData['aspect_ratio'];
|
||||
if (!empty($blurayData['publisher'])) $res['publisher'] = $blurayData['publisher'];
|
||||
if (!empty($blurayData['format'])) $res['format'] = $blurayData['format'];
|
||||
if (!empty($blurayData['poster'])) $res['poster'] = $blurayData['poster'];
|
||||
// ⚠️ NE PAS ÉCRASER L'IMAGE DE GO-UPC
|
||||
// if (!empty($blurayData['poster'])) $res['poster'] = $blurayData['poster'];
|
||||
if (!empty($blurayData['year'])) $res['year'] = $blurayData['year'];
|
||||
}
|
||||
|
||||
// 6. MovieCovers (par titre)
|
||||
// 6. MovieCovers (par titre) - Pour jaquette HD FR
|
||||
if (!empty($title)) {
|
||||
$mc = fetchFromMovieCovers($title, $res['year'] ?? '');
|
||||
error_log("MOVIECOVERS -> poster='" . ($mc['poster'] ?? '') . "'");
|
||||
if (!empty($mc['poster'])) $res['poster'] = $mc['poster'];
|
||||
// ⚠️ PRIORITÉ À L'IMAGE DE GO-UPC, SINON MOVIECOVERS
|
||||
if (empty($res['poster']) && !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'];
|
||||
}
|
||||
|
||||
error_log("=== FIN fetchPhysicalByEan -> title FINAL='" . ($res['title'] ?? '') . "' ===");
|
||||
error_log("=== FIN fetchPhysicalByEan -> title FINAL='" . ($res['title'] ?? '') . "' poster='" . ($res['poster'] ?? '') . "' ===");
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -666,7 +670,10 @@ switch ($action) {
|
||||
$tmdbData = fetchTmdbPosterAndSynopsis($rawTitle, $physicalData['year'] ?? '', $pdo);
|
||||
|
||||
$finalTitle = !empty($tmdbData['title']) ? $tmdbData['title'] : $rawTitle;
|
||||
$poster = ($tmdbData['poster'] !== 'assets/img/default_physical_media.jpg') ? $tmdbData['poster'] : ($physicalData['poster'] ?? '');
|
||||
|
||||
// ✅ PRIORITÉ À L'IMAGE DE GO-UPC/PHYSICAL DATA
|
||||
$poster = !empty($physicalData['poster']) ? $physicalData['poster'] :
|
||||
(($tmdbData['poster'] !== 'assets/img/default_physical_media.jpg') ? $tmdbData['poster'] : 'assets/img/default_physical_media.jpg');
|
||||
|
||||
$year = $tmdbData['year'] ?? $physicalData['year'] ?? '';
|
||||
$id = makeStableId('videotheque', $finalTitle, $year);
|
||||
@@ -708,7 +715,10 @@ switch ($action) {
|
||||
$discs = $physicalData['number_of_discs'] ?: 1;
|
||||
$aspect = $physicalData['aspect_ratio'] ?? '';
|
||||
$length = $physicalData['length'] ?? '';
|
||||
$poster = $physicalData['poster'] ?? '';
|
||||
|
||||
// ✅ PRIORITÉ À L'IMAGE DE GO-UPC
|
||||
$poster = !empty($physicalData['poster']) ? $physicalData['poster'] : 'assets/img/default_physical_media.jpg';
|
||||
|
||||
$desc = $physicalData['description'] ?? '';
|
||||
$director = $physicalData['director'] ?? '';
|
||||
$actors = $physicalData['actors'] ?? '';
|
||||
@@ -716,7 +726,10 @@ switch ($action) {
|
||||
if (empty($poster) || empty($director) || empty($actors) || empty($desc) || empty($title)) {
|
||||
$tmdb = fetchTmdbPosterAndSynopsis($title, $year, $pdo);
|
||||
if (empty($title)) $title = $tmdb['title'] ?? "EAN: $ean";
|
||||
if (empty($poster) || $poster === 'assets/img/default_physical_media.jpg') $poster = $tmdb['poster'];
|
||||
// ⚠️ NE PAS ÉCRASER L'IMAGE DE GO-UPC
|
||||
if (empty($poster) && $tmdb['poster'] !== 'assets/img/default_physical_media.jpg') {
|
||||
$poster = $tmdb['poster'];
|
||||
}
|
||||
if (empty($director)) $director = $tmdb['director'] ?? '';
|
||||
if (empty($actors)) $actors = $tmdb['actors'] ?? '';
|
||||
if (empty($desc)) $desc = $tmdb['description'] ?? '';
|
||||
|
||||
Reference in New Issue
Block a user