astrXbian/www/boris/swarm_files.php

80 lines
1.4 KiB
PHP

<?php
require_once('conf.php');
require_once('functions.php');
$dir = scandir("swarm", SCANDIR_SORT_DESCENDING) or die('fail');
array_pop($dir); // .
array_pop($dir); // ..
$swarm = array();
foreach ($dir as $d) {
$fst = substr($d, 0, 1);
if ($fst == '.') {
$swarm[] = $d;
}
}
foreach ($swarm as $peer) {
$peerName = file_get_contents('swarm/' . $peer . '/G1SSB/_g1.astroport_title');
echo '
<h2>
'. trim($peerName) . ' ['. substr($peer, 0, 5) . '…' . substr($peer, -4) . ']
</h2>
';
$files = scandir('swarm/' . $peer . '/astroport/kodi/vstream');
foreach ($files as $f) {
echo '
<h3>
' . getCollectionType($f) . '
</h3>
';
$collection = file_get_contents('swarm/' . $peer . '/astroport/kodi/vstream/' . $f);
$collection = trim($collection);
$videos = explode("\n", $collection);
$videos = array_reverse($videos);
array_pop($videos);
echo '<ul>';
foreach ($videos as $v) {
list($a, $b, $c, $videoName, $e, $g, $h, $m, $videoURI) = explode(";", $v);
$mimeType = guessTypeFromFilename($videoURL);
if ($mimeType == 'video/mp4') {
echo '
<li>
<a href="'. $videoURI . '">' . $videoName . '</a><br />
('. $mimeType . ')<br />
<video controls width="320" height="240">
<source src="'. $videoURI .'" type="'. $mimeType .'">
<a href="'. $videoURI . '">' . $videoName . '</a>
</video>
</li>
';
}
}
echo '</ul>';
}
}