// DirCaster v0.4: Automatic iPodder RSS feed maker
// Written by Ryan King www.shadydentist.com
// id3 class from frummel
// No license or warrantee expressed, implied, enclosed, etc.
// Drop this script in a directory and it will generate an RSS feed suitable for
// iPodder, etc based off the MP3 files in that directory. To 'cast a new
// file, simply upload it to the directory containing this script.
// Feed information is based on id3 tags, requires PHP4 or better.
//
// Note: Avoid spaces in your MP3 filenames to avoid ugly filenames coming out
// of iPodder
// Instructions
// 1. Place this file on a server with supports PHP4 or greater.
// 2. Place MP3 files to feed in the same directory, add new files at will
// 3. Point iPodder to the URL of this file.
// ex. http://www.mysite.com/podcast/dircaster.php
// 4. Set the following varibles to match your setup if you wish
//
// -----------------------------------------------------------------------------
// modded by floz for id3v2 support !
// -----------------------------------------------------------------------------
// Maximum number of mp3s to offer in a feed
$maxFeed = 100;
require_once('class.id3v2.php');
//Title of feed/site Used by iPodder for download subdirectory name
$titleTAG="Podpourri";
//iPodder 1.0 seems to ignore everything below
//URL of site feed applies too
$linkTAG="http://podcast.knorn.org";
//Description
$descriptionTAG="I talk about various topics either in German, English or French. Topics include little things and thoughts from daily life, trips, countries, science, music, ...\n\nMore infos: www.knorn.org";
//Feed language en-us = english USA
$languageTAG="de-DE";
//Copyright for feed
$copyrightTAG="Copyright 2005-2015 by Florian Knorn";
//Your email address
$webMasterTAG="florian@knorn.de";
//Name of feed generator
$generatorTAG="dirCast v0.777 heavily modded by floz";
// Time to live
$ttlTAG=60;
///////////////
// You should not need to edit anything below this point.
/////////////
// Main Code
///////////
header('Content-type: application/rss+xml', true);
$rootMP3URL = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$rootMP3URL = substr($rootMP3URL, 0, strrpos ($rootMP3URL, "/")); // Trim off script name itself
print "\n";
print "\n";
print "\n";
print "\n";
print "" . $titleTAG . "\n";
print "potpourri,podpouri,french,francais,german,deutsch,english,englisch,new zealand,australia,iceland, florian knorn\n";
print "A blend of languages and topics... von einem Synchronsprecher ;-)\n";
print "Florian Knorn\n";
print " ". $descriptionTAG . "\n";
print "\n";
print " \n";
print "\n";
print "\n";
print " \n";
print "\n";
print "\n";
print " \n";
print "\n";
print "" . $linkTAG . "\n";
print "" . $descriptionTAG . "\n";
print "" . date("r") ."\n";
print "" . $languageTAG . "\n";
print "" . $copyrightTAG . "\n";
print "\n";
print " Florian Knorn\n";
print " florian@knorn.org\n";
print "\n";
print "no\n";
print "florian@knorn.org\n";
print "\n";
print " http://podcast.knorn.org/podpourri.jpg\n";
print " Podpourri\n";
print " http://podcast.knorn.org\n";
print "\n";
print "\n";
print "" . $generatorTAG . "\n";
print "" . $webMasterTAG . "\n";
print "" . $ttlTAG . "\n\n";
echo file_get_contents("rssfeed.static");
/*
$dirArray = getDir("./"); // Get a list of the current directory
while (list($i, $filename) = each($dirArray)AND $maxFeed > 0) {
if ($filename == "podpourri_11s_teaser.mp3") continue;
if (strrchr(strtolower($filename), ".") == ".mp3") {
if (file_exists(substr($filename,0,-3)."nfo")) {
$t_ext = explode("|||",file_get_contents(substr($filename,0,-3)."nfo"));
$title = utf8_encode($t_ext[0]);
$comment = utf8_encode($t_ext[1]);
$comment .= "\n\nMore infos at:\n\npodcast.knorn.org";
} else {
$mp3file = new id3($filename);
if (isset($mp3file->id3v2tag['FRAMES']['TIT2'])) {
$title = $mp3file->id3v2tag['FRAMES']['TIT2']['data'];
$title = utf8_encode(substr($title,0,-1));
} else { $title = ''; }
if (isset($mp3file->id3v2tag['FRAMES']['COMM'])) {
$comment = $mp3file->id3v2tag['FRAMES']['COMM']['data'][''];
$comment = utf8_encode(str_replace("\x84",'"',str_replace("\x94",'"',substr($comment,0,-1))));
} else { $comment = ''; }
}
$type = "audio/mpeg";
} elseif (strrchr(strtolower($filename), ".") == ".m4v") {
$t_ext = explode("|||",file_get_contents(substr($filename,0,-3)."nfo"));
$title = utf8_encode($t_ext[0]);
$comment = utf8_encode($t_ext[1]);
$comment .= "\n\nMore infos at:\n\npodcast.knorn.org";
$type = "video/m4v";
}
if ($title == "Ciao Jona") { // note: three equal signs
$explicit = true;
} else {
$explicit = false;
}
$length = explode('__',$filename);
$length = substr($length[1],0,-10).":".substr($length[1],-9,-7);
$filedate = strtotime(substr($filename,0,8));
print "\n";
echo ("".$title."\n");
echo ("".$rootMP3URL."/". htmlentities(str_replace(" ", "%20", $filename)) ."\n");
echo ("".$rootMP3URL."/". htmlentities(str_replace(" ", "%20", $filename)) ."\n");
echo ("".date("r",$filedate)."\n");
echo ("".$comment."\n");
echo ("Florian Knorn\n");
echo ("".$length."\n");
if ($explicit)
echo ("yes\n");
else
echo ("no\n");
echo ("\n"); // Training slash for XML
print "\n\n";
$maxFeed--;
}
print "\n\n";
// Functions and Classes
function stripJunk ($text) {
// Strip non-text characters
for ($c=0; $c= 32 AND ord($text[$c]) <= 122)
$outText.=$text[$c];
}
return $outText;
}
function getDir($mp3Dir) {
// Returns directory as array[file]=date in newest to oldest order
$dirArray = array();
$i = 0;
$diskdir = "./$mp3Dir/";
if (is_dir($diskdir)) {
$dh = opendir($diskdir);
while (($file = readdir($dh)) != false ) {
if (filetype($diskdir . $file) == "file" && $file[0] != ".") {
if (strrchr(strtolower($file), ".") == ".mp3" || (strrchr(strtolower($file), ".") == ".m4v")) {
// $ftime = filemtime($mp3Dir."/".$file);
$i++;
$dirArray[$i] = $file;
}
}
}
closedir($dh);
}
asort($dirArray);
$dirArray = array_reverse($dirArray);
return $dirArray;
}
*/
?>