use constant for shorts

This commit is contained in:
2025-04-11 13:17:06 +04:00
parent c69c6e7c4e
commit 2e894cc1d7
2 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -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;