Active Topics

 



Notices


Reply
Thread Tools
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#921
Originally Posted by Quaddy View Post
@Win7Mac - are you able to answer seeing as you were such a big fan of the script can your event getter by slarti show more than one line on bb, or just one? thnx
Saw your initial post and I have no clue, sorry.
After mine stopped working for 2 weeks or so, all is back to normal. No idea what happened, I did nothing to the system or BB in that time. I use max. 3 events/lines for next 3 days.

AFAIK, there is no line limitation within billboard for external scripts.
My advice would be to double check the script again (or better delete and copy/paste the original again) or ask slarti.
Good luck!
__________________
Nokia 5110 > 3310 > 6230 > N70 > N9 BLACK 64GB
Hildon Foundation Board member
Maemo Community e.V. co-creator, founder and director since Q4/2016
Current Maemo Community Council member
 
Posts: 73 | Thanked: 35 times | Joined on Jun 2013
#922
on the "next_alarm_only.py" in the billboard scripts, does anyone know how to have it literally print "tomorrow" or "today" if the alarm is tomorrow or today, rather than the name of the day?


@Win7Mac - thanks, got it working
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#923
Originally Posted by Quaddy View Post
on the "next_alarm_only.py" in the billboard scripts, does anyone know how to have it literally print "tomorrow" or "today" if the alarm is tomorrow or today, rather than the name of the day?


@Win7Mac - thanks, got it working
Sorry for the late answer. My N9 broke and I haven't been around here much.

Like I said, next_alarm_only.py kind of sucks. Don't use it. I can say that because I wrote it.

Here I've modified the much better customizable_alarm_lister.py to print 'Today' if the alarm is today, 'Tomorrow' if it's tomorrow and the day of the week if it's something else. The variable weekday needs to be included in the last line for it to work.

I have absolutely no idea why it didn't work for you before, but I'm glad you got it sorted.

Code:
#!/usr/bin/python
# Print various attributes of alarm(s) by modifying various things
# Author: slarti

import dbus
from datetime import datetime, timedelta, date

bus = dbus.SystemBus()

time_obj = bus.get_object('com.nokia.time', '/com/nokia/time')
time_intf = dbus.Interface(time_obj, 'com.nokia.time')
alarm_obj = bus.get_object('com.nokia.time', '/org/maemo/contextkit/Alarm/Trigger')
alarms = alarm_obj.Get(dbus_interface='org.maemo.contextkit.Property')[0]
cookies = alarms[0].keys()
alarms_list = []
for cookie in cookies:
        timestamp = alarms[0][cookie]
        attributes = time_intf.query_attributes(cookie)
        alarms_list.append(((timestamp,cookie,attributes)))

alarms_list.sort()

# Change these to your own language in the order
# they are in if you want to print the weekday:

abb_weekdays = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun']

# Choose the limit for the number of alarms (lines) to print:

limit = 5

# If you want to print "No alarms", if there are none,
# leave this as is (the string can be changed).
# If you don't want it, comment this out or delete it:

if len(alarms_list) == 0:
        print 'No alarms'

# Don't touch this:

if len(alarms_list) < limit:
        limit = len(alarms_list)

# This generates what to print on every line:

for i in range(limit):

# Don't touch this:

        alarm_timestamp = datetime.fromtimestamp((alarms_list[i][0])/1000000000)

# You can choose from these:

        if date.weekday(alarm_timestamp) == date.weekday(datetime.now()):
            weekday = 'Today'
        elif date.weekday(alarm_timestamp) == date.weekday(datetime.now() + timedelta(days=1)):
            weekday = 'Tomorrow'
        else:
            weekday = abb_weekdays[date.weekday(alarm_timestamp)]
        title = alarms_list[i][2]['TITLE']
        alarmtime = datetime.strftime(alarm_timestamp,"%H:%M")
        time_to_alarm = ':'.join(str(alarm_timestamp - datetime.now()).split(':')[:2])
        snooze = alarms_list[i][2]['snooze']+'min'

# This is the special character. Look for the Python source code
# string at e.g. http://www.fileformat.info/info/unicode/block/index.htm

        sc = u"\u2691"

# Here you can decide what to print in which order:

        print (weekday+' '+title+' '+alarmtime+' '+time_to_alarm+' '+snooze+' '+sc).encode('utf-8')
 

The Following User Says Thank You to slarti For This Useful Post:
Posts: 73 | Thanked: 35 times | Joined on Jun 2013
#924
thats brilliant, many thanks for the script!!!!!
 

The Following User Says Thank You to Quaddy For This Useful Post:
Posts: 16 | Thanked: 2 times | Joined on Jun 2013 @ Germany Oberschwaben
#925
I tried to use the "bluetooth_status.py" script in BB
and added the following line to the configuration:

{script:/home/user/MyDocs/blutooth_status.py}

But nothing happens.
Have I forgot something, should the File be executable?
The other Things in Billboard are working fine.

Thanks for any Help
 
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#926
Originally Posted by RR_aus_H View Post
{script:/home/user/MyDocs/blutooth_status.py}

But nothing happens.
You have a typo there, should be
{script:/home/user/MyDocs/bluetooth_status.py} I guess.

Originally Posted by RR_aus_H View Post
Have I forgot something, should the File be executable?
All scripts need permission (chmod +x).
__________________
Nokia 5110 > 3310 > 6230 > N70 > N9 BLACK 64GB
Hildon Foundation Board member
Maemo Community e.V. co-creator, founder and director since Q4/2016
Current Maemo Community Council member
 
Posts: 16 | Thanked: 2 times | Joined on Jun 2013 @ Germany Oberschwaben
#927
Hello Win7Mac,
you are right, I made a mistake by typewriting the line of my N9.
But the original is correct.
Now I try to make the script executable.

Thanks for the Help
 
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#928
no problem, just hit the thanks button, it's good practice here
__________________
Nokia 5110 > 3310 > 6230 > N70 > N9 BLACK 64GB
Hildon Foundation Board member
Maemo Community e.V. co-creator, founder and director since Q4/2016
Current Maemo Community Council member
 

The Following User Says Thank You to Win7Mac For This Useful Post:
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#929
Originally Posted by Win7Mac View Post
All scripts need permission (chmod +x).
This is not strictly true. I usually put my scripts in /home/user and simply run them with the interpreter {script: python script.py). That way there is no need to type in a path or chmod the scripts.
 

The Following User Says Thank You to slarti For This Useful Post:
Posts: 73 | Thanked: 35 times | Joined on Jun 2013
#930
thanks slarti, i had all my scripts in /home/user and did not realize i could cut out the path, has certainly saved some clutter and space in billboard now! very neat!
 
Reply


 
Forum Jump


All times are GMT. The time now is 16:00.