Forums / Developer / Extending RSS to Podcast

Extending RSS to Podcast

Author Message

Brian Gambill

Monday 29 August 2005 9:21:43 am

I wanted to add podcast capabilities, but not endure weekly manual file changes. AS I look at the main difference between what eZ's RSS feed outputs and what is needed. It appears to only be missing the enclosures tag (see below). I have added a class atrribute(file)named 'mp3' to my custom class and added code to:
/kernel/classes/ezrssexport.php

~line 461:

				$mp3dataMap =& $object->attribute( 'data_map' );
        if ( !$dataMap )
            return false;

        $mp3Attribute =& $mp3dataMap['mp3'];
        if ( !$mp3Attribute )
            return false;

        $mp3Handler =& $mp3Attribute->attribute( 'content' );
        if ( !$mp3Handler )
            return false;

        $mp3Alias =& $mp3Handler->attribute( 'contentobject_attribute_id' );
        if( !$mp3Alias )
            return false;
        
        $mp3OriginalFilename =& $mp3Handler->attribute( 'original_filename' );
        if( !$mp3OriginalFilename )
            return false;
        $mp3filesize =& $mp3Handler->attribute( 'filesize' );
        if( !$mp3filesize )
            return false;    
            
                $Mp3Url = 'http://www.myurl.com/content/download/'.$object->attribute( 'id' ).'/'."$mp3Alias".'/'."$mp3OriginalFilename";
                $itemEnclosure =& $doc->createElementNode( 'enclosure', 
                                                            array( 'url' => "$Mp3Url",'length' => "$mp3filesize",'type' => 'audio/mpeg' ) );
                

What I am seeking is confirmation that I did this in a proper place. I realize hardcoding my url is bad practice, any suggestions would be helpful. The good news is that the podcasts work with these changes.

RSS 2.0 item enclosure tag explanation (http://blogs.law.harvard.edu/tech/rss#ltenclosuregtSubelementOfLtitemgt):
<enclosure> is an optional sub-element of <item>.

It has three required attributes. url says where the enclosure is located, length says how big it is in bytes, and type says what its type is, a standard MIME type.

The url must be an http url.

<enclosure url="http://www.scripting.com/mp3s/weatherReportSuite.mp3" length="12216320" type="audio/mpeg" />

Brendan Pike

Sunday 30 October 2005 8:40:40 pm

How did you go with this in the end Brian? It would be great to see your hack included in the core eventually.

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

tom stovall

Tuesday 07 March 2006 6:38:37 am

i've been hacking the ezrssexport class to get it to do the <itunes:x> rss extensions to be able to load a feed into iTunes and have it display on the ITMS, but I think I need to go ahead and make it an extension. Has anyone else tried to do add the iTunes extension to the rss feeds?

Gabriel Ambuehl

Tuesday 07 March 2006 6:54:13 am

I have created RSS export by adding a new content view and templates that render nodes to RSS on my site (http://triligon.org).

That approach could easily be expanded to contain application specific tags.

Visit http://triligon.org

tom stovall

Wednesday 08 March 2006 7:32:14 am

Ok, so i've hacked the ezrssexport class to include iTunes notation to a class named "podcast" and a Podcast custom class that handles all the iTunes extensions as well as storage of the podcast audio file. working version is at gaypinellas.com. I'm writing a howto and will post at my website when done. This should probably be an extension but I'm not that versed at writing extensions.