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

      $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.

CommentFileSizeAuthor
#5 300281.patch1.53 KBdldege
#3 300281.patch1.34 KBdldege

Comments

swentel’s picture

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.

dldege’s picture

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.

dldege’s picture

Status: Active » Needs review
StatusFileSize
new1.34 KB

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.

swentel’s picture

Status: Needs review » 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 ?

dldege’s picture

Status: Needs work » Needs review
StatusFileSize
new1.53 KB

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.

swentel’s picture

Status: Needs review » Reviewed & tested by the community

yep, much better, rtbc!

dldege’s picture

Status: 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.

swentel’s picture

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.

swentel’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Status: Fixed » Active

changing status

swentel’s picture

Status: Active » Fixed

commited to D6 branch.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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