Support other RSS tags

dldege - August 26, 2008 - 20:13
Project:PicLens
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Right now in mediarssapi_format_item() there is no way to passing other RSS tag information like description, GUID, and so on. I wanted to do somethign like this

<?php
      $item
= array(
       
'title' => $file->filename,
       
'description' => $node->title . ' ' . $file->filename,
       
'link' => url('node/' . $node->nid, NULL, NULL, TRUE),
       
'thumbnail' => file_create_url($file->filepath),
       
'content' => file_create_url($file->filepath),
        );
     
$items .= mediarssapi_format_item($item);
?>

Description is ignored. I think it would be nice to be able to format a complete RSS tag and for that matter.

#1

swentel - August 26, 2008 - 23:52

It resembles a bit like this request: http://drupal.org/node/299196
I'm not sure yet how I'm going to implement it, but it will definitely happen!
More news later.

#2

dldege - August 27, 2008 - 14:30

Yes, its similar but I think the approach in that issue is wrong because I don't agree with using the theme layer for what I consider non-display logic. This is however just my preference. For what I described above I'd suggest using format_rss_item, http://api.drupal.org/api/function/format_rss_item/5, which is already set up to handle extra keys. All you need to add in your API layer is maybe something that formats media xlmns items to include the namespace. So in this way your modules handling of building the items is exactly the same as the method used in nodeapi rss item. Changing this would also make it easy to facilitate support for rss item as I mentioned in http://drupal.org/node/300327.

#3

dldege - October 14, 2008 - 21:46
Status:active» patch (code needs review)

Here's a patch that I think covers it and makes the RSS feed a lot more flexible.

Please review and then I think its RTBC.

AttachmentSize
300281.patch1.34 KB

#4

swentel - October 15, 2008 - 08:29
Status:patch (code needs review)» patch (code needs work)

I think it needs some work, after applying the patch, an item in the feed looks like this:

<item>
   <title></title>
   <link></link>
   <description></description>
   <title>Code sprint</title>
   <link>http://drupal5/node/2</link>
   <media:thumbnail url="http://drupal5/files/images/DSCF0131.preview.thumbnail.JPG" />
   <media:content url="http://drupal5/files/images/DSCF0131.preview.JPG" />
</item>

As you can see the title and link tag are rendered twice in the xml, I think we should change the call to format_rss_item to

format_rss_item($item['title'], $item['link'], $item['description'], $item);

and also unset title, link & description from the item array. What do you think ?

#5

dldege - October 15, 2008 - 14:39
Status:patch (code needs work)» patch (code needs review)

Yes, in fact I had that in in there and I attached the wrong patch above.

Here is the right patch.

Thanks for testing and catching this.

AttachmentSize
300281.patch1.53 KB

#6

swentel - October 15, 2008 - 14:44
Status:patch (code needs review)» patch (reviewed & tested by the community)

yep, much better, rtbc!

#7

dldege - October 15, 2008 - 14:59
Status:patch (reviewed & tested by the community)» fixed

Fixed in piclens.module version 1.1.2.30

@swentel I'm not sure how I/you manage porting this to the D6 branch.

#8

swentel - October 15, 2008 - 15:14

This patch applies with some fuzz on Drupal 6 branch, not tested though with actual rss output (have no local installation right now), but if it's ok, apply it.

#9

swentel - October 17, 2008 - 11:21
Version:5.x-1.x-dev» 6.x-1.x-dev
Status:fixed» active

changing status

#10

swentel - October 18, 2008 - 19:10
Status:active» fixed

commited to D6 branch.

--project followup subject--

Anonymous (not verified) - November 1, 2008 - 19:15

Automatically closed -- issue fixed for two weeks with no activity.

#11

Anonymous (not verified) - November 1, 2008 - 19:21
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.