media into RSS

jjbarrows - December 15, 2008 - 12:30
Project:Media Manager
Version:6.x-1.x-dev
Component:Miscellaneous
Category:task
Priority:normal
Assigned:Unassigned
Status:needs review
Description

hi,
i'd also like to get the media node to report it's media file in the RSS (and attached files for nodes using the attach media route)

is this possible now of a new feature?

#1

rhys - February 10, 2009 - 04:21

Yes, I've got to look into this a bit more, since it revolves around using the hook_nodeapi and 'rss item', but I'm not familiar with it's use.

#2

rhys - February 10, 2009 - 04:39
Status:active» needs review

Could you check that changing the contents of hook_nodeapi() in mmedia_nodes.module to the following succeeds for you?

/**
* Implementation of hook_nodeapi().
*/
function mmedia_nodes_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if ($op == 'load') {
    $node->mid = db_result(db_query("SELECT mid FROM {media_nodes} WHERE nid = %d", $node->nid));
  }
  elseif ($op == 'rss item' && $node->mid && ($media = media_load($node->mid))) {
    $size = filesize($media->path . $media->name .'.'. $media->ext);
    $url = media_filename($media);
    return array(array('key' => 'enclosure', 'attributes' => array('url' => url($url, array('absolute' => true)), 'length' => $size, 'type' => file_get_mimetype($url))));
  }
}

 
 

Drupal is a registered trademark of Dries Buytaert.