archive/rss.php

39 lines
1.1 KiB
PHP

<?php
header('Content-type: text/xml');
$feedName = "tilderadio archive feed";
$feedDesc = "feed of archived shows broadcasted on tilderadio";
$feedURL = "https://archive.tilderadio.org/rss.php";
$feedBaseURL = "https://archive.tilderadio.org/"; // must end in trailing forward slash (/).
$allowed_ext = ".mp3,.MP3";
?>
<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title><?=$feedName?></title>
<link><?=$feedURL?></link>
<description><?=$feedDesc?></description>
<atom:link href="<?=$feedURL?>" rel="self" type="application/rss+xml" />
<?php
$files = glob("*/*.mp3");
foreach ($files as $file) {
$timestamp = filectime($file);
$filesize = filesize($file);
list($author, $filename) = explode("/", $file, 2);
?>
<item>
<title><?=$filename?></title>
<author><?=$author?></author>
<link><?=$feedBaseURL?><?=$file?></link>
<guid><?=$feedBaseURL?><?=$file?></guid>
<pubDate><?=date(DATE_RSS, $timestamp)?></pubDate>
<fileSize><?=$filesize?></fileSize>
</item>
<?php } ?>
</channel>
</rss>