diff --git a/includes/config.local.php.sample b/includes/config.local.php.sample index eec6a41..4b3ee17 100644 --- a/includes/config.local.php.sample +++ b/includes/config.local.php.sample @@ -75,6 +75,7 @@ // Nombre de shorts // define('SHORTS_COUNT', 6); +// define('SHORTS_COUNT_SEARCH', 50) // Nombre de vidéos tendances // define('TRENDING_VIDEOS_COUNT', 6); diff --git a/includes/config.php b/includes/config.php index 3858cc0..7e1819f 100644 --- a/includes/config.php +++ b/includes/config.php @@ -27,6 +27,7 @@ if (!defined('VIDEOS_PER_PAGE')) define('VIDEOS_PER_PAGE', 12); if (!defined('FEATURED_VIDEOS_COUNT')) define('FEATURED_VIDEOS_COUNT', 6); if (!defined('RECENT_VIDEOS_COUNT')) define('RECENT_VIDEOS_COUNT', 6); if (!defined('SHORTS_COUNT')) define('SHORTS_COUNT', 6); +if (!defined('SHORTS_COUNT_SEARCH')) define('SHORTS_COUNT_SEARCH', 50); if (!defined('TRENDING_VIDEOS_COUNT')) define('TRENDING_VIDEOS_COUNT', 6); if (!defined('INDEPENDENCE_VIDEOS_COUNT')) define('INDEPENDENCE_VIDEOS_COUNT', 6); if (!defined('CATEGORY_VIDEOS_COUNT')) define('CATEGORY_VIDEOS_COUNT', 6); @@ -303,7 +304,7 @@ function getShorts($count = SHORTS_COUNT) { // Récupérer plus de vidéos que nécessaire pour pouvoir filtrer $data = callPeerTubeApi('videos', [ 'sort' => '-publishedAt', // Les plus récentes d'abord - 'count' => $count * 3, // Récupérer plus de vidéos pour pouvoir filtrer + 'count' => SHORTS_COUNT_SEARCH, 'isLocal' => true ]); @@ -313,7 +314,7 @@ function getShorts($count = SHORTS_COUNT) { // Filtrer pour ne garder que les vidéos de moins de 2 minutes (120 secondes) et en mode portrait $shortVideos = array_filter($allVideos, function($video) { // Vérifier la durée (moins de 2 minutes) - $durationOk = $video['duration'] < 120; + $durationOk = $video['duration'] < SHORTS_MAX_DURATION; // Vérifier le ratio (mode portrait) $ratioOk = isset($video['aspectRatio']) && $video['aspectRatio'] <= 1;