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.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 11:36:11
Script start
Timing: Jan 18 2025 11:36:11
Module start 'layout'
Timing: Jan 18 2025 11:36:11
Module start 'content'
Timing: Jan 18 2025 11:36:12
Module end 'content'
Timing: Jan 18 2025 11:36:12
Script end

Main resources:

Total runtime0.9187 sec
Peak memory usage4,096.0000 KB
Database Queries67

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 589.0469152.6250
Module start 'layout' 0.00730.0037 741.671939.4453
Module start 'content' 0.01100.9064 781.1172626.5391
Module end 'content' 0.91740.0012 1,407.656316.1641
Script end 0.9186  1,423.8203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3531160.0002
Check MTime0.00130.1379160.0001
Mysql Total
Database connection0.00070.078510.0007
Mysqli_queries0.858093.3963670.0128
Looping result0.00070.0766650.0000
Template Total0.878395.620.4391
Template load0.00190.205020.0009
Template processing0.876495.398020.4382
Template load and register function0.00140.150010.0014
states
state_id_array0.00100.111210.0010
state_identifier_array0.00150.161820.0007
Override
Cache load0.00160.1740240.0001
Sytem overhead
Fetch class attribute can translate value0.00060.067040.0002
Fetch class attribute name0.00130.138960.0002
XML
Image XML parsing0.00100.104540.0002
class_abstraction
Instantiating content class attribute0.00000.001770.0000
General
dbfile0.00150.1608170.0001
String conversion0.00000.001240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs