目前:现在的加密结果是随机0-9条不加密 其余全部加密
想要结果:0-9条随机加密 其余均不加密
$fileNameArr = scandir($dir2);
foreach ($fileNameArr as $fileName) {
if ($fileName != '.' && $fileName != '..') {
$m3u8txt = file_get_contents($dir2.'/'.$fileName);
if (strstr($m3u8txt,"\r")==true) {
$m3u8txt = str_replace("\r","",$m3u8txt);
}
if ($ifjm == true) {
preg_match_all('/#EXTINF:(.*),\n?(.*)\n?/',$m3u8txt,$m3u8Arr);
$timeArr = $m3u8Arr[1];
$tsArr = $m3u8Arr[2];
if (count($timeArr) == count($tsArr)) {
$m3u8 = $m3u8head;
if ($jmtype == 2) {
$r = (string)rand(0,9);
}
foreach ($tsArr as $key => $ts) {
$ts = trim($ts);
if ($jmtype == 1 || ($jmtype == 2 && strstr((string)$key,$r) == true)) {
$jmts = publicEncrypt($ts);
}
$m3u8 = $m3u8 . "\n" . '#EXTINF:' . $timeArr[$key] .',';
if (empty($jmts)==false) {
$jmurl = $web.'?ts='.$jmts;
$m3u8 = $m3u8 . "\n" . $jmurl;
} else {
$m3u8 = $m3u8 . "\n" . $ts;
if ($jmtype == 1) {
echo $fileName . '-' . $ts . '加密失败';
echo '
';
}