dbus

How do I get the currently playing song in Rhythmbox using Python

孤者浪人 提交于 2019-12-04 09:57:25
Im using Ubuntu 12.04. I want to access Rhythymbox using Python . This is how I've proceeded so far: Ive gone through this site https://live.gnome.org/RhythmboxPlugins/WritingGuide , but it gives details on how to write plugins , which Im not interested in right now. Ive gone through a few tutorials which tells me to do this. import dbus session_bus = dbus.SessionBus() proxy_obj = session_bus.get_object( 'org.gnome.Rhythmbox', '/org/gnome/Rhythmbox/Player') But I am getting the following error DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.Rhythmbox was not

MPRIS + Python (dbus): reading and writing properties

筅森魡賤 提交于 2019-12-04 08:26:43
问题 I have already checked this link: How to handle properties of a dbus interface with python. However, that only lists an API... but I don't know where that API comes from. I just started working with dbus (pretty excited about this, to be honest ^__^ just not too happy with the documentation I've found) on python and I was wondering if I could just get some sample code. I'm using MPRIS specifically for Rhythmbox, although it 'should' be the same for all. I know I can access and have fun witht

Sending a byte array (type `ay`) over D-Bus using GDBus

落花浮王杯 提交于 2019-12-04 08:08:59
I am trying to a byte array over D-Bus using the GDBus bindings. Can you please let me know how I can achive that. I tried googling but didnt help. Byte array contains a image file so cannot be converted to charbytearray Any help is appriciated JB0x2D1 This question has some good ideas in the answers including for passing large amounts of data by writing the data to a file and passing the filename , or using a named pipe . Writing to a file and passing the file name might be the easiest to implement. cyrax I did some tests using an XML where I used the type ay . This works well with the QT

Python Dbus : How to export Interface property

人盡茶涼 提交于 2019-12-04 08:00:33
In all python dbus documentations there are info on how to export objects, interfaces, signals, but there is nothing how to export interface property. Any ideas how to do that ? It's definitely possible to implement D-Bus properties in Python! D-Bus properties are just methods on a particular interface, namely org.freedesktop.DBus.Properties . The interface is defined in the D-Bus specification ; you can implement it on your class just like you implement any other D-Bus interface: # Untested, just off the top of my head import dbus MY_INTERFACE = 'com.example.Foo' class Foo(dbus.service.object

dbus signal handler for e NetworkManager VPN connection

走远了吗. 提交于 2019-12-04 07:40:18
I need to develop some python code to be executed when a VPN connection is established, the VPN is controlled from NetworkManager, I am trying to figure how to use an NM DBUS event for this. Using "dbus-monitor --system" I was able to identify the connect signal: signal sender=:1.1 -> dest=(null destination) serial=464 path=/org/freedesktop/NetworkManager/ActiveConnection/3; interface=org.freedesktop.NetworkManager.VPN.Connection; member=PropertiesChanged array [ dict entry( string "VpnState" variant uint32 5 ) dict entry( string "State" variant uint32 2 ) ] Now I need to identify the

Temporarily prevent linux from shutting down

时光总嘲笑我的痴心妄想 提交于 2019-12-04 00:13:01
问题 I have a backup script that runs in the background daily on my linux (Fedora 9) computer. If the computer is shut down while the backup is in progress the backup may be damaged so I would like to write a small script that temporarily disables the ability of the user to reboot or shut the computer down. It is not necessary that the script is uncirumventable, it's just to let the users of the system know that the backup is in progress and they shouldn't shut down. I've seen the Inhibit method

Use dbus to just send a message in Python

Deadly 提交于 2019-12-03 17:11:24
I have 2 Python programs. I just want to send a message (a long string) from the one to the other, and I want use dbus. Now, is there an easy way to do this? For example, if the message is very small, I have partially solved the problem putting the message in the path. But then I had to use the external program dbus-send: Server (python): import dbus,gtk from dbus.mainloop.glib import DBusGMainLoop DBusGMainLoop(set_as_default=True) bus = dbus.SessionBus() def msg_handler(*args,**keywords): try: msg=str(keywords['path'][8:]) #...do smthg with msg print msg except: pass bus.add_signal_receiver

Register a “Hello World” DBus service, object and method using Python

北城余情 提交于 2019-12-03 16:31:11
I'm trying to export a DBus service named com.example.HelloWorld , with an object /com/example/HelloWorld , and method com.example.HelloWorld.SayHello that prints "hello, world" if the method is called using dbus-send --system --type=method_call --dest=com.example.HelloWorld /com/example/HelloWorld com.example.HelloWorld.SayHello So my question is how do you make a simple DBus service with a single method that prints "hello, world" (on its own stdout). JoGr When using dbus-python the following setup for exporting a D-Bus service works: import gobject import dbus import dbus.service from dbus

How to compile a basic D-Bus/glib example?

落花浮王杯 提交于 2019-12-03 11:33:14
问题 I'm trying to learn how to use D-Bus with C bindings. I've never used D-Bus before. I'm following this tutorial, which I assume is the official one (Freedesktop.org). I've read it until this paragraph that gives a first sample program , but unfortunately I don't see any indication on this page about how to compile it or which libraries to include. Did I miss something ? My OS is Ubuntu 10.04 32bit. I installed the libdbus-glib-1-dev package. I tried to add #include <dbus/dbus.h> at the

BlueZ 5.30: D-Bus GATT API - Simply Discover and Connect to a BLE device in C

风流意气都作罢 提交于 2019-12-03 10:08:42
问题 With the last release of BlueZ (5.30) the highlight was the completion of the GATT D-Bus apis. My goal is to programmatically (in C), as a BLE client: scan for ble devices (which I can do with the hci layer) Connect to an advertising BLE device Get the UUIDs Execute Read and Write to handles The BlueZ community is strongly suggesting to use the GATT-Dbus api to accomplish this. After multiple searches and head scratching I was not successful to find a proper way or example that would perform