]*class=[\'"](?:affiche|poster|movie-poster)[^"]*"[^>]*>.*?
![]()
]*src=[\'"]([^\'"]+)[\'"][^>]*>/is', $filmRes, $imgMatches)) {
+ $posterUrl = $imgMatches[1];
}
-
- // Méthode 3 : Chercher toute image de jaquette
- if (empty($posterUrl)) {
- if (preg_match('/https?:\/\/[ac]\.notrecinema\.com\/[^"\']+\/jaquette[^"\']*\.jpg/i', $jaquettesRes, $imgMatches)) {
- $posterUrl = $imgMatches[0];
- }
+ // Méthode 3 : Chercher toute image de film
+ elseif (preg_match('/
![]()
]*src=[\'"](https?:\/\/www\.cinemapassion\.com\/[^\'"]*\/?(?:affiches|posters|images|films)[^\'"]*\.(?:jpg|jpeg|png|webp))[^>]*>/i', $filmRes, $imgMatches)) {
+ $posterUrl = $imgMatches[1];
}
if (!empty($posterUrl)) {
// S'assurer que l'URL est absolue
if (strpos($posterUrl, 'http') !== 0) {
- $posterUrl = 'https://www.notrecinema.com' . $posterUrl;
+ $posterUrl = 'https://www.cinemapassion.com' . (strpos($posterUrl, '/') === 0 ? '' : '/') . $posterUrl;
}
- // Convertir les vignettes en images complètes si possible
- $posterUrl = str_replace('/vign/', '/', $posterUrl);
- $posterUrl = str_replace('vign_', '', $posterUrl);
-
return [
'poster' => $posterUrl,
'title' => $cleanTitle,
@@ -193,25 +177,27 @@ function fetchNotreCinema($title, $year = '', $ean = '', $pdo = null) {
}
}
}
- }
-
- // ÉTAPE 3 : Recherche alternative par EAN si disponible
- if (!empty($ean)) {
- $cleanEan = preg_replace('/[^0-9]/', '', $ean);
- $searchUrl = "https://www.notrecinema.com/communaute/recherche.php3?recherche=" . urlencode($cleanEan);
- $searchRes = httpGet($searchUrl, 10, $userAgent);
-
- if ($searchRes && preg_match('/v1_detail_film\.php3\?lefilm=(\d+)/i', $searchRes, $matches)) {
- $filmId = $matches[1];
- $jaquettesUrl = "https://www.notrecinema.com/communaute/pdf/complete.php3?lefilm=" . $filmId;
- $jaquettesRes = httpGet($jaquettesUrl, 10, $userAgent);
+ // ÉTAPE 2 : Recherche alternative par EAN si disponible
+ if (!empty($ean)) {
+ $cleanEan = preg_replace('/[^0-9]/', '', $ean);
+ $searchUrl = "https://www.cinemapassion.com/recherche.php?recherche=" . urlencode($cleanEan);
- if ($jaquettesRes) {
- if (preg_match('/https?:\/\/[ac]\.notrecinema\.com\/[^"\']+\/jaquette[^"\']*\.jpg/i', $jaquettesRes, $imgMatches)) {
- $posterUrl = $imgMatches[0];
- $posterUrl = str_replace('/vign/', '/', $posterUrl);
- $posterUrl = str_replace('vign_', '', $posterUrl);
+ $searchRes = httpGet($searchUrl, 10, $userAgent);
+
+ if ($searchRes && preg_match('/
]*>/i', $searchRes, $matches)) {
+ $filmUrl = $matches[1];
+ if (strpos($filmUrl, 'http') !== 0) {
+ $filmUrl = 'https://www.cinemapassion.com' . (strpos($filmUrl, '/') === 0 ? '' : '/') . $filmUrl;
+ }
+
+ $filmRes = httpGet($filmUrl, 10, $userAgent);
+
+ if ($filmRes && preg_match('/
]*src=[\'"](https?:\/\/www\.cinemapassion\.com\/[^\'"]*\/?(?:affiches|posters|images|films)[^\'"]*\.(?:jpg|jpeg|png|webp))[^>]*>/i', $filmRes, $imgMatches)) {
+ $posterUrl = $imgMatches[1];
+ if (strpos($posterUrl, 'http') !== 0) {
+ $posterUrl = 'https://www.cinemapassion.com' . (strpos($posterUrl, '/') === 0 ? '' : '/') . $posterUrl;
+ }
return [
'poster' => $posterUrl,
@@ -555,9 +541,9 @@ case 'get_config_keys':
$id = makeStableId('videotheque', $title, $year);
- // Utiliser notrecinema.com pour récupérer l'image
- $notreCinemaData = fetchNotreCinema($title, $year, $ean, $pdo);
- $poster = $notreCinemaData['poster'];
+ // Utiliser cinemapassion.com pour récupérer l'image
+ $cinemaPassionData = fetchCinemaPassion($title, $year, $ean, $pdo);
+ $poster = $cinemaPassionData['poster'];
// Déterminer le format
$format = 'Blu-ray';
@@ -598,13 +584,14 @@ case 'get_config_keys':
echo json_encode(["success" => true, "imported" => $imported]);
break;
- case 'debug_notrecinema':
- $title = $_GET['title'] ?? '';
- $year = $_GET['year'] ?? '';
-
- $result = fetchNotreCinema($title, $year, '', $pdo);
- echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
- exit;
- break;
+ case 'debug_cinemapassion':
+ $title = $_GET['title'] ?? '';
+ $year = $_GET['year'] ?? '';
+ $ean = $_GET['ean'] ?? '';
+
+ $result = fetchCinemaPassion($title, $year, $ean, $pdo);
+ echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
+ exit;
+ break;
}
?>
\ No newline at end of file