audio_feeds_views_prepare_xspf

Versions
6
audio_feeds_views_prepare_xspf($title, $url, $nodes)

Prepare data for XML generation and return the feed

Code

contributions/audio/contrib/feeds/audio_feeds.views.inc, line 53

<?php
function audio_feeds_views_prepare_xspf($title, $url, $nodes) {
  global $base_url;

  // prepare feed metadata
  $metadata = array(
    'title' => $title,
    'author' => $base_url,
    'link' => $base_url,
    'feed_url' => $url
  );

  // prepare feed items
  foreach ($nodes as $n) {
    $audio = node_load($n->nid);
    // use the first image uploaded as the included image if it exists
    $image = is_array($audio->audio_images) ? current($audio->audio_images) : '';
    $items[] = array(
      'title' => $audio->audio_tags['title'] ? $audio->audio_tags['title'] : $audio->title,
      'author' => $audio->audio_tags['artist'],
      'album' => $audio->audio_tags['album'],
      'duration' => $audio->audio_file['playtime'],
      'link' => url('node/'. $audio->nid, array('absolute' => TRUE)),
      'image' => $image ? array('url' => $base_url .'/'. $image['filepath']) : '',
      'enclosure' => array('url' => $audio->url_play)
    );
  }
  audio_feeds_generate_xspf($items, $metadata);
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.