View Single Post
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#1624
You can query the timed daemon easily with python using its dbus methods.

You can get the methods with:
Code:
qdbus --system com.nokia.time /com/nokia/time
Example (This will get you all the cookies for alarms with the attribute 'APPLICATION':'clock' and will print out the cookie for each alarm/event and all of its attributes):

Code:
#!/usr/bin/python

import dbus

bus = dbus.SystemBus()

time_obj = bus.get_object('com.nokia.time', '/com/nokia/time')
time_intf = dbus.Interface(time_obj, 'com.nokia.time')

cookies = time_intf.get_cookies_by_attributes({'APPLICATION': 'clock'})

for cookie in cookies:
        attributes = time_intf.query_attributes(cookie)
        print cookie
        for key,value in attributes.items():
                print '   '+key,value
To cancel/delete alarm/event:

Code:
time_intf.cancel(cookie)
Setting an alarm directly through dbus to the timed daemon is something I never figured out. That's why I pestered ajalkane to include setting an alarm as a ProfileMatic action. Thanks to the brilliant and simple-to-use dbus service in ProfileMatic we're able to set alarms from the command line using a script like the one you quoted originally.

No other aspect of alarms can be manipulated through ProfileMatic except for setting one with [title, time, snooze_period, sound]. The rest have to be done through the the stock clock application UI, the dbus methods described above or using Qt (which I can't)
 

The Following User Says Thank You to slarti For This Useful Post: