diff --git a/www/boris/youtube.php b/www/boris/youtube.php index d6124c6..7ab0375 100644 --- a/www/boris/youtube.php +++ b/www/boris/youtube.php @@ -2,6 +2,12 @@ require_once('conf.php'); require_once('functions.php'); +$i = 0; +$div = 9; +$r = rand(0, ($div - 1)); +$j = 0; +$maxElt = 16; + // require('php-ipfs-api/vendor/autoload.php'); // use Cloutier\PhpIpfsApi\IPFS; // $ipfs = new IPFS("astroport", "8181", IPFS_API_PORT); @@ -12,6 +18,7 @@ require_once('functions.php'); $uriParams = []; $videosList = array(); +$videosListURIs = array(); $search = isset($_GET['search']) ? urldecode($_GET['search']) : ""; exec("/bin/bash -c './get_astrxbian_index.sh \"*\" \"". $search . "\"'", $videos); exec("/bin/bash -c './get_PIN.sh'", $pinnedVideos); @@ -23,10 +30,6 @@ exec("/bin/bash -c './get_PIN.sh'", $pinnedVideos); // echo shell_exec('whoami'); // Pour savoir quel utilisateur système exécute les scripts PHP // echo '
'; var_dump($videos); echo '
'; exit; -$i = 0; -$div = 9; -$r = rand(0, ($div - 1)); -$j = 0; $tagsMenu = array(); $narrowingTags = array(); $show = isset($_GET['show']) ? $_GET['show'] : 'pinned'; @@ -49,7 +52,7 @@ foreach ($videos as $v) { list($contentType, $videoID, $year, $filename, $saison, $tagsStr, $ipnsHash, $definition, $videoURI) = explode(";", $v); - if (in_array_column($videoURI, 'uri', $videosList)) { + if (in_array($videoURI, $videosListURIs)) { continue; } @@ -76,7 +79,6 @@ foreach ($videos as $v) { if ($keepVideo) { $narrowingTags = array_merge($narrowingTags, $videoTags); - /* ++$i; if ($i % $div != $r) { @@ -84,11 +86,12 @@ foreach ($videos as $v) { } ++$j; - if ($j > 9) { + if ($j > $maxElt) { break; } */ + $duration = NULL; $thumbURL = ''; $videoTitle = NULL; @@ -96,6 +99,7 @@ foreach ($videos as $v) { if (($contentType == 'youtube') and ($videoSource == 'www.youtube.com')) { $thumbURL = sprintf(YOUTUBE_THUMB, $videoID); + // $thumbURL = ''; // $json = getVideoJson($ipnsHash); @@ -115,6 +119,8 @@ foreach ($videos as $v) { $thumbURL = 'styles/'. THEME .'/font-awesome/film.white.90x90.png'; } + $videosListURIs[] = $videoURI; + $videosList[] = [ 'duration' => $duration, 'thumbURL' => $thumbURL,