Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'This is probably easier done in PHP' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
This is probably easier done in PHP
Authored by: altotus on Apr 23, '10 12:04:01PM
You don't need folder actions. A better solution is to make the RSS dynamically based on the contents of a folder that you copy your files into (mind you, it presumes that PHP is available, as it is on a stock Mac). For example, put this PHP file in your sites directory, and create a sub-directory there names "podcast" to put your audio files in:

    header("Content-type: application/rss+xml");
    print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
<rss xmlns:itunes="" version="2.0">
        <description>My personal podcast</description>
        <title>My Podcasts</title>
            $podcastFiles = scandir("./podcast");
            uasort($podcastFiles, "by_date");
            foreach ($podcastFiles as $podcast) {
                if (substr($podcast, 0, 1) == ".") continue;
                $url = "http://" . $_SERVER['HTTP_HOST'] .
                       ":" . $_SERVER['SERVER_PORT'] .
                       dirname($_SERVER['REQUEST_URI']) .
                    <enclosure type="audio/mpeg" length="<?=filesize("./podcast/" . $podcast)?>" url="<?=$url?>"/>
            <? }
            function by_date($a, $b) {
                filemtime("./podcast/$a") - filemtime("./podcast/$b");

[ Reply to This | # ]