analyze($file); if (isset($id3["playtime_string"])) { $str = $id3["playtime_string"]; $str2 = (int)round($id3["playtime_seconds"]); } else { $str = "-:--"; $str2 = 0; } $times[$afile] = [ "duration" => $str, "seconds" => $str2, "date" => $date ]; array_push($times["@items"], $afile); return $str; } } function cmp_by_date($a, $b) { return $a["date"] <=> $b["date"]; } $list = scandir($_SERVER['DOCUMENT_ROOT'] . "/data/films/metadata"); $films = []; foreach ($list as $item) { if ($item !== "." && $item !== "..") { $films[substr($item, 0, -5)] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/films/metadata/" . $item), true); $films[substr($item, 0, -5)]["id"] = substr($item, 0, -5); } } usort($films, function ($a, $b) { return $a['date'] <=> $b['date']; }); $films = array_reverse($films); $seconds = 0; foreach ($times as $titem => $tdata) { if ($titem !== "@items") { $seconds = $seconds + $tdata["seconds"]; } } $secstr = $seconds . " secondes"; if ($seconds > 60) { $secstr = round($seconds / 60) . " minutes"; if ($seconds > 3600) { $secstr = round($seconds / 3600) . " heures"; } } ?>

vidéos, de contenu