======Podcast generator ======
This projects allows you to turn a bunch of mp3s into an RSS feed formatted for the iPhone podcast app (it should work with any podcast app).
The steps are:
- Create a directory on your webserver for example (/var/www/html/mypodcasts/)
- Create the PHP file below in your mypodcasts directory
- Create an .htaccess file with the following contents:
RewriteEngine On
RewriteRule (.*)\.rss mp3-to-rss.php?dirname=$1 [L]
Now, for each album/collection you want to access:
- Create a directory of mp3s there (ie. /var/www/html/mypodcasts/themartian/)
- Create a metadata JSON file called ''info.json'' in the mp3 directory (''/var/www/html/mypodcasts/themartian/info.json''), here is an example:
{"author":"Andy Weir", "title":"The Martian"}
You can now view the generated RSS feed by visiting:
http://your_domain_name/mypodcasts/themartian.rss
===== mp3-to-rss.php =====
$filename$filename$filename
$url/$dir_name/$filename
";
$all_items .= "".date("r", strtotime("1 June 2018 21:00 +$number days"))."";
$all_items .= "
$author00:32:16no$url$dir_name/$filename
";
$number++;
}
} else {
http_response_code(404);
die("File not found");
}
function header_update($buffer) {
global $replace_array;
return(str_replace(array_keys($replace_array), $replace_array, $buffer));
}
ob_start("header_update");
?>
#TITLE#
#LINK#
en-us#SUBTITLE##AUTHOR##SUMMARY##DESCRIPTION##OWNER##OWNEREMAIL#no
The lengths/duration above are just set to 32 minutes (this will be auto-updated by your client when you start to play the file). You can set these automatically if you have access to the mp3info program (''apt install mp3info'') then replace the duration (''00:32:16'' with ''$duration'') and add this code around line 61, just after the $size variable is set:
$duration = gmdate("H:i:s", `mp3info -p "%S" "$file"`);