So we use a 3rd party podcast host and when creating our Podcasts, we do not upload a file in Drupal 6. We enter an RSS enclosure tag. This is how we normally generate the in the XML file. How do we get this to be populated into the final feed? Documentation only suggest for D6 users to pull the "file upload" or "image" from the podcast? We have neither of these, any ideas?

Comments

maciej.zgadzaj’s picture

Status: Active » Fixed

Actually, you can use any type of field with any value in it, you just need to implement hook_views_rss_item_elements_alter(&$elements) to add your own preprocess function for enclosure element and make sure that it returns correctly formatted element array (you can check views_rss_itunes_preprocess_channel_image() for a basic example).

mealto’s picture

Thanks for the reply. This is a little beyond my technical expertise but let me do more reading and see if I can figure it out. For the record, we have been using http://drupal.org/project/encl_remote to populate our enclousre tag but this is now limiting us and it does not look like there is a 7 version coming so we will look to phase this out and move our feed output to Views RSS: iTunes Elements. Everything is exactly the way we want it but this last enclosure tag is a toughie for us. btw, great job on the module. We created our initial itunes feed by hand and mirrored things to a tee as to what Apple wanted. Glad to see someone finally made a Drupal module that does this well.

If you have any suggestions on how I can begin to use your plugin, do share. I can follow instructions well, just cannot figure things out as I am not a developer.

maciej.zgadzaj’s picture

As an example, assuming that you have full URL to the external file stored in a simple text file, the most basic version would look something like this:

/**
 * Implements hook_views_rss_item_elements_alter().
 */
function MYMODULE_views_rss_item_elements_alter(&$elements) {
  $elements['views_rss_core']['enclosure']['preprocess functions'] = array('mymodule_preprocess_item_enclosure');
}

/**
 * Preprocess function for item <enclosure> element.
 */
function MYMODULE_preprocess_item_enclosure(&$variables) {
  if (!empty($variables['value'])) {
    $variables['value'] = array(
      'arguments' => array(
        'url' => $variables['value'],
        'length' => 'file_length_here',
        'type' => 'file_type_here',
      ),
    );
  }
}

Obviously you need to provide proper values for length and type arguments.

Status: Fixed » Closed (fixed)

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

hongpong’s picture

Title: Druapl 6 using 3rd party Podcast Host » Drupal 6 using 3rd party Podcast Host
Version: 6.x-1.0-rc1 » 7.x-1.x-dev

Is there any further info available about how which hook to use for D7? Thank you!

maciej.zgadzaj’s picture

Version: 7.x-1.x-dev » 6.x-1.0-rc1

Please do not edit or re-open already closed issues. If you have a problem or need a support, just open a new issue.

Answering your question - D7 uses exactly the same hooks as D6.