RSS Feed from a Script Generated File

If you need to alter the code for your purposes here is a description of our files to aid in such. If we can be of assistance contact information is available on our web site www.programsplus.us.

RSS code

If you're managing your own music you may want to upload your audio files one at a time and create the appropriate XML/RSS script. The software included with this package includes Perl upload software that also creates a text file that will be read by the php script. When called, the php script then generates the XML/RSS code that can be read by a pod cast aggregator.

RSS readers look for both the audio file and a text file with the same name. For example you'll need the following two files for a song titled XYZSong.

XYZSong.txt
XYZSong.mp3

This php RSS reader script looks in the following file for these entries.

../records/podList.txt

You'll notice the script goes up a directory, '../' to find the list. We've located the php reader script in the RSS directory ('../RSS/feed.php').

An entry in podList.txt for My XYZ Song reads as follows:

MyXYZSong:My XYZ Song

There is one entry per line in podList.txt.

In the above example you will note our software removed all the spaces in the song file name. 'My XYZ Song' became 'MyXYZSong'. That's just to make sure there's file compatibility between operating systems. Also the script has added a time stamp in case two files with the same name are uploaded. The time stamp also provides a means for adding time management script later, like adding a two week time limit to listings.

The reason the file name does not have an extension like 'mp3' or 'txt' is because the RSS feed reader script performs a string extraction and concatenates the file extension. After the RSS reader script is finished it will have two files to look for, MyXYZSong.mp3 and MyXYZSong.txt.

On our web site the RSS feeder script looks for the audio file in the '/audio/' directory and the text file in the '/audio/podCastListing/' directories. You can change these by changing the appropriate lines in the script.


Minimum RSS Elements

I'm sure you're aware that RSS is XML code. The RSS element is a child element of the XML tag.

There are two child elements under the RSS tag; '<channel>' and '<item>' elements. The '<link>', '<title>', and '<description>' tags are required as child elements under both the channel and item tags. The item tag is a child element of the channel tag. This meets the minimum RSS 0.91 and RSS 2.0 specs.

You'll probably need additional elements for different feeders. The Juice pod catcher needs the '<enclosure>' element tag, for example, and you can imagine the image tag will come in handy. There are several other elements you may want to consider and there are many online sources providing a complete list.

RSS readers read XML script only. The php reader script included with the package, 'feed.php', generates the XML script for the reader. An outline of the minimum XML/RSS script generated is:

<?xml version=\"1.0\" encoding=\"utf-8\"?>
    <rss version=\"2.0\">
       <channel>
         <title> general purpose rss feed title </title>
         <link> general purpose rss information link </link>
         <description> general purpose rss feed description </description>
         <item>
              <title> specific file name </title>
              <link> specific file link </link>
              <description> file description </description>
               <enclosure This tag was required to work in Juice ???/>
         </item>
        </channel>
    </rss>
Working Example

That's the bare minimum number of tags and elements for a RSS feed. Here's a working example:

<?xml version=\"1.0\" encoding=\"utf-8\"?>
    <rss version=\"2.0\">
       <channel>
         <title> DoggyTailWag.com dog feed cast </title>
         <link> http://www.doggytailwag.com/docs/howto/ </link>
         <description> Dog Feed from Doggy Tail Wag </description>
          <image>
             <title>Doggy Tail Wag Feed</title>
             <url> http://www.doggytailwag.com/images/logo/nameTag_100.gif </url>
             <link>http://www.doggytailwag.com</link>
             <description>Audio dog tail cast feed for doggy tail wag</description>
          </image>
         <item>
              <title> High Protein Animals </title>
              <link> http://www.doggytailwag.com/audio/HighProteinAnimals_1199902192.mp3 </link>
              <description> artist: Ken Buhnell -- Dogs prefer protein. </description>
               <enclosure url="http://www.doggytailwag.com/audio/HighProteinAnimals_1199902192.mp3" length="2489094" type="audio/mpeg"/>
         </item>


         <item> repeat item tag entries as needed </item>

        </channel>
    </rss>

You can create the XML code any way you want and any pod or aggregator should be able to read it. You may however want to generate the XML code with a script so that you can have additional control. The only caveat is that XML code must be precise. It's not forgiving like html. There's no room for error whether it's entered manually or via a script.

Notice we've added an image tag. This will probably be indispensible. It too has a url, title and description tag, all child elements of the image tag. It has its own link tag as well.

As a note each item element needed an enclosure tag to work with the Juice pod caster. Notice the enclosure tag has three attributes: url, length and type.

Also of note there is no individual artist tag under the item tags. In this application the artists name is concatenated in the Perl code that generates the description text file which on my machine is picked up by the WinAmp player for display.

A list of the additional RSS elements can be found online.



Installation