Jump to content

Anyone want to port this open source, Linux pandora client to windows?


Recommended Posts

http://6xq.net/html/00/17.html

I don't know enough right now to do it myself. I don't know what's changed since I last messed around with Pandora but at least the song skips per hour limitation can be gotten rid of entirely with a custom client.

Hrm. interesting. Might work off the bat with cygwin, but that's a bit of a dirty way to do it. The possibilities of this intrigue me, though.

I have to say looking at the source he has a logic but really weird way to name classes :P

If i do end up doing anything w/ it, it'd be using it as an example to implement a minimal ripper in c# and integration into the Pandora plugin (for saver2) to allow standalone ripping.

I have experience with C/C++, and that experience is telling me that given the choice i do not want to use it if i can help it. Don't get me wrong (call me lazy if you will), I like c/c++ but it's a cast iron motherfucker at times. GUI esp. in c++ scares me.

looks like libwaitress is a minimal http library to support enough to get/post pandora requests

libpiano contains the main logic

Link to post
Share on other sites
  • 2 weeks later...

Wow, this lit a fire under my arse. I've written an unpublished stream ripper that works with Pandora radio but I never did like the whole proxy/packet capture architecture (although the work done by others here (go ZZJ!) is way more impressive than anything I've accomplished so far. But looking over the source that Full_Power_Explodes linked to I've cobbled together some experimental C# code to login, retreive the station list, retrieve the first playlist from the first station and play the first song from that list.

post-8738-1249620644_thumb.jpg

Talk about your turbo mode! How about grab a playlist, download and save the 4 songs, grab the next playlist, download and save the 4 songs...

Repeat until Pandora sends the black helicopters ;)

I really just want to replace the resource intensive flash player so my antiquated PC that I stream music with in my lab doesn't max out the CPU playing music while I work.

Link to post
Share on other sites

What do you use for the actual audio playback? Ii'm working on something similar for the sproxy/saver2 "architecture" so songs can be saved and so on, but the bit that gets me is what to use for playing audio. I was thinking mplayer as it supports raw mp3 AND aac, however to stream audio data/control key presses to it the console window must be visible, at least last i tried. Kinda kills it. Using libs would be a pain in the ass considering c/c++ interaction at c# is an iffy thing at best (very fragile) moreover separate decoding systems would be required for mp3 and aac playback

did you translate the decrypt stuff? i took the lazy route and stuck that bit in a DLL (still c++) and used .NET dllimport.

i personally think it'd be a good idea if you went through with this and wrote a minimalistic player; .net is kinda heavy (memory-wise) but a player-only would cprobably have a lot less overhead than a proxy-saver2-various-plugins-AND player combination.

Link to post
Share on other sites

I used FMOD to play the audio. It has a c# wrapper so its just the one dll to lug around. I've never used it before but it was trivial to add it and get it working thanks to their good documentation and sample code.

I did convert the encrypt/decrypt routines to c#, I could pass those along to you if you'd like.

I know they could but I'm wondering if Pandora would screw this all up by changing keys. Anybody know if they've changed keys in the past and if they did do they do it often? I'm a paying subscriber so writing my own player is more an exercise of the brain than anything else especially since I'm not bypassing any ad revenue they would get from my account. I sometimes use the desktop application to listen but I don't like the fact that it does not minimize to the system tray and I can't backtrack and thumbs up/down a song that has already finished playing.

Link to post
Share on other sites
I used FMOD to play the audio. It has a c# wrapper so its just the one dll to lug around. I've never used it before but it was trivial to add it and get it working thanks to their good documentation and sample code.

I did convert the encrypt/decrypt routines to c#, I could pass those along to you if you'd like.

I know they could but I'm wondering if Pandora would screw this all up by changing keys. Anybody know if they've changed keys in the past and if they did do they do it often? I'm a paying subscriber so writing my own player is more an exercise of the brain than anything else especially since I'm not bypassing any ad revenue they would get from my account. I sometimes use the desktop application to listen but I don't like the fact that it does not minimize to the system tray and I can't backtrack and thumbs up/down a song that has already finished playing.

I was more curious about the music interface bit - i was thinking using async receive to feed data to the library/program/whatever. However, FMOD does not seem to support AACplus? (required for "standard" pandora). I was also curious if you ended up using a custom data type for each or generic (i was thinking just turn all XML responses into dictionaries and pick keys as proper from type of request.

I don't thnk they've changed keys recently but worse case you just decompile the flash player and get em from there (so i understand)

Link to post
Share on other sites

mmm, got it working quite decently now....

todo:

station creation/seeding mechanism

audio format logic

proper playback backend (playpause, volume control, song length?)

other config

working:

feedback

"playback" (mplayer kludge)

skip

XMLRPC

station changing

scrolling song title

login/logout bits

6yw28Qz69TZb135vJ5j5dn29Oa40wg8D.PNG

need to figure out a way to get the song length, extrapolating from the content-length won't work due to varying bitrates + joint stereo encodings. (i plan to stream it). This is why turbo mode works: the pandora flash player is not aware of the song length outside of what the decoding mechanisms tell it.

For some reason, pandora's only giving me mp3 with this, not aac. Maybe it's truly tied to the control on the flash player.

decided to leave the turbo mechanism as-is (in the saver), seeing as if you let it run wild you'll get banned from pandora in about 5 seconds (5 * 4 = 20 songs; gets End of playlist detected fault, persists for about 30 minutes). So waiting 5-30 seconds between songs leads to pandora continuing to rip for longer.

I went with a state machine to run it all... i really do miss drop through switch statements (c# requires each case that is not in a series of case statements to be terminated by a break).

oh, a note, use https:// for the authenticateListener method, otherwise you're throwing out your password and username in plaintext. That, and I imagine it looks funny on pandora's end. I assume you are using HttpWebRequest, changing http://www.pand... to https is enough.

I gotta say, playing pandora with about 2% net cpu use is oh so nice. I'd upload a version for people to play with, cept my password is kinda hardcoded in it :X lol

Link to post
Share on other sites

Crap, you put an old man (grandfather) to shame :) It's awesome to see how quickly you can crank out the bits; I code too slow for the intenet age (plus my waterbed sprang a leak Friday!).

Interesting your point about sending the authentication via https. I'm encoding the post data like pianobar did so technically it's not clear text but it is going over http and working, so Pandora is capable of receiving both ways with not complaint?

I'm planning on bypassing the streaming and pull the mp3 down in its entirety before playing; ah the benifits of a 20Mbit symmetrical fiber connection! This will allow me to know the duration of the song and also allow seeking within the track during playback.

I also have not figured out how to get aac but the playlist contains tags for the 128kbps audioURL as well as loFiAudioURL for 64Kbps mp3.

Keep up the great work!

Link to post
Share on other sites
Crap, you put an old man (grandfather) to shame :) It's awesome to see how quickly you can crank out the bits; I code too slow for the intenet age (plus my waterbed sprang a leak Friday!).

Interesting your point about sending the authentication via https. I'm encoding the post data like pianobar did so technically it's not clear text but it is going over http and working, so Pandora is capable of receiving both ways with not complaint?

I'm planning on bypassing the streaming and pull the mp3 down in its entirety before playing; ah the benifits of a 20Mbit symmetrical fiber connection! This will allow me to know the duration of the song and also allow seeking within the track during playback.

I also have not figured out how to get aac but the playlist contains tags for the 128kbps audioURL as well as loFiAudioURL for 64Kbps mp3.

Keep up the great work!

Usually it's the same server listening on both ports, so it's indifferent to which method is used. Good point about the encoding, forgot about that. Think i'd leave it as SSL just the same though.

I'm still not sure how to go about the playback. I looked at BASS, but that was far too complex. might see if i can use the FAAD and MAD lib like pianobar uses; atleast i'd have an idea of how it works.

Hrm. I've been getting 128kbs too (not 192kbs, or 64kbs). And no AAC. I -should- be getting 192kbs MP3, but it's weird that i get no AAC either. Maybe pandora changed formats (again)? Can't check right now

Link to post
Share on other sites
Any "ready-made" Linux LiveCD in a foreseable future?

it'd be easier if you made one yourself rather than asking for one; a livecd that is "ready made" would entail sticking a binary on an existing livecd and launching it when started. Nothing more can be done. You're going to have to configure it just the same as if you had run the same binary on your prefered desktop OS. There is no advantage to using a livecd; in fact it is harder as hardware may not be supported, you need to configure OS stuff, etc. Moreover. It's an alien environment to do much more than browse the Internet. Can't save settings proper either.

If someone else wants to waste bandwidth hosting a livecd, That's fine. I just don't see the point in asking in every thread.

AnonC:

Clever idea I had; you can encrypt the user/pass with the crypto stuff. Beats ROT13, for sure.

Got logging in/logging out and station selection done now. Scrolling title, too. Gotta find a place to add the config button (launch on start + minimize sproxy, and skip song when badly rated).

Oh and the whole stream songs/playback control, which isn't possible with the mplayer kludge.

Think i might well take another look at messing with the crypto stuff, as it seems like a fairly small price for security. Simpler than i expected.

Rigged PS to spit out the decrypted XML posts, gonna see if i can find any difference which might cause pandora to send 128kbs mp3 (though, if it does that for regular accounts, it would be something to note)

Found it. It really was due to not urlEncoding the - in mp3-hifi to %2D. lol

Looks like pandora must get the length by interpolating from the content-length and known bitrate (mp3 = 64kbs, aacplus = 64kbs, mp3-hifi = 192kbs)

So.

// qualityIndex = kbs / 64

int l1 = FileLengthInKB/(8 * qualityIndex);

int length = ((int)(l1 / 60) * 60) + (l1 % 60) + 5;

Not perfect, but close within about 5 seconds. Though it's probably more accurate on metadata-less files. What do you use to estimate? Or do you use FMOD to tell the length? More or less perfectly accurate on files without metadata, +- 1s

Link to post
Share on other sites
  • 3 weeks later...

almost finished my pandora client.... finally conquered the control by some named pipe douchebaggery.

GfSA0F4iLEstc6KS07E74j0sq7mE242p.PNG

keyboard = toggleable media keys control

rocket = turbo control (click to toggle)

can click the speaker to toggle mute

ended up using the named pipe to feed mplayer the song data while the stdin was used for slave commands (opposite of how i had intended, but mplayer wanted nothing to do with the pipe as control)

Supports creating new stations and seeding stations, shuffling stations (pseudo-quickmix) and songs. unlimited skips (but if you spam them quickly you will get a temp ban from pandora)

assuming it doesn't die horribly when i toss it on my macbook & a virtual machine for testing, i'll upload it in the next day or so. (this is integrated into the pandora saver2 plugin, not standalone per se)

I had kinda hoped to keep this a "clean" implementation (not using exotic IPC or dllimports) but that's seemingly impossible at this point. Ah well.

Link to post
Share on other sites

going to be windows only atm - it uses windows specific features like named pipe. Maybe if .net works well under wine would it work, but last i knew .net didn't. Mac wouldn't work at all, unfortunately.

for linux you could use pianobar (granted, it's not gui)

Also, it supports being run by a host app, which is a bit easier on memory use though song downloading is completely disabled in that case (as saver2 is not active, the pandora saver plugin which handles all of that is also not running). Doesn't reduce the on disk size much, but i figured people might like it.

Download it and give it a try: http://hak5.org/forums/index.php?showtopic=14181

An update: SProxy/Saver2 and the Pandora client do indeed function under wine. See http://hak5.org/forums/index.php?showtopic...st&p=146189 It's a bit.... moody.... but it does work. (i was using mac os, should work fine on linux as well)

Link to post
Share on other sites
  • 2 months later...

I've been playing with pianobar on linux and wondering about the possibility of turning it into something that operates like ZZJ's standalone client for windows. From ZZJ's posts it seems that he used some of the code from pianobar to do what he did with the standalone client.

Couple of questions to anyone who knows how pianobar works:

Where does it cache the aac files from pandora on the client computer?

Would running it through a proxy similar to SProxy.exe allow the same functionality as ZZJ's standalone player?

Any help would be appreciated. Not an expert programmer, mostly fiddle around in python. Sorry about the rudimentary questions...

Thanks in advance.

Link to post
Share on other sites
I've been playing with pianobar on linux and wondering about the possibility of turning it into something that operates like ZZJ's standalone client for windows. From ZZJ's posts it seems that he used some of the code from pianobar to do what he did with the standalone client.

Couple of questions to anyone who knows how pianobar works:

Where does it cache the aac files from pandora on the client computer?

Would running it through a proxy similar to SProxy.exe allow the same functionality as ZZJ's standalone player?

Any help would be appreciated. Not an expert programmer, mostly fiddle around in python. Sorry about the rudimentary questions...

Thanks in advance.

I used the crypto code in specific - that was the "missing link". I eventually ended up translating it into C#.

AFAIK, it doesn't cache files anywhere except ram. It handles all the playback stuff internally (uses faad and mad). If it was run through a proxy it would be the same as any other pandora client and yes the data could be intercepted.

BTW, i wrote sproxy as well, if you have any questions about it or what it does.

Also, if you have a windows PC somewhere, you could run sproxy on that PC and then configure pianobar to use that PC as a proxy - so music is saved as well. If you were really fancy you could share a music folder on the linux computer w/ samba, mount it on windows as a drive share, and have saver2 use that drive to save in. You'd need to modify two settings in SProxy config: AllowNonLocal to true (allow connections from non-localhost) and change servername to be a valid hostname or ip address (used for the web interface stuff).

Link to post
Share on other sites

Thanks a lot for the info! I may try your windows PC proxy suggestion. Any chance the SProxy source could be compiled in mono? before you posted your linux workaround in the saver2 thread I actually *almost* got SProxy working in wine, but with mono for windows installed in wine, not .net 2.0. I could get the SProxy to start and read traffic from firefox installed in wine. Just wondering though - Don't want to be one of those members badgering you about a ready made linux solution...

Thanks again.

Link to post
Share on other sites
Forget my mono question, just read your post in the grooveshark thread...

Any open source proxy programs that do something similar to SProxy but run on linux that you can think of?

Thanks again.

sproxy and saver2 are a possibility under mono. however, the problem lays with the pandora plugin (specificly, the client portion) because it's not pure c#. btw, mono is a runtime, not something that you need to compile against - if you want to try, as i understand it you do something like "mono sproxy.exe". i'm not sure if it would die outright or work fine if you avoided the client portion - worth testing.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...