Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pandora_song.audio_url is empty #52

Open
jmouel opened this issue Jan 7, 2013 · 3 comments
Open

pandora_song.audio_url is empty #52

jmouel opened this issue Jan 7, 2013 · 3 comments

Comments

@jmouel
Copy link

jmouel commented Jan 7, 2013

I had to change the Song.find_or_create_from_pandora_song method to get the song URL from pandora_song.audio_urls['HTTP_128_MP3'] rather than using audio_url, which doesn't seem to contain any data.

I also had to add HTTP_128_MP3 to station.rb DEFAULT_AUDIO_FORMATS so that it would be included in songs from the station. HTTP_192_MP3 is no longer provided to non-Pandora One partners (even if the user login is Pandora One) and the only partner credentials that seem to work are Android.

@arbales
Copy link
Collaborator

arbales commented Jan 7, 2013

Oh nice. Could you submit a patch for that?

@arbales
Copy link
Collaborator

arbales commented Jan 7, 2013

Also, happy new year!

@jmouel
Copy link
Author

jmouel commented Jan 7, 2013

Happy new year!

This is a hack. I just wanted to get things working - I don't know enough about Pandora's audio formats to come up with a real solution, although I think using the quality (low/med/high) rather than format, and allowing the admin to configure that might work.

The change below isn't sufficient, 'cause Pandora won't send the HTTP_128_MP3 url. You also need to change pandora_client. Add 'HTTP_128_MP3' to DEFAULT_AUDIO_FORMATS in lib/pandora/song.rb.

From 21c06ae71500ca72b5ef43169fef500b7bbb53e7 Mon Sep 17 00:00:00 2001
From: Jason Ouellette <jason@parkstconsulting.com>
Date: Sun, 6 Jan 2013 20:52:48 -0800
Subject: [PATCH] https://github.com/nixme/warble/issues/52

---
 app/models/song.rb |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/models/song.rb b/app/models/song.rb
index f3045f4..feae7bd 100644
--- a/app/models/song.rb
+++ b/app/models/song.rb
@@ -26,7 +26,7 @@ class Song < ActiveRecord::Base

   def self.find_or_create_from_pandora_song(pandora_song, submitter)
     if song = where(source: 'pandora').where(external_id: pandora_song.id).first
-      song.fsck! pandora_song.audio_url
+      song.fsck! pandora_song.audio_urls['HTTP_128_MP3']
       song
     else   # first time seeing the song, so create it
       song = Song.create({
@@ -35,7 +35,7 @@ class Song < ActiveRecord::Base
         artist:      pandora_song.artist,
         album:       pandora_song.album,
         cover_url:   pandora_song.album_art_url,
-        url:         pandora_song.audio_url,
+        url:         pandora_song.audio_urls['HTTP_128_MP3'],
         external_id: pandora_song.id,
         user:        submitter
       }, without_protection: true)
--
1.7.9.6 (Apple Git-31.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants