The URL stored in the RSS enclosure doesn't work because it is absolute. Not sure why this is, but it probably shouldn't be a direct link anyhow. The following patch replaces the raw link to the audio file with the audio/download/[nid] path that is more secure and will fix the broken RSS feed.

Files: 
CommentFileSizeAuthor
audio.module.rss.patch892 byteszirafa

Comments

Colin Brumelle’s picture

Farsheed,

I've had trouble in the past with some podcast clients not playing the file unless it was a full absolute URL ending in '.mp3' Talk about inflexible! I think this problem was with both iPodder and iTunes. I'm not sure of a good way around this... What client did it not work on for you?

C

zirafa’s picture

I'm not sure why this was happening - here is an example though:

go to:
http://playlist-demo.drupalart.org/audio/feed

and then cut and paste one of the file enclosures into a new browser window, i.e.:

http://playlist-demo.drupalart.org/files/audio/SUPERWOMANPREV.mp3

and it will say "page not found". however, if you click the audio/download link for the file, it works. straaange.

Could this be a problem with the CHMOD settings for the files/audio folder? If so, is there any way the audio module could set the permissions when those folders are created?

-Farsheed

oliver soell’s picture

Colin, regarding itunes not accepting podcast items without the url ending in mp3 - I changed my "rss item" nodeapi switch to return the url /audio/download/<x>/sillyitunes.mp3 and that seemed to do the trick.. when you put this into a browser (safari at least) it will play it inline rather than downloading it (just checked, firefox will download), but it does indeed work in itunes as a podcast.

Colin Brumelle’s picture

Changing the url to something like /audio/download//sillyitunes.mp3 is a good idea. I'll try playing with this a bit...

Colin Brumelle’s picture

OK,

So I just made it so that regardless of URL settings, (public or private download settings) or if you have clean URL's on or off, the complete and absolute URL of the mp3 is put into the enclosure tag in the feed. The reason is that upon reflection, I don't see a real difference security wise between having something like:
http://mysite.com/audio/dowload/1/mysong.mp3
or
http://mysite.com/files/audio/mysong.mp3

Both give you the audio file!... And the latter seems simpler and less error prone for flakey podcast clients.

This change is in CVS now. Comments? Does this make sense?

julianp’s picture

Priority:Critical» Normal

Dear Colin,

Just a quick description of how I got here. I couldn't get iTunes to download the mp3. I checked out the feed that was being generated, and it was adding an enclosure that was going directly to the file (http://whatever.com/files/audio/whatever.mp3). When I typed the url into my browser, I get: Page Not Found.

I tracked down the line of code that generated the enclosure, and I modified the audio_nodeapi method to read:

return array(array('key' => 'enclosure', 'attributes' => array('url' => $GLOBALS['base_url'].'/audio/download/'.$node->nid.'/'. rawurlencode($file->filename), 'length' => $file->filesize, 'type' => $file->filemime)));

Now the enclosure reads: http://whatever.com/audio/download//whatever.mp3

And it works in iTunes.

Are you going to keep using the absolute, file url for enclosures? Because that does not work on my setup, and I'm not sure why.

Thanks!
Julian

julianp’s picture

Sorry, silly html escaping:

Sentence in above post should read:

Now the enclosure reads: http://whatever.com/audio/download/<node-id>/whatever.mp3

drewish’s picture

i just added some code to do this in the 4.7/HEAD branch.

drewish’s picture

Version:5.x-1.x-dev» 4.6.x-1.x-dev
Status:Reviewed & tested by the community» Fixed

i'm pretty sure this was fixed.

Anonymous’s picture

Status:Fixed» Closed (fixed)
Treesong’s picture

Title:RSS feed links don't work (audio/feed)» RSS feed links and Clean URLs
Version:4.6.x-1.x-dev» 5.x-1.x-dev

This patch (at least I think I've tracked it down to this patch) actually appears to be causing me trouble. (I originally posted about this at http://drupal.org/node/71922 before I figured out what the problem was.)

I have Clean URLs disabled. Therefore, my RSS feed has generated URLs for the individual MP3 files that contain a question mark / query. In other words, it produces URLs such as:

http://treesong.org/yourcommunityspirit/?q=audio/download/10/file.mp3

These URLs work fine in my browser, but they cause iTunes to reject the feed. A direct link to the file works, but this indirect link doesn't seem to work. Maybe it would work without the question mark, but I'm not sure of the best way to edit the code to change the way that it's creating the URL for each MP3 file.

Any ideas on how to fix this?

drewish’s picture

Status:Closed (fixed)» Active

well, lets open this back up then.

zirafa’s picture

I believe iTunes doesn't play nice with ?q= strings. Frankly, iTunes is a bit of a finicky beast.

drewish’s picture

Title:RSS feed links and Clean URLs» iTunes only works with clean URLs
Status:Active» Closed (won't fix)
Ricco’s picture

Title:iTunes only works with clean URLs» problem with iTunes RSS file address
Component:Code» Miscellaneous
Category:bug» support

I just installed the audio module, and am trying to create an iTunes RSS feed from a audio content type. I have used the audio view to try to create the feed, and have changed to iTunes feed were able.

I get a valid feed, but the problem is that the enclosue and GUI address in the RSS feed are;
http://mysite.com/audio/download/407/audiofile.mp3

And the iTunes subscription craps out. If I change the URL to;
http://myside.com/files/audio/audiofile.mp3

The iTunes subscription will work.

The RSS will work via a browser, but iTunes cannot make sense of it. If I go in and change the URL from the two references above to the second URL, then the feed will work. I have tried both HTTP and private file storing, and I just can't figure out what I am doing wrong. Am I using a wrong field in the fields in the view? Any help would be appreciated

Cheers! Ricco

mfb’s picture

There could be something unusual about your file, filename or something else causing the problem.. itunes subcription is working ok for me.

Sakrecoer’s picture

and how do i install that patch?
filename of the file to be edited and line number would be greatly appreciated! :)