Add to Technorati Favorites

Tuesday 26 June 2007

Step by Step: Making a Podcast, Pt. III

Now that we've got an mp3 file stored somewhere on the net, we need to create our XML file, so that iTunes and other podcatching software knows where to find and download this mp3 from.

First, let's have a look at what an XML file actually looks like. Below is some typical XML podcast code:

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>Jim's Scottish Podcast</title>
<link>http://www.jim-mcjim.com
</link>
<language>en</language>
<copyright>Jim McJim, 2007</copyright>
<itunes:subtitle>A weekly changing podcast on the ever changing weather of Scotland</itunes:subtitle>
<itunes:author>Jim McJim</itunes:author>
<description>Have you ever wondered what the weather was like in Scotland last week? Wonder no more as Jim McJim takes you on a whistle stop tour of Scottish Weather through the ages.</description>
<itunes:image href="http://www.jim-mcjim.com/jimsporran.jpg"> </itunes:image>
<itunes:owner>
<itunes:name>Jim McJim</itunes:name>
<itunes:email
>imjim@jim-mcjim.com</itunes:email>
</itunes:owner>
<itunes:category text="Places &amp; Travel"></itunes:category>
<itunes:keywords>Scotland, Weather, Jim McJim, Rain</itunes:keywords>
<item>
<title>Aberdeen</title>
<itunes:author>Jim McJim</itunes:author>
<link>http://www.jim-mcjim.com/aberdeen26062007.mp3</link>
<itunes:subtitle>A quick look at Aberdeen's greyness through the ages.</itunes:subtitle>
<description>Don't be fooled by Global Warming and El Nino, Aberdeen has always had crummy weather, as we set out to prove in this weeks installment of Jim's Scottish Podcast. Jim is always taking suggestions for where to do his Scottish podcast on next, and he'll happily tell you exactly how rainy it's been just about anywhere in the country. Contact Jim on imjim@jim-mcjim.com.</description>
<enclosure url="http://www.jim-mcjim.com/aberdeen26062007.mp3" length="57099128" type="audio/mpeg"/>
<pubDate>Thu, 19 Apr 2007 11:14:18 GMT</pubDate>
<itunes:duration>59:12</itunes:duration>
<itunes:keywords>Scotland, Aberdeen, Rain</itunes:keywords>
</item>
</channel>
</rss>

At first it looks like a complete mess, but if you look closely, it actually makes a lot of sense - XML was designed so that computers could interpret it, but it was also designed so that the average human could look at it and see exactly what was going on as well. You could pretty much copy and paste that snippet into a blank notepad document, change it to the details you need, and use it as your XML if need be, without even reading the next part.

If you've programmed a web page using HTML before now, the XML will appear very familiar to you - the difference between them though is that whilst HTML describes everything that goes on in a page (including pictures, formatting, backgrounds, tables etc.), XML only describes the data, and leaves the formatting up to the page hosting the XML document, or the program or device it's being shown in. You'll notice, like HTML, that each snippet of data is held between two "tags", which describe what data is contained in that tag. There is always an opening tag: <data> , and a closing tag: </data>

Now we know the basics of an XML file, let's pick apart the above example, tag by tag, so that we can better understand what's going on with this file.

  • <?xml version="1.0" encoding="UTF-8"?>
    This tag must always be at the start of every podcast XML file - it basically just tells any program reading this file that it's an XML file. Never change this tag, as anything trying to "tune in" to your podcast will just get confused.
  • <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">...</rss>
    This is what is known as the "namespace" tag. Every XML file must have one, and it tells any program reading the file what each tag means. For just a standard podcast, use this tag, as it includes all the information needed for the iTunes tags, as well as standard podcast tags.
  • <channel>...</channel>
    This is where the podcasting magic begins. This tag just tells us that everything between these tags will be a new podcast. You can put more than one channel into an XML file, but I wouldn't recommend it. You'll notice that just about everything else in the file is enclosed in these tags.
  • <title>Jim's Scottish Podcast</title>
    This is the title of the pocast, as it will show up in the podcasting software.
  • <link>http://www.jim-mcjim.com</link>
    This is just the website associated with the podcast. If there's the option to link to a website in the podcasting software, this is where it will take you.
  • <language>en</language>
    This is the default language for the podcast. In this case it tells us that it will be standard English. We could be more specific and set this instead to "en-gb", which software would interpret as British English. There is a list of different values for different languages here.
  • <copyright>Jim McJim, 2007</copyright>
    Pretty self-explanatory, who holds the copyright for this podcast. This might be a single person, as in this example, or it might be a company.
  • <itunes:subtitle>A weekly changing podcast on the ever changing weather of Scotland</itunes:subtitle>
    The iTunes subtitle: gives an annotated description of what the podcast is about in iTunes. There's a couple of other podcast directories that read this value as well. It's best to be as concise as possible when setting this, as it may be the deciding factor as to whether someone listens to your podcast, or passes it by.
  • <itunes:author>Jim McJim</itunes:author>
    Another iTunes specific tag - this is the Author or main producer of the podcast. This will usually be the same as the copyright holder.
  • <description>...</description>
    This is where you can be as descriptive as you want on what your podcast is about. iTunes shows this description on the individual podcast page, as do most podcasting websites.
  • <itunes:image href="http://www.jim-mcjim.com/jimsporran.jpg"> </itunes:image>
    This is the image that iTunes will show in the podcast charts, and on the individual page describing your podcast. This must be a JPEG, and it is most effective if it is square. Your podcast will get much more exposure if you have a decent image.
  • <itunes:owner>
    <itunes:name>Jim McJim</itunes:name>
    <itunes:email
    >imjim@jim-mcjim.com</itunes:email>
    </itunes:owner>
    More iTunes specific owner information. Again, this will usually be the same as the copyright holder's details.
  • <itunes:category text="Places &amp; Travel"></itunes:category>
    This is the category that your podcast will be placed under in the iTunes directory. Some other podcasting websites also use this. There's a full list of what you can set this value as here.
  • <itunes:keywords>Scotland, Weather, Jim McJim, Rain</itunes:keywords>
    Words that people might use to search for your podcast in iTunes. Try to think of as many words as possible, but keep within the realms of what your podcast is about. The more words you choose, the further down the "relevance" list your podcast will appear, so be as specific as possible. Seperate each term with a comma.
  • <item>...</item>
    This is the next tag you need to pay attention to. Everything between a set of <item> tags describes one episode of your podcast. You can many item tags in one XML file. You'll notice that a few of the tags contained within this one are the same as for the podcast itself - these fulfill the same function, but instead of describing the podcast now, they're describing an individual episode.
  • <link>http://www.jim-mcjim.com/aberdeen26062007.mp3</link>
    For each episode, include a link tag which is the URL of the mp3 file associated with this episode. This will allow people looking at the podcast on websites to go straight to the mp3 file, and stream or download it. It's less helpful for an episode link tag to go to the podcast website.
  • <enclosure url="http://www.jim-mcjim.com/aberdeen26062007.mp3" length="57099128" type="audio/mpeg"/>
    This is where the real magic happens - the tag which tells iTunes and other podcasting software where the episode mp3 file (or video file) is contained. Change the value in the quotes next to url to the URL where you stored the mp3 file. The length value is the size (in bytes) of the file (right click the file in windows explorer, and go to properties so get this value). Type is the type of file this is, in most cases this will be an mp3 file, but it could be a video file. The following table shows other file types values this might be:
    File Type
    .mp3 audio/mpeg
    .m4a audio/x-m4a
    .mp4 video/mp4
    .m4v video/x-m4v
    .mov video/quicktime
    .pdf application/pdf
  • <pubDate>Thu, 19 Apr 2007 11:14:18 GMT</pubDate>
    The date this episode was produced. It must be kept in this exact format, or your episodes will most likely end up in the wrong order.
  • <itunes:duration>59:12</itunes:duration>
    The duration of the episode, in hours:minutes:seconds. In this case the episode is 59 minutes and 12 seconds long. It's important to set this right, otherwise iTunes will list your episode as having no duration.
  • <itunes:keywords>Scotland, Aberdeen, Rain</itunes:keywords>
    Keywords applicable to the individual episode.
  • </item>
    </channel>
    </rss>
    These close the episode, channel, and XML file, respectively. Remember that after the closing item tag, and before the closing channel tag, you might have one or more item tags, each with their own title, description, enclosure etc. tags within them, and all describing seperate episodes.
This is pretty much a bare bones XML file, which as stated earlier, you could copy and paste into notepad, change the values so they are applicable to your podcast, save it as "podcast.xml" (or similar - just make sure that your filename ends ".xml" - in the "save as type" chooser in the "save as..." dialog box, you might want to change it to "*.*" instead of "*.txt", as this will ensure that notepad doesn't change the file extension), and upload to the web. This is the bare minimum of tags that are required to get your podcast into most podcasting directories, and iTunes, but there are other tags as well, these are listed in the Apple technical specifications here. Some of the iTunes tags just double up on tags that are already described here though, which is why I've chosen not to include them. iTunes is big enough and ugly enough to work out what should go where without you having to put the information in twice.

Next I'll take you through the process of validating your XML file to make sure it works in iTunes and other podcasting software, before we list it in the iTunes directory.

No comments:

Post a Comment