Podcasters listen up. I wanted to create a playlist (M3U file) in a couple varieties, one: recent podcasts (the last 30) and two: all podcasts. You would think this would be a simple thing to do with PHP and MySQL . . . nope. WordPress users might find this handy.
I did succeed (recent playlist).
Here's how I got it done:
1) Add a mod_rewrite line to your .htaccess file that ends with '.m3u' like so:
RewriteRule ^playlist/all/playlist.m3u$ http://www.yourdomain.com/yourscript.php?type=$12) Create the PHP script to generate the M3U data structure:
a. connect to your MySQL database3) Lie to the browser by writing a header for an M3U file:
b. query your live podcasts (the ones in your cms like WordPress not labled draft. You'll most likely need to know the data type it submits to this field in the database like '0' or '1')
c. pull up the post id, post title and podcast file
header("content-type: audio/x-mpegurl");4) Write this line without 'echo' or 'print':
#EXTM3U5) Create a loop to write your podcast id, podcast title and podcast URL
#EXTM3UI am not a super coder but this should be enough to get you going. And just in case that it isn't look below for the exact (well, nearly exact script that I am using).
#EXTINF:597,Betsy and her husband Kris Jan 01, 2007
#EXTINF:596,Betsy and her husband Kris Dec 29, 2006