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" />
|