Well, the platform had this to say to me: "Ha ha ha ha ha"
It seems simple enough, if you implement the Impres2 interface, you get Sound Menu integration, along with other benefits. Well, it turns out that implementing such an interface in Python is an exercise in frustration.
- There is little documentation on how to implement a dbus interface in Python.
- So far as I can tell, there is no way to decorate a property to make it a dbus property, and there is not documentation on how to work around this.
- After working around how to make properties, one is exposed to all kinds of weird dbus internals. For example, you can't just return a dictionary, you have to send a dbus.Dictionary object.
So what's next? Well, I intend to turn this code into a Python API for the Sound Menu. I'm not going to try to handle the whole mpris2 integration at this point, just implement what is needed for the sound menu to work. The API should not expose any DBUS or MPRIS concepts.
Then I'll see if I can use my API to add Sound Menu integration to Pithos. Also, I should be able to use simple-player as a demo for it.
So, if you are a Python hacker, and you want to get something into the Sound Menu, stay tuned, I should be able to help you out soonish. The code is still all stub code, but if you absolutely must look, I pushed a branch.
Actually, you can return python dicts, no need to wrap them into dbus.Dictionary. All you have to do is to use the 'out_signature' argument of the dbus.service.method decorator, like
ReplyDelete@dbus.service.method("some.iface", out_signature="a{ss}")
def return_dict(self): return {"Hallo": "world"}
@thekorn -
ReplyDeletemrpis2 requies the use of dbus properties in addition to functions. For example, Metadata is a dbus property, not a dbus method, so it gets returned from the get function which implements dbus.PROPERTIES_IFACE.
If there is a way to decorate properties in Python so they become dbus properties, please let me know, but I sure couldn't find it, and neither could several folks trying to help me.
Check out how I'm doing it in lp:ubuntuone-music ;)
ReplyDeleteSo nice and great blog post about rain it's also helpful information all of us so thanks a lot for sharing this tips with us
ReplyDeleteclipping path service
Very interesting info. I really appreciate this post.
ReplyDeleteclipping path/Raster To vector/clipping path service
So interesting post. Thanks for share.
ReplyDeleteclipping path service | clipping path
Your explanation about Dbus to turn inti API for a sound system is in detail. Thanks for the informative blog.
ReplyDelete