astrXbian/www/boris/swarm_files.php

80 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2021-03-15 17:16:52 +01:00
<?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');
2021-09-18 14:08:44 +02:00
echo '
<h2>
'. trim($peerName) . ' ['. substr($peer, 0, 5) . '' . substr($peer, -4) . ']
</h2>
';
2021-03-15 17:16:52 +01:00
$files = scandir('swarm/' . $peer . '/astroport/kodi/vstream');
foreach ($files as $f) {
2021-09-18 14:08:44 +02:00
echo '
<h3>
' . getCollectionType($f) . '
</h3>
';
2021-03-15 17:16:52 +01:00
$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);
2021-03-15 17:16:52 +01:00
$mimeType = guessTypeFromFilename($videoURL);
if ($mimeType == 'video/mp4') {
echo '
2021-09-18 14:08:44 +02:00
<li>
<a href="'. $videoURI . '">' . $videoName . '</a><br />
2021-09-18 14:08:44 +02:00
('. $mimeType . ')<br />
<video controls width="320" height="240">
<source src="'. $videoURI .'" type="'. $mimeType .'">
<a href="'. $videoURI . '">' . $videoName . '</a>
2021-09-18 14:08:44 +02:00
</video>
</li>
';
2021-03-15 17:16:52 +01:00
}
}
2021-09-18 14:08:44 +02:00
echo '</ul>';
2021-03-15 17:16:52 +01:00
}
}