forked from tilderadio/archive
add rss feed - closes #1
This commit is contained in:
parent
09d64865ee
commit
afefcdb02c
|
@ -12,6 +12,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>tilderadio archive</h1>
|
<h1>tilderadio archive</h1>
|
||||||
<p><a href="https://tilderadio.org">back to tilderadio.org</a> - <a href="https://radio.tildeverse.org/radio/8000/radio.ogg">listen now</a></p>
|
<p><a href="https://tilderadio.org">back to tilderadio.org</a> - <a href="https://radio.tildeverse.org/radio/8000/radio.ogg">listen now</a></p>
|
||||||
|
<p>here's the archive as an <a href="rss.php">rss feed</a>. source for this archive <a href="https://tildegit.org/tilderadio/archive">here</a></p>
|
||||||
<hr>
|
<hr>
|
||||||
<?php
|
<?php
|
||||||
foreach (glob("/var/www/archive/*") as $dir) {
|
foreach (glob("/var/www/archive/*") as $dir) {
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?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);
|
||||||
|
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>
|
||||||
|
</item>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</channel>
|
||||||
|
</rss>
|
Loading…
Reference in New Issue