![]() |
[application] pyRadio (Pandora)
pyRadio
pyRadio is a python2.5-qt4 (PyQt4) implementation of Pandora Radio. Audio runs through MAFW for N900 or OSSO for Diablo (N810/N800). Looks like pyPianobar?? Yes it does! This is an evolution from pyPianobar which is a front end for the command line application pianobar. spbogie developed an all-python implementation of communicating with Pandora Radio directly. I have borrowed that code, and extended it to include additional features. I then took pyPianobar and merged it making an all-python, native application that is no longer a front-end for anything. This is no longer a "hack" for Pandora, but a true all-encompassing application. Features:
Known Issues:
Installation Why Python?? Simplicity. Using the same package, we should be able to run this on our Maemo 5, and future Harmattan/MeeGo and full MeeGo devices. Pandora Don't forget to update to Pandora One. Higher quality audio works now in pyRadio! Special thanks goes to Thorprime and YoDude for the interface. Also, thanks to everyone that has supported and helped pyPianobar grow! This was the obvious evolution of that as it was always a hack and we can now extend it further than we could before. http://packages.linuxniche.net/pyradio.png http://packages.linuxniche.net/pyradio_menu.png http://packages.linuxniche.net/pyradio_tired.png http://packages.linuxniche.net/pyradio_donate.png |
Re: [application] pyRadio (Pandora)
well, it worked great once, then on restarting it got stuck on authenticating. This happened several times.
i tried again about half an hour later and it worked with no problems. Update: I seem to be having strange wifi issues at my home today, so this might be the cause of the issue. Right now all is well. I will report if the problem returns. |
Re: [application] pyRadio (Pandora)
Hmm seems to conflict with python2.5-qt4-gui, but I can't remove it since other apps use it as a dependency.
Code:
ess using it? |
Re: [application] pyRadio (Pandora)
Quote:
I need to implement better error checking so that it can inform you of when it actually fails so you aren't staring at "Trying to authenticate" forever. @LaughingMan: Looks to me like you've got some strange mix of PyQt4 versions. PyRadio itself depends on python2.5-qt4-gui (and I don't specify a version) so I'm not entirely sure why it would be trying to remove it. Can you show me the output of trying to install pyradio instead of trying to remove python2.5-qt4-gui? |
Re: [application] pyRadio (Pandora)
Oddly, it installed if I did an apt-get install pyradio. o.O
Oh I found one annoyance you might want to fix. If a user doesn't remember his Pandora username and password (*cough* me) there's no way to exit the login prompt (it just loops forever) asking for Pandora username and Pandora password. Can't even use power menu > kill task. |
Re: [application] pyRadio (Pandora)
Quote:
Yes... I'll implement a 3 count like I had before. Thanks for reminding me. |
Re: [application] pyRadio (Pandora)
Ok, 1.1 is up hopefully with better error handling and 3 loop limit.
|
Re: [application] pyRadio (Pandora)
Driving around with pyRadio is a lot better than pyPianobar! No more dropouts and skipping when going through weak 3G areas.
However, audio from pyRadio stops whenever I get a text message. Skipping the current song gets the audio going again. I have Message 1 for the SMS alert ring tone. |
Re: [application] pyRadio (Pandora)
Quote:
I still have not figured out the cause or how to identify this. Everything works fine, and as you realized skipping to the next song, music plays perfectly: so I'm not sure what the problem is with gstreamer picking up the buffer and going. I'm sure this has something to do with the way the N900 system works with the underlying audio system and gstreamer (I know it does something, because I don't pause the music when you receive a phone call and start it again after it's over. N900 does that all on it's own for audio going through gstreamer.) Maybe SMS/Email flush the gstreamer audio feed or something. ETA: Just tested it and received a text and pyRadio continued playing fine. Not sure what the cause of the "sometimes" is. |
Re: [application] pyRadio (Pandora)
Is there a way you could put the artist and song title under the album art as well?
Sometimes the length of the title and artist is too long to see completely on the top bar. |
Re: [application] pyRadio (Pandora)
Quote:
|
Re: [application] pyRadio (Pandora)
So, other than the song title and artist moving (which is done in my current build)...
Any other comments? I'm still looking at the gstreamer thing but haven't had it happen to me for a few days now.. how often is the random stopping of music for people? Dont really want to release a 1.2 with nothing but a change to the Label... |
Re: [application] pyRadio (Pandora)
haha... rather big bug. Do me a favor and don't enable your FM Transmitter before launching the app. Nothing will work :D.
This bug is a glaring example of my one largest gripe about Python syntax. No end tags, everything is based on proper tabbing >.>. One stupid extra tab and poof... broken interface lol. Ill have a new fix up tonight with the Label change and this bug addressed. I rebooted my phone couple of times today trying to figure out why the hell it wasn't working :D. |
Re: [application] pyRadio (Pandora)
I haven't installed this yet but have been enjoying pianobar for a couple weeks now after tiring of my own music collection. One thing i was wondering about on reading about a "pure python implementation" is, how does using python for everything affect the CPU usage and run time of pandora on N900?
Also, someone mentioned that this fixes dropouts in playback when going through poor reception areas. Is there a reason for this to be expected with pyRadio vs. pianobar? I still haven't installed pyqt but will probably do so soon and this will be one of the apps i take a look at. Thanks for your work on pandora options. :) |
Re: [application] pyRadio (Pandora)
Not really sure how big of a difference it is but watching top while listening shows 34% cpu usage, with pyradio at betwen 15-20% and pulseaudio itself at 20%+. Now those numbers dont match because watching /proc/cpuinfo shows the processor bouncing between 250 and 500. I notice no system slowdowns.
The reason for better play is pianobar uses libao/libmad with no buffer to playback audio. pyRadio uses gstreamer which utilizes a buffer allowing for brief interruptions in connection. |
Re: [application] pyRadio (Pandora)
Quote:
Quote:
Does the fact pyRadio uses gstreamer mean that it will playback properly through headphones in silent profile? |
Re: [application] pyRadio (Pandora)
Quote:
|
Re: [application] pyRadio (Pandora)
Quote:
Thanks, qwerty. fatalsaint, can you please use this workaround or the one in comments 29/30? It's really obnoxious for my coworkers when i'm listening to pandora and get an SMS or incoming call and it blasts the notification from the speaker... |
Re: [application] pyRadio (Pandora)
Quote:
The question I have: Is it 20% of 250, or 500, 650... the damn CPU is near constantly ticking up, down, up down, on my phone so I have no idea. If it's 20% of 250 that's not that bad.. if it's 20% of the full processor speed that's a bit of a nuisance. If I watch it pyradio goes from between 10 up to 20 max, while PA is all over the place. Don't think I saw it go much below 15 though.. so how the media player only has it at 10 I don't know. Quote:
Gstreamer, OTOH, if it loses network connection too long for some reason simply refuses to start up again :mad:. You'll just get silence until the end of the song and then it starts the next song and plays just fine (alternatively, skipping to the next song also brings it back.) Silent: Just tested, No. (thanks Qwerty). Quote:
|
Re: [application] pyRadio (Pandora)
I am having no luck figuring out how in the hell to create a pulseaudio proplist in python.
Code:
pulsesink = gst.get_element_factory_make("pulsesink", "pulsesink") It is supposed to be a type of GParamPointer if I dump just the list_properties out to a terminal. But I can find no help on actually creating a proplist from scratch, and then modifying this "event.id" property of that. I'm at a loss. Basically, if anyone can tell me how to do this: Code:
pa_proplist *proplist = pa_proplist_new (); |
Re: [application] pyRadio (Pandora)
Quote:
PulseAudio doesn't seem to have Python bindings but http://gnome-pulse-applet.googlecode...inloop_glib.py seems to wrap it. I'll try it out. |
Re: [application] pyRadio (Pandora)
This workaround works.
Setting the application name to FMRadio. I really don't like how ugly this is to work around this problem. Is there a "proper" way to do this? I still would like any information on setting the pulseaudio proplist like above.. it seems a better solution than "mimicking" another application that has a proper police. Is the "proper" way to modify the xpolicy file and create my own block for my own app? Meh. Ugly. But, my phone is currently playing Pandora while in Silent Mode. I'm not home, or I'd build a package and submit it.. I'll have something up tonight though. |
Re: [application] pyRadio (Pandora)
Quote:
If I could figure out just exactly the necessary CDLL calls to create and edit the proplist..specifically, working with these areas: Code:
pa_context_new_with_proplist = pulse_lib.pa_context_new_with_proplist |
Re: [application] pyRadio (Pandora)
Of course.. then the question becomes:
Is pretending my app is a ringtone-preview any better than just pretending my app is FMRadio? :rolleyes: |
Re: [application] pyRadio (Pandora)
Quote:
|
Re: [application] pyRadio (Pandora)
Quote:
It's a mess. The alternative is I download 2 additional .py's, distribute them with my package, and import them in my radio app. This is an awful low of work just to get around a stupid "Silent" profile policy. I mean.. I do have to agree that I find it a bit silly that people expect sound to play when the phone is on "Silent"... to me "Silent" means just that.. Silence. I find it odd that even the built-in player gets around the Silent profile. But I've seen this crop up in several threads .. and has been mentioned to me often so figured WTH.. since you and Flandry found me work arounds I'll go ahead and implement them. Especially since, this appears to be the only way we can avoid having the problem of pyRadio being unlistenable if you're constantly texting someone because the system sounds override gstreamer (instead of just playing over background audio it actually takes control, stops your playing, and plays the system sound. Ridiculous again. If Linux was still stuck in the days of only playing one-sound at a time we'd have gotten no where..) Now we can just set the phone to the Not-Really-But-Badly-Named-And-Incorrect "Silent" profile. Oh well.. I guess I'm just venting some frustration here. Specifically tho: Being in the radio category, what privileges exactly am I missing? Cause I'll be honest.. adding 1 line and no additional includes to work around the simple Silent problem is a lot more appealing to me than bringing along two full modules that envelope the entire pulseaudio wrappings; and/or writing my own small piece of code to work just with proplists. The work or bulk outweigh the benefits I'm thinking. However, will being in the 'player' category prevent the audio hiccup when the screen dims to black as well? Because currently as a 'radio' app, I still suffer from that problem. |
Re: [application] pyRadio (Pandora)
Quote:
If you don't want to go the ctypes route, then editing xpolicy.conf is the way to go. I can't figure out how to pass the proplist in pulsesink's set_property function as it wants a GParamSpecPointer. How the **** am I meant to provide that? That bit of C I posted works fine because it expects a pointer and recieves one. Man, no wonder people prefer PyQt to PyGTK... |
Re: [application] pyRadio (Pandora)
Thanx! This app is killer. The buffering fixed Pianobar for me!
|
Re: [application] pyRadio (Pandora)
Quote:
I was using that in-tandem with the lib_pulseaudio source to work with it. I would expect (though haven't tried it) that if properly imported: Code:
self.pa_proplist_p = pa_proplist_new() |
Re: [application] pyRadio (Pandora)
Quote:
|
Re: [application] pyRadio (Pandora)
Quote:
;) |
Re: [application] pyRadio (Pandora)
Quote:
Grab http://gnome-pulse-applet.googlecode...inloop_glib.py In your program: Code:
import ctypes |
Re: [application] pyRadio (Pandora)
Im getting an AttributeError "module" object has no attribute "hash"
|
Re: [application] pyRadio (Pandora)
Quote:
Please do so after calling g_object_set |
Re: [application] pyRadio (Pandora)
Quote:
I personally don't care what approach you take; a one-line fix that has a few disadvantages (but no side effects) to a 5+ hour approach is fine by me. Thanks for addressing this. :) |
Re: [application] pyRadio (Pandora)
Quote:
Sometimes... I still have the problem of audio blips when locking the screen with the lock slider on the right though :mad: (far less though..) Thanks for the help qwerty! I'll add your attachment code to my radio player.. currently I had built my own pulse.py with just the functions we needed like you did and was importing that. Soo ugly though... why can't they make this easier. :mad: |
Re: [application] pyRadio (Pandora)
Ok, I got home and fired this up to actually code it properly into my app (instead of the hack job I did on my N900 at work).. and this had me busting out laughing:
Code:
#**** to appease Maemo's stupid-*** Policy system added by Faheem Pervez ETA: Just letting you know, I'm keeping that in my code! |
Re: [application] pyRadio (Pandora)
Quote:
Is this why you struck it out? Works fine if I don't add that. |
Re: [application] pyRadio (Pandora)
Quote:
|
Re: [application] pyRadio (Pandora)
Quote:
|
All times are GMT. The time now is 21:21. |
vBulletin® Version 3.8.8