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.

eZ debug

Timing: Jan 18 2025 05:21:05
Script start
Timing: Jan 18 2025 05:21:05
Module start 'content'
Timing: Jan 18 2025 05:21:06
Module end 'content'
Timing: Jan 18 2025 05:21:06
Script end

Main resources:

Total runtime1.0784 sec
Peak memory usage4,096.0000 KB
Database Queries204

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 587.7109180.8359
Module start 'content' 0.00650.9109 768.5469631.6172
Module end 'content' 0.91740.1610 1,400.1641337.0625
Script end 1.0784  1,737.2266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.3692210.0002
Check MTime0.00150.1359210.0001
Mysql Total
Database connection0.00090.082310.0009
Mysqli_queries1.007593.42072040.0049
Looping result0.00200.18712020.0000
Template Total1.049897.320.5249
Template load0.00200.187820.0010
Template processing1.047897.158320.5239
Template load and register function0.00010.012510.0001
states
state_id_array0.00110.100210.0011
state_identifier_array0.00110.104520.0006
Override
Cache load0.00170.1545240.0001
Sytem overhead
Fetch class attribute can translate value0.00180.167550.0004
Fetch class attribute name0.00350.320160.0006
XML
Image XML parsing0.00110.099850.0002
class_abstraction
Instantiating content class attribute0.00000.001370.0000
General
dbfile0.00170.1548280.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs