Notices


Reply
Thread Tools
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#91
Originally Posted by slarti View Post
My poor skills with scripts haven't yielded results yet but maybe someone with more skills might make this happen more quickly...
Thanks. I found that on my particular installation, I have many enabled alarms in "TRANQUIL" state (they don't show up in the UI), and active alarms that I set are in the state "QUEUED", so I query for that specifically (one might also have to query for a specific APPLICATION attribute to filter out calendar reminders, but for me this works at the moment):

Code:
#!/usr/bin/python
# List upcoming alarms on MeeGo 1.2 Harmattan
# Thanks to slarti on TMO for figuring out the D-Bus methods
# Thomas Perl <thp.io/about>; 2012-06-13

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({'enabled': '1'})

def get_queued_alarms():
    for cookie in cookies:
        attributes = time_intf.query_attributes(cookie)
        if attributes['STATE'] == 'QUEUED':
            yield ' '.join((attributes['alarmtime'],
                            attributes['TITLE']))

print '\n'.join(sorted(get_queued_alarms())) or 'No alarms'
You need to install (using apt-get install as root) the following packages: python python-dbus

Last edited by thp; 2012-12-21 at 09:35.
 

The Following User Says Thank You to thp For This Useful Post:
Posts: 55 | Thanked: 28 times | Joined on Jan 2010
#92
Originally Posted by thp View Post
Which version of Billboard are you using? How many lines of text do you want to display? There's a hard limit of possible lines in order to avoid screen burn in.
I'm using 1.0.1 version. My script outputs only one line of text.

Originally Posted by thp View Post
Yes, the script is invoked with a 1000ms time limit in order to avoid "hangs" by badly coded scripts. Output is captured from stdout.
Isn't 1 sec is too small window ?. wget commands mostly takes more than 1 sec(depending on network latencies). Can you increase this interval to 3000ms or configurable(configurable but not changeable beyond certain value)


Originally Posted by thp View Post
Caching the data is actually a good idea, and you should do that in general (e.g. also in cases where there is no internet connection). Also saves battery power.
Agreed!. I also updated my script to check only if internet is connected.

Last edited by achilles333; 2012-06-13 at 17:16.
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#93
Originally Posted by thp View Post
Thanks. I found that on my particular installation, I have many enabled alarms in "TRANQUIL" state (they don't show up in the UI), and active alarms that I set are in the state "QUEUED", so I query for that specifically (one might also have to query for a specific APPLICATION attribute to filter out calendar reminders, but for me this works at the moment):

Code:
#!/usr/bin/python
# List upcoming alarms on MeeGo 1.2 Harmattan
# Thanks to slarti on TMO for figuring out the D-Bus methods
# Thomas Perl <thp.io/about>; 2012-06-13

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({'enabled': '1'})

def get_queued_alarms():
    for cookie in cookies:
        attributes = time_intf.query_attributes(cookie)
        if attributes['STATE'] == 'QUEUED':
            yield ' '.join((attributes['alarmtime'],
                            attributes['TITLE']))

print '\n'.join(sorted(get_queued_alarms())) or 'No alarms'
That's it?! I really have to start learning python...

I have a problem though: when I try to run this script in terminal with:

Code:
python ./enabledalarms.py
I get:

Code:
Traceback (most recent call last):
 File "./enabledalarms.py", line 6, in <module>
  import dbus
ImportError: No module named dbus
Nothing is shown in billboard with

Code:
{script:/home/user/enabledalarms.py}
either...

What am I doing wrong?

EDIT: Ahh... stupid me. I did apt-get install python-dbus and the script works. Still doesn't show up in the standby-screen, though, hmm...

EDIT2: The script doesn't take into account reoccurring alarms. Try setting an alarm named "later" for friday and saturday at 6:30 and one named "earlier" on thursday at 9:00. The script returns on wednesday:

Code:
06:30 later
09:00 earlier
which is wrong.

The recurrence string in the returned attributes has the selected weekdays like this:

Code:
1=mon,2=tue,3=wed,4=thu,5=fri,6=sat and 0=sun
Still can't get the output to show up on standby screen...

Last edited by slarti; 2012-06-13 at 18:55.
 
Posts: 648 | Thanked: 650 times | Joined on Oct 2011
#94
Try {script: python /home/user/enabledalarms.py}
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#95
Originally Posted by SamGan View Post
Try {script: python /home/user/enabledalarms.py}
Thanks, but I tried that, too. No luck.

For some reason {script: python helloworld.py} works. It only has the line
Code:
print "hello world"

Last edited by slarti; 2012-06-14 at 13:19.
 
Posts: 55 | Thanked: 28 times | Joined on Jan 2010
#96
Originally Posted by slarti View Post
Thanks, but I tried that, too. No luck.

For some reason {script: python helloworld.py} works. It only has the line
Code:
print "hello world"
What error you see when you run from command line(aka terminal)??
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#97
Originally Posted by achilles333 View Post
What error you see when you run from command line(aka terminal)??
That's just it. enabledalarms.py works perfectly from the command line. Only in Billboard it doesn't.

Can you get the script posted by thp to work in Billboard?
 
Posts: 55 | Thanked: 28 times | Joined on Jan 2010
#98
Originally Posted by slarti View Post
That's just it. enabledalarms.py works perfectly from the command line. Only in Billboard it doesn't.

Can you get the script posted by thp to work in Billboard?
You can send me your script to me. I will check on mine.

My guess is if it is working from command line then the issue is the billboard app isn't capturing the output. Billboard app is capturing output only if the script completes within 1000ms and looks like your script is taking more than 1 sec(1000ms).
 
Posts: 55 | Thanked: 28 times | Joined on Jan 2010
#99
I ran the script (without modifications). It worked for me.

So, if it's not showing on your screen then it is the limitation of billboard app to capture the ouput
 

The Following User Says Thank You to achilles333 For This Useful Post:
Posts: 90 | Thanked: 35 times | Joined on Jan 2012
#100
Just a quick note on the battery drain side of things.

I did some simple tests overnight (power saving mode so no wifi complications). Disabling the bluetooth python script only saved 1mA in idle and disabling Billboard entirely only 2mA in idle (6mA total BTW and the Meecast widget comes back as standalone). The numbers are so small as to be negligible in the grand scheme.

Seems to be a non-issue compared to my habit of listening to audio/podcasts which is a definite drain on the N9
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:26.