iTunes Export Script Documentation

Current version: 9th June 2012
Customizable
Optional
Leave as is
$filename(
Output Filename

You can change this filename to what you would like the final XML to be named.

By default this XML will be saved to the same folder as the files selected in Mp3Tag. To output to a specific folder just add a path before the filename.

Eg: C:\Program Files\Mp3Tag\PodcastFeed.xml

PodcastFeed.xml
,utf-8)<?xml version="1.0" encoding="utf-8"?> <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"> <channel> <title>YOUR PODCAST CHANNEL TITLE HERE</title> <link>http://YOURWEBSITELINKHERE.com</link> <atom:link href="http://LINKTOTHISXML.xml" rel="self" type="application/rss+xml"/>
<generator>

Leaving this tag in the XML tells the RSS reader what program was used to generate the XML feed.

In this case the default output is: Mp3Tag v2.51 (or whichever version of Mp3Tag is being used).

<generator>%_app%</generator>
<pubDate>$loop($sub(999999999,%_counter%))$puts(intOutputMax,1)$puts(intOutputCount,$if($eql(%_counter%,1),0,$get(intOutputCount)))$puts(blnExcludeFileExt,$if($eql(%_counter%,1),0,$get(blnExcludeFileExt)))$puts(blnExcludeFolder,$if($eql(%_counter%,1),0,$get(blnExcludeFolder)))$puts(blnExcludeOutput,$if($eql(%_counter%,1),0,$get(blnExcludeOutput)))$puts(strOutputText,$left($regexp(%releasetime%,(\d\d\d\d)-(\d\d)-(\d\d)(\w)(\d+)*'[:]+'(\d+)*'[:]+'(\d+)(\w),$3 $2 $1 $5:$6:$7 GMT),3)$replace($mid($regexp(%releasetime%,(\d\d\d\d)-(\d\d)-(\d\d)(\w)(\d+)*'[:]+'(\d+)*'[:]+'(\d+)(\w),$3 $2 $1 $5:$6:$7 GMT),4,2),'01','Jan','02','Feb','03','Mar','04','Apr','05','May','06','Jun','07','Jul','08','Aug','09','Sep','10','Oct','11','Nov','12','Dec')$right($regexp(%releasetime%,(\d\d\d\d)-(\d\d)-(\d\d)(\w)(\d+)*'[:]+'(\d+)*'[:]+'(\d+)(\w),$3 $2 $1 $5:$6:$7 GMT),18))$puts(intOutputCount,$add(1,$get(intOutputCount)))$puts(blnExcludeOutput,$ifgreater($get(intOutputCount),$get(intOutputMax),1,0))$puts(blnExcludeFolder,$ifgreater($strstr('|Edit|Edits|edit|edits|','|'%_directory%'|'),0,1,0))$puts(blnExcludeFileExt,$ifgreater($strstr('|mp3|m4a|','|'%_extension%'|'),0,0,1))$puts(blnCountDown,$ifgreater($add($get(blnExcludeFolder),$get(blnExcludeFileExt),$get(blnExcludeOutput)),0,1,0))$puts(intOutputCount,$ifgreater($get(blnCountDown),0,$sub($get(intOutputCount),1),$get(intOutputCount)))$ifgreater($get(blnExcludeFileExt),0,%dummy%,$ifgreater($get(blnExcludeFolder),0,%dummy%,$ifgreater($get(blnExcludeOutput),0,%dummy%,$get(strOutputText))))$loopend()</pubDate> <ttl>720</ttl> <itunes:author>NAME OF THE ARTIST OF THE PODCAST CHANNEL</itunes:author> <itunes:subtitle>SHORT DESCRIPTION OF YOUR PODCAST CHANNEL</itunes:subtitle> <itunes:summary>LONGER DESCRIPTION OF YOUR PODCAST CHANNEL</itunes:summary> <description>SAME LONGER DESCRIPTION AS ABOVE BUT FOR NON-iTUNES READERS</description> <language>en</language> <itunes:category text="YOUR iTUNES CATEGORY HERE"> <itunes:category text="YOUR iTUNES SUB-CATEGORY HERE" /> </itunes:category> <itunes:image href="http://YOUR PODCAST CHANNEL IMAGE URL.jpg" /> <image> <url>http://YOUR PODCAST CHANNEL IMAGE URL.jpg</url> <title>YOUR PODCAST CHANNEL TITLE HERE</title> <link>http://YOURWEBSITELINKHERE.com</link> <width>WIDTH OF CHANNEL IMAGE</width> <height>HEIGHT OF CHANNEL IMAGE</height> </image> <managingEditor>PODCAST MANAGER EMAIL</managingEditor> <webMaster>PODCAST WEBMASTER EMAIL</webMaster> <itunes:owner> <itunes:name>PODCAST OWNER NAME</itunes:name> <itunes:email>PODCAST OWNER EMAIL</itunes:email> </itunes:owner> <copyright>YOUR COPYRIGHT INFO HERE</copyright> <itunes:explicit>no</itunes:explicit> <itunes:block>no</itunes:block> $loop(%_counter%) $puts(intOutputMax,3)$puts(intOutputCount,$if($eql(%_counter%,1),0,$get(intOutputCount)))$puts(blnExcludeFileExt,$if($eql(%_counter%,1),0,$get(blnExcludeFileExt)))$puts(blnExcludeFolder,$if($eql(%_counter%,1),0,$get(blnExcludeFolder)))$puts(blnExcludeOutput,$if($eql(%_counter%,1),0,$get(blnExcludeOutput)))$puts(strOutputText,<item> <title>%title%</title> <pubDate>$left($regexp(%releasetime%,(\d\d\d\d)-(\d\d)-(\d\d)(\w)(\d+)*'[:]+'(\d+)*'[:]+'(\d+)(\w),$3 $2 $1 $5:$6:$7 GMT),3)$replace($mid($regexp(%releasetime%,(\d\d\d\d)-(\d\d)-(\d\d)(\w)(\d+)*'[:]+'(\d+)*'[:]+'(\d+)(\w),$3 $2 $1 $5:$6:$7 GMT),4,2),'01','Jan','02','Feb','03','Mar','04','Apr','05','May','06','Jun','07','Jul','08','Aug','09','Sep','10','Oct','11','Nov','12','Dec')$right($regexp(%releasetime%,(\d\d\d\d)-(\d\d)-(\d\d)(\w)(\d+)*'[:]+'(\d+)*'[:]+'(\d+)(\w),$3 $2 $1 $5:$6:$7 GMT),18)</pubDate> <itunes:author>%artist%</itunes:author>$if(%subtitle%,$char(13) <itunes:subtitle>%subtitle%</itunes:subtitle>,%dummy%)$if(%comment%,$char(13) <itunes:summary>%comment%</itunes:summary>$char(13) <description>'<![CDATA[''<p>'$regexp($regexp($regexp(%comment%,'^\A[\s\r\n]+|[\s\r\n]+\Z',%dummy%),'(\r\n){2}','</p><p>'),'(\r\n)','<br/>')'</p>'']]>'</description>,%dummy%) <itunes:duration>%_length%</itunes:duration> <itunes:explicit>no</itunes:explicit> <guid isPermaLink="false">%guid%</guid> <link>http://LINKTOTHEPODCASTITEM/%_filename_ext%</link> <enclosure url="http://LINKTOTHEPODCASTITEM/%_filename_ext%" length="%_file_size_bytes%" type="audio/mpeg"/> </item>)$puts(intOutputCount,$add(1,$get(intOutputCount)))$puts(blnExcludeOutput,$ifgreater($get(intOutputCount),$get(intOutputMax),1,0))$puts(blnExcludeFolder,$ifgreater($strstr('|Edit|Edits|edit|edits|','|'%_directory%'|'),0,1,0))$puts(blnExcludeFileExt,$ifgreater($strstr('|mp3|m4a|','|'%_extension%'|'),0,0,1))$puts(blnCountDown,$ifgreater($add($get(blnExcludeFolder),$get(blnExcludeFileExt),$get(blnExcludeOutput)),0,1,0))$puts(intOutputCount,$ifgreater($get(blnCountDown),0,$sub($get(intOutputCount),1),$get(intOutputCount)))$ifgreater($get(blnExcludeFileExt),0,%dummy%,$ifgreater($get(blnExcludeFolder),0,%dummy%,$ifgreater($get(blnExcludeOutput),0,%dummy%,$get(strOutputText)))) $loopend() </channel> </rss>

Requirements

ReleaseTime tag

Action type: Format Value
Field: RELEASETIME
Format string: $if2(%releasetime%,%_file_create_datetime%)

Action type: Format Value
Field: RELEASETIME
Format string: $ifgreater($strstr(%releasetime%,PM),0,$replace(%releasetime%, 1:,T13:, 2,T14, 3,T15, 4,T16, 5,T17, 6,T18, 7,T19, 8,T20, 9,T21, 10,T22, 11,T23, PM,Z, ,T),$replace(%releasetime%, 12,T00, AM,Z, ,T))

Action type: Replace with regular expression
Regular expression: RELEASETIME
Replace matches with: $3-$num($2,2)-$num($1,2)T$num($4,2)
Case-sensitive comparison: Unchecked

The user must create an Action in Mp3Tag that adds a 'ReleaseTime' tag to the files they want to Export with this script.

This ReleaseTime tag must contain a date and time correctly formatted like so: YYYY-MM-DDThh:mm:ssZ (the 'T' and 'Z' are literals).

Instructions for creating such an Action are outlined to the left. This Action will create a ReleaseTime tag automatically from the 'File Created' timestamp of the file.

Running the Action a second time will not overwrite the existing tag, so it's a future-proof method of timestamp dating.

If the File Create timestamp does not relate to the date you would like the podcast to be shown as released on then after the Action has run click on the file, open the Extended Tags item in the View menu, and manually edit the RELEASETIME value (remember to keep the same format).

Subtitle and Comment tags

  1. In the the menu of Mp3Tag click Tools>Options.
  2. Go to the Tag Panel section and add a new field 'SUBTITLE' and give it a name like 'Podcast Description (short)'.
  3. Click 'OK' on the windows, then go to the View menu and make sure 'Tag Panel' is checked.

Now a new field should appear where you can enter the podcast Subtitle text.

In order for a description of the podcast episode to appear in iTunes, and other RSS feeds, a Subtitle tag and optional Comment tag must be added to the files to be Exported.

The Subtitle tag should contain a short description of the episode, and the Comment tag a longer description.

The easiest way to add text to a Subtitle tag is to create a new 'Subtitle' field in the Tag Panel. Instructions on how to do this are outlined on the left.



  1. Close Mp3Tag. Open the Mp3Tag main folder.
  2. Open the folder 'data' and double-click the 'usrfields.ini' settings file.
  3. Create a new entry with the following text (change the #1 if there are already previous entries):
    [#1] value=COMMENT name=Podcast Description (full): multiline=1

Re-launch Mp3Tag and a new multi-line Comment box should now appear in the Tag Panel.

Although a 'Comment' field already exists in the Tag Panel it's only a single line, not so useful for entering paragraphs of text. Instructions on creating a multi-line Comment textarea are outlined on the left.

Further Customizable Fields (For Advanced Users)

<itunes:subtitle>

$if(%subtitle%,$char(13) <itunes:subtitle>%subtitle%</itunes:subtitle>,%dummy%),%dummy%)

This code controls what is displayed in the 'Description' column of each episode when viewing a podcast channel in iTunes, and in the 'Description' column in the iTunes window (then subscribed to a channel).

The default code will only ouput an <itunes:subtitle> tag if a 'Subtitle' tag is found in the audio file.

<itunes:summary>, <description>

$if(%comment%,$char(13) <itunes:summary>%comment%</itunes:summary>$char(13) <description>'<![CDATA[''<p>'$regexp($regexp($regexp(%comment%,'^\A[\s\r\n]+|[\s\r\n]+\Z',%dummy%),'(\r\n){2}','</p><p>'),'(\r\n)','<br/>')'</p>'']]>'</description>,%dummy%)

This code controls what is displayed when the 'i' icon beside the 'Description' column of each episode is clicked when viewing a podcast channel in iTunes, and next to a podcast item in iTunes (when subscribed to a channel).

The <description> tag is not used by iTunes but is used by non-iTunes RSS readers. It can contain a description of the podcast episode.

The default code will only output these tags if a 'Comment' tag is found in the audio file.

The <itunes:summary> text will be unformatted, whilst the text in the <description> tag will be formatted with HTML paragraph tags and line breaks, so it can be correctly displayed in non-iTunes RSS readers.



$if(%comment%,$char(13) <itunes:summary>%comment%</itunes:summary>$char(13) <description>'<![CDATA[''<p>'$regexp($regexp($regexp(%comment%,'^\A[\s\r\n]+|[\s\r\n]+\Z',%dummy%),'(\r\n){2}','</p><p>'),'(\r\n)','<br/>')'</p>'<p><a href="LINKTOSHOWNOTES">Shownotes</a></p>']]>'</description>,%dummy%)

For further customization you could add additional info inside the start or end of the existing <description>> tag code. For example: you may want to add a 'Download' link after the description, or add a 'Shownotes' link to the episode's shownotes.

Note: if you include such links they must be able to be generated automatically using placeholders based on some information stored in the audio file, such as %track%, %releasetime%, %title%, etc.