How would you tackle this?

Joined: 06/11/2007

I'm trying to display a page that will show multiple albums and the songs in those albums. The song information should include the title and a player.

My approach was to create a node called song and a node called album. The song node has the audio file and a relational link to the album node. The album node has the album title and the cover artwork. I have a view that calls songs and the album relational link so it outputs the album information then the song information in a table format. The problem I am having relates to theming the mp3 file. I can't see where the mp3 file is being inserted into the view in order to wrap it with a swf() function.

I could use suggestions or perhaps a whole different approach.

-sirkyle

G&G Podcast Host
Rob Feature's picture
Joined: 06/01/2006
Right on

I think youre right on here sirkyle. This is exactly what I do for "sermon series" displays. You have a node type of 'series' and a 'podcast' node type. The podcast has a node reference to a series. We then build a view that is embedded on the series page with the series reference as the argument.

I think you're doing the right thing here.

For the files in the View I'd reccomend a list (table display, etc) type view. There should be an option when configuring the filefield in the view for displaying as a player (somehow...I don't quite remember how). I'll double check this when I have a second.

-Rob Feature
Geeks and God Co-Host
www.mustardseedmedia.com

Joined: 06/11/2007
Thanks Bob

I have it up here at the moment: rocknpraise.rosevillechurch.com/products.
I can generate the view basically how I want it, in a table, but when it comes to calling the swf() fuction, I can't find a field reference that will work. I've done a print_r on all the relevant .tpl files that the view information suggests and nothing reveals the file.mp3 field like it does when theming a standard view.

-sirkyle

G&G Moderator
Josiah's picture
Joined: 12/20/2007
SonyBMG's MyPlay

You may like to look over Lullabot's creation of a page dedicated to displaying artists, albums and songs for SonyBMG. They published a reveal of their work here: http://drupal.org/node/241344

G&G Podcast Host
Rob Feature's picture
Joined: 06/01/2006
node_load or db call

I'm assuming you're using Views theming and you've created a tpl.php file for that field, right? If so, and that info really isn't anywhere in the available variables, there's really 2 solutions.

  1. The easy, yet low performance, solution is to just do a node_load() in that tpl file and make all the node info available. This is not really a good way to do it, but if it's a lower bandwidth site and you don't have concerns about processing power, it'll save you alot of time
  2. The other way to do it (the right way) would be to write a manual database call in your template.php file and grab the path that way. This should offer hte best performance, but unless your a mysql guy, it may take some time to get it exactly right

Those are the two options that I would, personally, explore. A Drupal guru may have another method, but that's how I'd accomplish it on my own.

-Rob Feature
Geeks and God Co-Host
www.mustardseedmedia.com

Joined: 06/11/2007
Thanks so much

Josiah - Thanks for the reference, I'm looking over it now.
Bob - Thanks for the pointer, I think I'll SELECT* my way though it

-sirkyle

avr
avr's picture
Joined: 10/14/2008
Using SWF Tools

I have a quick question hopefully someone can shed some light on.

I was setting up something very similar, but had trouble getting SWF Tools to load the player I was using (1pixelout). I was able to reveal the .mp3 file and path in a View and use print swf(); in a views tpl file. However, I always received the error message that said something along the lines of Flash content not defined for series (it's the standard error message for SWF Tools).

Any thoughts on why this might happen?

Joined: 06/11/2007
Thats what I'm facing

@avr
That is what I'm facing. As per Bob's suggestion I'm going to figure out how to make a database call in the tpl file to gather the correct variable for the MP3 file. I'm hoping that once I get that the swf() function will work. If I get this figured out I'll post the code here, if you find a way to do it I'd love to see how.

-sirkyle

Joined: 09/05/2008
Tutorial?

The other way to do it (the right way) would be to write a manual database call in your template.php file and grab the path that way. This should offer hte best performance, but unless your a mysql guy, it may take some time to get it exactly right.

Would love to see a Mustard Seed Media video/G&G podcast/G&G tutorial on how to do this... :)

Joined: 06/11/2007
the quick trick

@AVR
I stored a text field in the song node that is the URL to the mp3 file. I was then able to pull the the field that points to the URL.
My field name is: field_audio_link
I issued a print_r($row) on the file: views-view-field--field-audio-link-value.tpl.php

<?php print swf($row->node_data_field_album_track_field_audio_link_value); ?>

Kind of a lame way to do it, but it works.

Still trying to figure out the sql query to actually call the field from the CCK filefield.

-sirkyle

avr
avr's picture
Joined: 10/14/2008
@sirklye

Thanks for posting the idea you used.

I actually had been doing just fine getting the path into Views. I was using "FileField" module and in CCK Display Fields section, I just selected "path to file."

This returned the path in the Views tpl.php file just fine. My issue was/is getting the SWF tools player to load. With your print swf(....) are you getting a player loaded?

Thanks,
Aaron

If anybody else can help, that would be great!

Joined: 06/11/2007
I was getting the same error message

@avr
I was getting the same message. In the standard view I could see the file correctly, but when theming it if I passed the output to swf I just got that error. It is a generic error so it could mean anything. I can get a player to show, but it isn't attached to a file and so will not play. At least not until I created a CCK field to specifically pass the URL as a text file, now I can get it to play.

-sirkyle

G&G Podcast Host
Matt Farina's picture
Joined: 06/01/2006
Same Here

We dealt with those errors when building the new G&G site. I never found a good fix for the problem so we went a different way. It's a strange issue. We don't have a solution at this point.

Matt Farina
Geeks and God Former Co-Host
www.mattfarina.com

Joined: 06/11/2007
Which way did he go? Which way did he go?

So which way did you go Matt?

-sirkyle

G&G Podcast Host
Rob Feature's picture
Joined: 06/01/2006
Relationships!

sirkyle:
on the G&G site, we just avoided this all together and used a node view instead of a field view (totally cheating, I know). Then we didn't have to deal with this.

However, the correct way to do this (as I've recently learned about thanks to glidetothehoop's last comment here) is to expose the filepath using the Relationship feature in Views 2. I haven't tried this specifically in this situation, but it's working just great in all my other Views theming situations.

Hope that helps!

-Rob Feature
Geeks and God Co-Host
www.mustardseedmedia.com