Index: video.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/video/video.module,v retrieving revision 1.14 diff -u -p -r1.14 video.module --- video.module 13 Sep 2005 12:12:23 -0000 1.14 +++ video.module 17 Sep 2005 00:56:38 -0000 @@ -1202,3 +1202,47 @@ function _video_page_goto($id, $type = ' } return false; } + +/** + * Implementation of hook_nodeapi(). + * We use this to append tags to the RSS feeds Drupal generates. + */ +function video_nodeapi(&$node, $op, $arg) { + switch ($op) { + case 'rss item': + // Only create tags for video nodes. + if ($node->type == 'video') { + return array(array('key' => 'enclosure', 'attributes' => array('url' => file_create_url($node->vidfile), 'length' => $node->size, 'type' => _video_get_mime_type($node)))); + } + break; + } +} + +/** + * Return the correct mime-type for the video. + */ +function _video_get_mime_type($node) { + switch (_video_get_filetype($node->vidfile)) { + case 'mov': + return 'video/quicktime'; + break; + case 'rm': + return 'application/vnd.rn-realmedia'; + break; + case 'flv': + return 'video/x-flv'; + break; + case 'wmv': + return 'video/x-ms-wmv'; + break; + case 'youtube': + // TODO. + return 'video/mpeg'; + break; + default: + // TODO: What should we use as default mime-type? + return 'video/mpeg'; + break; + } +} +