Actualiser api.php
This commit is contained in:
@@ -140,28 +140,9 @@ function fetchFromGoUpc($ean) {
|
|||||||
$empty['poster'] = trim($m[1]);
|
$empty['poster'] = trim($m[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ✅ NETTOYAGE DU TITRE
|
// Nettoyage du titre
|
||||||
if (!empty($empty['title'])) {
|
if (!empty($empty['title'])) {
|
||||||
$empty['title'] = html_entity_decode($empty['title'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
$empty['title'] = html_entity_decode($empty['title'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||||
|
|
||||||
// ✅ APPLIQUER cleanTitle() pour supprimer les suffixes comme "- DVD", "- Édition Collector"
|
|
||||||
$empty['title'] = cleanTitle($empty['title']);
|
|
||||||
|
|
||||||
// ✅ Supprimer le nom du réalisateur au début si présent
|
|
||||||
// Pattern : "Prénom Nom Titre du film" → "Titre du film"
|
|
||||||
// Exemple : "Lilly Wachowski Matrix" → "Matrix"
|
|
||||||
// Exemple : "Andrew Niccol Lord Of War" → "Lord Of War"
|
|
||||||
if (preg_match('/^([A-Z][a-z]+\s+[A-Z][a-z]+)\s+(.+)$/u', $empty['title'], $nameMatch)) {
|
|
||||||
$possibleDirector = $nameMatch[1];
|
|
||||||
$possibleTitle = $nameMatch[2];
|
|
||||||
|
|
||||||
// Vérifier si le "titre" restant semble être un vrai titre (pas juste un mot)
|
|
||||||
if (strlen($possibleTitle) > 3 && !preg_match('/^(DVD|Blu-ray|4K|VHS|CD|Vinyl)$/i', $possibleTitle)) {
|
|
||||||
$empty['director'] = $possibleDirector;
|
|
||||||
$empty['title'] = $possibleTitle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$empty['title'] = trim($empty['title']);
|
$empty['title'] = trim($empty['title']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user