maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Multimedia (https://talk.maemo.org/forumdisplay.php?f=32)
-   -   [application] pyRadio (Pandora) (https://talk.maemo.org/showthread.php?t=56036)

fatalsaint 2010-06-13 03:41

[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:
  • Login to Pandora via username/password popup. Saved so you only need to enter it once.
  • Skip Songs
  • Play/Pause
  • Change Stations
  • "Like" songs
  • "Hate" songs
  • Display Title, Artist, and Album
  • Display album art
  • Create & Delete stations
  • Snooze
  • Mark songs "Tired"
  • Enable FM Transmitter
  • Integrate with current theme colors
  • Pandora One increased audio quality support!
  • Auto-pause when making or receiving phone calls

Known Issues:
  • 6 hours+ play will likely fail.

Installation
  1. Extras-Devel

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

omri 2010-06-13 13:45

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.

Laughing Man 2010-06-13 14:37

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?
/home/user # apt-get remove python2.5-qt4-gui
Reading package lists... Done
Building dependency tree     
Reading state information... Done
The following packages were automatically installed and are no longer required:
  python2.5-qt4-common wireless-tools python2.5-qt4-dbus python2.5-qt4-core
  pulseaudio-utils python2.5-sip4
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  python2.5-qt4-common python2.5-qt4-core python2.5-qt4-dbus python2.5-sip4
The following packages will be REMOVED:
  autocompleteeditor espeakcaller healthcheck python2.5-qt4-gui wifieye
The following NEW packages will be installed:
  python2.5-qt4-dbus
The following packages will be upgraded:
  python2.5-qt4-common python2.5-qt4-core python2.5-sip4
3 upgraded, 1 newly installed, 5 to remove and 73 not upgraded.
Need to get 556kB of archives.
After this operation, 6767kB disk space will be freed.
Do you want to continue [Y/n]? n
Abort.


fatalsaint 2010-06-13 17:56

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by omri (Post 713152)
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.

Yes, I didn't see the update in the email but I was going to come tell you when I've seen this issue is when my N900 was having network problems.

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?

Laughing Man 2010-06-13 18:41

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.

fatalsaint 2010-06-13 18:47

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by Laughing Man (Post 713476)
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.

I was able to do it by going into the dashboard and clicking the little "X" :D.

Yes... I'll implement a 3 count like I had before. Thanks for reminding me.

fatalsaint 2010-06-13 19:44

Re: [application] pyRadio (Pandora)
 
Ok, 1.1 is up hopefully with better error handling and 3 loop limit.

ceevee 2010-06-13 21:57

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.

fatalsaint 2010-06-13 22:01

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by ceevee (Post 713702)
However, audio from pyRadio stops whenever I get a text message. Skipping the current song gets the audio going again.

I didn't think this was 100% of the time... but I have had similar problems as I said in the other thread about gstreamer just stop playing music for some unknown reason.

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.

ceevee 2010-06-13 22:05

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.

fatalsaint 2010-06-13 22:06

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by ceevee (Post 713716)
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.

Yes, I think I will do this. I can't find a way to 'scroll' it like I wanted.

fatalsaint 2010-06-14 22:23

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...

fatalsaint 2010-06-15 05:58

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.

Flandry 2010-06-15 06:18

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. :)

fatalsaint 2010-06-15 06:29

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.

Flandry 2010-06-15 06:44

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by fatalsaint (Post 715679)
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.

I get 10 PA and 10 media player vs. about 15 PA and 22 pianobar. 20% seems really high for PA. :confused:

Quote:

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.
Interesting. In walking around my building, i actually thought there was a buffer in pianobar because the music seemed to stop awhile after going out of wifi range and take awhile to start after returning. Interesting to know it's just my perception. :D

Does the fact pyRadio uses gstreamer mean that it will playback properly through headphones in silent profile?

qwerty12 2010-06-15 06:57

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by Flandry (Post 715689)
Does the fact pyRadio uses gstreamer mean that it will playback properly through headphones in silent profile?

Not exactly: https://bugs.maemo.org/show_bug.cgi?id=6694

Flandry 2010-06-15 07:27

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by qwerty12 (Post 715699)

That bug tracker "dialogue" depresses me. :(

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...

fatalsaint 2010-06-15 13:04

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by Flandry (Post 715689)
I get 10 PA and 10 media player vs. about 15 PA and 22 pianobar. 20% seems really high for PA. :confused:

There's a few threads around about high pulseaudio usage. It happens with anything that plays any sound.. watch your top when you receive an SMS you'll see it spike too.

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:

Interesting. In walking around my building, i actually thought there was a buffer in pianobar because the music seemed to stop awhile after going out of wifi range and take awhile to start after returning. Interesting to know it's just my perception. :D

Does the fact pyRadio uses gstreamer mean that it will playback properly through headphones in silent profile?
Nope, no buffer for pianobar. If you're in weak 3G areas it becomes apparent because it'll play half a second and stop, then again and stop, constantly. pianobar will play music the instant it gets a stream and that gets old quick.

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:

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...
I will try. Let you know how it goes.

fatalsaint 2010-06-15 15:10

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")
proplist = gobject.list_properties(pulsesink)
for property in proplist:
    print property.name + " " + str(pulsesink.get_property(property.name)

Clearly shows that pulsesink has a proplist "property" ... but is evidently by default set to a NoneType.

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 ();
pa_proplist_sets (proplist, PA_PROP_EVENT_ID, "ringtone-preview");

In python.. I would appreciate it.

qwerty12 2010-06-15 15:15

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by fatalsaint (Post 716235)
Basically, if anyone can tell me how to do this:
Code:

pa_proplist *proplist = pa_proplist_new ();
pa_proplist_sets (proplist, PA_PROP_EVENT_ID, "ringtone-preview");

In python.. I would appreciate it.

Heh, it's me that wrote #33...

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.

fatalsaint 2010-06-15 15:29

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.

fatalsaint 2010-06-15 15:32

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by qwerty12 (Post 716238)
Heh, it's me that wrote #33...

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.

Yeah I tried merging that into my app... wasn't working right. I didn't want to have to download and include two additional modules (PulseGlib and lib_pulseaudio) just for this one workaround.

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
pa_context_new_with_proplist.restype = POINTER(PA_CONTEXT)
pa_context_new_with_proplist.argtypes = [
        POINTER(PA_MAINLOOP_API),
        c_char_p,
        POINTER(PA_PROPLIST)
]

#
# pa_proplist_*
pa_proplist_new = pulse_lib.pa_proplist_new
pa_proplist_new.restype = POINTER(PA_PROPLIST)
pa_proplist_new.argtypes = [ ]

pa_proplist_sets = pulse_lib.pa_proplist_sets
pa_proplist_sets.restype = c_int
pa_proplist_sets.argtypes = [
        POINTER(PA_PROPLIST),
        c_char_p,
        c_char_p
]


fatalsaint 2010-06-15 15:35

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:

qwerty12 2010-06-15 15:36

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by fatalsaint (Post 716254)
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.

I don't really like that workaround because the policy system will group your app into the radio category, which has less privileges than one in the "player" category. If you want to edit xpolicy.conf, check out my headset-control package which'll add the information to whitelist headset-control (I do some libplayback stuff in it) and adds a trigger so that if xpolicy.conf is replaced by another package, headset-control's postinst will add it back in. (I happened to test that when dist-upgrading from leaked PR 1.2 to "proper" PR 1.2.)

fatalsaint 2010-06-15 15:53

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by qwerty12 (Post 716266)
I don't really like that workaround because the policy system will group your app into the radio category, which has less privileges than one in the "player" category. If you want to edit xpolicy.conf, check out my headset-control package which'll add the information to whitelist headset-control (I do some libplayback stuff in it) and adds a trigger so that if xpolicy.conf is replaced by another package, headset-control's postinst will add it back in. (I happened to test that when dist-upgrading from leaked PR 1.2 to "proper" PR 1.2.)

Yeah but working through the CDLL lib's requires creating several class structures, building several variables, to create the proplist, editing the proplist and then setting it in the pulsesink gst audio-sink.

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.

qwerty12 2010-06-15 15:59

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by fatalsaint (Post 716287)
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.

Yes, it will. The built in Media Player uses this category to play its stuff. I have yet to notice it stuttering when the display goes off.

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...

les_garten 2010-06-15 16:03

Re: [application] pyRadio (Pandora)
 
Thanx! This app is killer. The buffering fixed Pianobar for me!

fatalsaint 2010-06-15 16:23

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by qwerty12 (Post 716294)
Yes, it will. The built in Media Player uses this category to play its stuff. I have yet to notice it stuttering when the display goes off.

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...

Did you manage to see This??

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()
    self.set_proplist({
        "window.name":          self.client_name,
        "media.name":          self.client_name,
        "application.name":    self.client_name
    })

    #self.pa_context_p = pa_context_new_with_proplist(
    #                            self.pa_mainloop_api_p,
    #                            self.client_name)
    self.pa_context_p = pa_context_new_with_proplist(
                                self.pa_mainloop_api_p,
                                self.client_name,
                                self.pa_proplist_p)

The self.pa_context_p would be a proper type to what the set_properties needs? Is this not the case?

fatalsaint 2010-06-15 16:23

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by les_garten (Post 716298)
Thanx! This app is killer. The buffering fixed Pianobar for me!

Well.. not really.. it replaced pianobar for you :). Pianobar is no longer used.

les_garten 2010-06-15 16:37

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by fatalsaint (Post 716321)
Well.. not really.. it replaced pianobar for you :). Pianobar is no longer used.

Thanx! ... crawls off into corner...

;)

qwerty12 2010-06-15 16:40

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by fatalsaint (Post 716319)
Did you manage to see This??

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()
    self.set_proplist({
        "window.name":          self.client_name,
        "media.name":          self.client_name,
        "application.name":    self.client_name
    })

    #self.pa_context_p = pa_context_new_with_proplist(
    #                            self.pa_mainloop_api_p,
    #                            self.client_name)
    self.pa_context_p = pa_context_new_with_proplist(
                                self.pa_mainloop_api_p,
                                self.client_name,
                                self.pa_proplist_p)

The self.pa_context_p would be a proper type to what the set_properties needs? Is this not the case?

Figured it out...

Grab http://gnome-pulse-applet.googlecode...inloop_glib.py

In your program:

Code:

import ctypes
import libpulse_mainloop_glib

gobject_lib = CDLL("libgobject-2.0.so.0")

self.pulsesink = gst.element_factory_make("pulsesink", "someshit")
self.player = gst.element_factory_make("playbin2", "player")

proplist = libpulse_mainloop_glib.pa_proplist_new()
libpulse_mainloop_glib.pa_proplist_sets (proplist, "event.id", "ringtone-preview")
gobject_lib.g_object_set(ctypes.c_void_p(ctypes.hash(self.pulsesink)), "proplist", proplist, None)
self.player.set_property("audio-sink", self.pulsesink)


fatalsaint 2010-06-15 17:15

Re: [application] pyRadio (Pandora)
 
Im getting an AttributeError "module" object has no attribute "hash"

qwerty12 2010-06-15 17:17

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by fatalsaint (Post 716360)
Im getting an AttributeError "module" object has no attribute "hash"

Sorry, that was a quick rip - look at my attachment here: https://bugs.maemo.org/show_bug.cgi?id=6694#c35

Oh, I forgot to use the pa_proplist_free function that I defined :rolleyes:

Please do so after calling g_object_set

Flandry 2010-06-15 17:21

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by fatalsaint (Post 716287)
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.

I think the discussion early in that bug report gives the most reasonable interpretation of "Silent" profile: it suppresses communications event notifications i.e. makes the phone into a PDA for a while. This is the most useful interpretation to me, and i suspect many others. If i want an app i'm running to be quiet, i'll turn down the volume down, but if i want to get sound and not be interrupted at any point by an SMS or ringer, the silent profile is what i'd use.

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. :)

fatalsaint 2010-06-15 17:23

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by qwerty12 (Post 716363)
Sorry, that was a quick rip - look at my attachment here: https://bugs.maemo.org/show_bug.cgi?id=6694#c35

Oh, I forgot to use the pa_proplist_free function that I defined :rolleyes:

Please do so after calling g_object_set

Ok, just didn't need the "ctypes.hash" in your snippet.. just hash().

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:

fatalsaint 2010-06-15 22:37

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
qwerty, you are awesome. lol.

ETA: Just letting you know, I'm keeping that in my code!

fatalsaint 2010-06-15 23:25

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by qwerty12 (Post 716363)
Oh, I forgot to use the pa_proplist_free function that I defined :rolleyes:

Please do so after calling g_object_set

I have a problem.... if I add the pa_proplist_free(proplist).. I get a segfault.

Is this why you struck it out? Works fine if I don't add that.

qwerty12 2010-06-15 23:44

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by fatalsaint (Post 716805)
I have a problem.... if I add the pa_proplist_free(proplist).. I get a segfault.

Is this why you struck it out? Works fine if I don't add that.

Yeah, I was working from memory and thought it was making a copy, but I looked again and... it doesn't. It'll get freed anyway when pulsesink's ref count gets dropped to 0 as pa_proplist_free is invoked in the finalize function.

fatalsaint 2010-06-15 23:56

Re: [application] pyRadio (Pandora)
 
Quote:

Originally Posted by Flandry (Post 716367)
Thanks for addressing this. :)

OK, Merry Christmas Flandry. PR1.3 in the repo's :D (I suddenly like my apps initials..)


All times are GMT. The time now is 13:52.

vBulletin® Version 3.8.8