Rather than call get_post_meta($post->ID, 'enclosure', true); I would recommend using the PowerPress function: powerpress_get_enclosure_data(), it returns an associative array with the following keys: id (post id), feed (feed slug name), url (media URL), duration (in seconds), size, type, width, height (for video) plus all other attributes if configured such as keywords, summary, subtitle, etc...
Using powerpress_get_enclosure_data() has a number of advantages. First, if the user configures stats, the redirect will be added to the URL. It will also populate the size and type if they are empty based on the file extension.
powerpress_get_enclosure_data() it takes 2 arguments: $post_id, $feed_slug
Post ID is obvious. The Feed slug is the same slug value as the feed. e.g. the default podcasts feed slug is 'podcast'. So to get that podcast data you call powerpress_get_enclosure_data($post->ID, 'podcast');
powerpress_get_enclosure_data($post->ID, 'podcast'); is the equivalent to $enclosureData = get_post_meta($post->ID, 'enclosure', true); + all that other code you have to split the value and pull out the duration and keywords.
So if you created a channel with the slug name 'pdf and you want the itunes keywords, you could do the following...
$EpisodeData = powerpress_get_enclosure_data($post->ID, 'pdf');
if( !empty( $EpisodeData['keywords']) )
echo trim( implode(', ', $EpisodeData['keywords']), ', ');
You can get a list of all the channel slug names by doing the following...
$PowerPressSetings = get_option('powerpress');
$Channels = array('podcast'=>'Default Podcast Feed');
if( !empty($PowerPressSetings['custom_feeds']) )
$Channels = array_merge($Channels, $PowerPressSetings['custom_feeds']);
while( list($channel_slug, $channel_title) = each($Channels) )
{
// Do something here...
}
You're getting pretty deep into this! If you're making a theme that will be available on wordpress.org, let me know and we'll link to it in the plugin's readme.txt as well as on the PowerPress wordpress.org page.