Merge pull request '[FIX] Improvement of duplicate content detection and handling' (#36) from BorisPaing/astrXbian_UX-et-webUI:boris into master

Reviewed-on: #36
This commit is contained in:
qo-op 2021-09-22 20:14:01 +02:00
commit 4552f89d93
2 changed files with 18 additions and 1 deletions

View File

@ -228,3 +228,15 @@ function canReadVideoFormat ($mimeType) {
return ($mimeType == 'video/mp4');
}
function in_array_column($text, $column, $array)
{
if (!empty($array) && is_array($array))
{
for ($i=0; $i < count($array); $i++)
{
if ($array[$i][$column]==$text || strcmp($array[$i][$column],$text)==0) return true;
}
}
return false;
}

View File

@ -15,7 +15,7 @@ $videosList = 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);
$videos = array_unique($videos);
// $videos = array_unique($videos);
// exec("/bin/bash -c './get_youtube_videos.sh'", $videos);
// echo file_get_contents("http://youtube2.com/ipns/12D3KooWHLLohhFqwTs3Ccego51w1Q2WUQ8JmhSMWtsZnQpMigHY/.12D3KooWHLLohhFqwTs3Ccego51w1Q2WUQ8JmhSMWtsZnQpMigHY/FASTRXBIAN");
@ -49,6 +49,11 @@ foreach ($videos as $v) {
list($contentType, $videoID, $year, $filename, $saison, $tagsStr, $ipnsHash, $definition, $videoURI) = explode(";", $v);
if (in_array_column($videoURI, 'uri', $videosList)) {
continue;
}
list($videoSource, $videoID) = handleVideoID($videoID);
$ipfsHash = preg_replace('!^/ipfs/([^/]+)/.*$!isU', '$1', $videoURI);