fully containerized, but should still be adaptable to non-container use

This commit is contained in:
2021-10-17 16:48:09 -07:00
parent 2a8711ea15
commit 93660fa379
5 changed files with 78 additions and 15 deletions

16
rss.php
View File

@@ -2,7 +2,7 @@
require_once('./getid3/getid3/getid3.php');
$getid3=new getID3;
$baseurl="https://streamshifter.alfter.us/";
$baseurl=getenv("BASEURL");
$doc = new DOMDocument("1.0", "UTF-8");
$root = $doc->createElement("rss");
@@ -15,12 +15,12 @@
$latest=0;
$c=0; // sort entries into reverse chronological order
if ($h=opendir("audio"))
if ($h=opendir("/var/www/html/audio"))
{
while (($e=readdir($h))!==false)
if (strlen($e)>4)
if (substr_compare($e,".m4a",-4,4)===0)
$arr[$c++]=filemtime("audio/".$e)." ".$e;
$arr[$c++]=filemtime("/var/www/html/audio/".$e)." ".$e;
closedir($h);
}
sort($arr, SORT_NUMERIC);
@@ -32,7 +32,7 @@
$item=$doc->createElement("item");
// extract title from metadata
$fi=$getid3->analyze("audio/".$e);
$fi=$getid3->analyze("/var/www/html/audio/".$e);
getid3_lib::CopyTagsToComments($fi);
$item->appendChild($doc->createElement("title",$fi["comments_html"]["title"][0]));
$item->appendChild($doc->createElement("author",$fi["comments_html"]["artist"][0]));
@@ -45,16 +45,16 @@
$enclURL->value=$baseurl."audio/".$e;
$encl->appendChild($enclURL);
$enclLength=$doc->createAttribute("length");
$enclLength->value=filesize($e);
$enclLength->value=filesize("/var/www/html/audio/".$e);
$encl->appendChild($enclLength);
$enclType=$doc->createAttribute("type");
$enclType->value="audio/mp4a-latm";
$encl->appendChild($enclType);
$item->appendChild($encl);
$item->appendChild($doc->createElement("pubDate",gmdate(DATE_RSS,date(filemtime("audio/".$e)))));
$item->appendChild($doc->createElement("pubDate",gmdate(DATE_RSS,date(filemtime("/var/www/html/audio/".$e)))));
$channel->appendChild($item);
if ($latest<filemtime("audio/".$e))
$latest=filemtime("audio/".$e);
if ($latest<filemtime("/var/www/html/audio/".$e))
$latest=filemtime("/var/www/html/audio/".$e);
}
$channel->appendChild($doc->createElement("lastBuildDate",gmdate(DATE_RSS,date($latest))));