I have just started using the audio module, and for the purpose it's really nice. I use the 5.x-2.x version, and have found a new feature.

I have created som playlists, and attached som items to it, but when I wanted to play from the playlist, the items came up as node teasers, and not as a list in the extended player. This is what I hoped for, because it is much nicer for the users to be able to play all songs in the lists without start every song.

So, I was thinking how can we accomplish this, and after looking around in the audio module I saw it was all there. Specially with the audio_feeds module. Maybe this is just me not finding the right way to put this on, because it was so obvious, if this is the fact please enlighten me.

Ok, so to be able to view the items in the playlist in the extended player, change this at line 299 in the audio_attach.module:

function theme_audio_attach_list($nids, $teaser = FALSE) {
  drupal_add_css(AUDIO_ATTACH_PATH .'/audio_attach.css');
  foreach ($nids as $aid) {
    $audio = node_load($aid);
    $audio = node_prepare($audio, $teaser);
    $title = $audio->status ? l($audio->title, 'node/' . $audio->nid, NULL, NULL, NULL, TRUE) : check_plain($audio->title);
    $items[] = '<div class="title">'. $title .'</div>'. theme('audio_teaser', $audio);
  }
  return theme('item_list', $items, null, 'ol', array('class' => 'audio-attach-list'));
}

to

function theme_audio_attach_list($nids, $teaser = FALSE) {
  drupal_add_css(AUDIO_ATTACH_PATH .'/audio_attach.css');
  $fid = arg(1);
  if (module_exists('audio_feeds') && is_numeric($fid)) {
  	$player = audio_get_players('name', 'xspf_extended');
  	$playlist_url = url("node/".$fid."/xspf");
  	return theme($player['theme_xspf'], $playlist_url);
  }
  foreach ($nids as $aid) {
    $audio = node_load($aid);
    $audio = node_prepare($audio, $teaser);
    $title = $audio->status ? l($audio->title, 'node/' . $audio->nid, NULL, NULL, NULL, TRUE) : check_plain($audio->title);
    $items[] = '<div class="title">'. $title .'</div>'. theme('audio_teaser', $audio);
  }
  return theme('item_list', $items, null, 'ol', array('class' => 'audio-attach-list'));
}

Ok, if there is other or easier ways to do this I would be glad to know.

And sorry if this is an duplicate, but I couldn't find any issue about it.

Comments

zirafa’s picture

Status: Active » Closed (duplicate)

That's pretty much what you have to do (override that theme function). See duplicate issue at http://drupal.org/node/139581