How to create the xml file for podcasting?

5,024

If you're trying to make one compatible with iTunes's format, what you need is a species of RSS XML. Apple's website gives as good a description of it as you probably need: Look here.

Here, I'll give you a template. The XML file begins with something like this:

 <?xml version="1.0" encoding="utf-8"?>
 <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
 <channel>
 <atom:link href="http://PATH-TO-RSS/XML/FILE" rel="self" type="application/rss+xml" />
     <title>PODCAST TITLE</title>
     <link>http://PATH-TO-WEBPAGE</link>
     <description>DESCRIPTION OF PODCAST (SHORT)</description>
     <lastBuildDate>Mon, 27 Dec 2010 17:16:55 GMT</lastBuildDate>
     <language>en-us</language>
     <copyright>Copyright 2010 © WHOEVER</copyright>
     <itunes:subtitle>PODCAST SUBTITLE</itunes:subtitle>
     <itunes:author>PODCAST AUTHOR</itunes:author>
     <itunes:summary>PODCAST SUMMARY (LONGER)</itunes:summary>
     <itunes:owner>
         <itunes:name>PODCAST MAINTAINER</itunes:name>
         <itunes:email>[email protected]</itunes:email>
     </itunes:owner>
     <itunes:image href="http://PODCAST-IMAGE-URL/something.jpg" />
     <itunes:category text="Category1" />
     <itunes:category text="Category2">
            <itunes:category text="Subcategory" />
     </itunes:category>

There follows any number of items, which look like this:

<item>
    <title>ITEM TITLE</title>
    <link>http://link.for.this.item</link>
    <itunes:author>Item Author</itunes:author>
    <description>Item description</description>
    <itunes:summary>Item summary</itunes:summary>
    <enclosure url="http://link-to.media.file.mp3" length="filesize-in-bites" type="audio/mpeg"/>
    <guid>http://link-to-media/file.mp3</guid>
    <pubDate>Current Date (same format as above)</pubDate>
    <itunes:duration>4:21</itunes:duration>
    <itunes:keywords>Keywords</itunes:keywords>
    <category>Podcasts</category>
    <itunes:explicit>no</itunes:explicit>
</item>

And the file ends after all the items like this:

     <itunes:explicit>no</itunes:explicit>
 </channel>
 </rss>

Perhaps you're wondering how to extract the information you need from the file itself. Assuming its id3v2 metadata tag is in good shape you can use id3v2 commandline too for some of it, e.g., I use:

songtitle="$(id3v2 --list "$file" | grep "TIT2" | sed 's%TIT2.*:\s*%%')"

to get the title of the track. (where $file is set to the filename).

To get the filesize, I use:

filesize=$(stat -c %s "$file")

To get the duration, I use:

fileduration=$(exiftool -S -Duration "$file" | sed 's/Duration: //' | sed 's/ (approx)//')

To get the current date in a suitable format for the date fields:

currdate=$(date -u -R | sed 's/\+0000/GMT/')

Share:
5,024

Related videos on Youtube

Daniel P Bartolo
Author by

Daniel P Bartolo

Updated on September 17, 2022

Comments

  • Daniel P Bartolo
    Daniel P Bartolo almost 2 years

    I'm interested in podcasting. My only worry is how to create an xml file to give all the information about the audio file.

  • Daniel P Bartolo
    Daniel P Bartolo over 13 years
    Thanks for your time and patience. Years ago I used easypodcast which is very easy to use and it's open source. Surprisingly I am not aware of any version for linux.
  • Daniel P Bartolo
    Daniel P Bartolo over 13 years
    Your method is very good but sincerely it's a little bit time consuming. Just for the benefit of our readers I found two other programs but still don't know how to install in Ubuntu: hotscripts.com/listing/podcast-generator; hotscripts.com/listing/podadmin-web-based-podcast-management
  • frabjous
    frabjous over 13 years
    I do it all via a BASH script which use sed to insert the relevant parts. It's not time consuming at all. The web services I found online actually took more time and added advertisements to the feeds, but I haven't checked your links.
  • Daniel P Bartolo
    Daniel P Bartolo over 13 years
    ok thanks! So is it possible to combine all these scripts into one and put them directly into one file?
  • frabjous
    frabjous over 13 years
    Those aren't scripts... sigh. This is too difficult a conversation to have in comments fields. Open a thread at ubuntuforums.org or similar and put a link here and I'll elaborate there.
  • Daniel P Bartolo
    Daniel P Bartolo over 13 years
  • Daniel P Bartolo
    Daniel P Bartolo over 13 years
    I wrote to ubuntu forums. The link is: ubuntuforums.org/…