Notices


Reply
Thread Tools
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#491
For windows I'd recomend notepad++.
Syntax highlighting included. And it's open source...
Just make shure you set encoding to UTF-8 without BOM and in settings>options> choose UNIX. There you can also choose the default encoding format.
__________________
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

Last edited by Win7Mac; 2013-01-11 at 11:58.
 
Posts: 44 | Thanked: 20 times | Joined on May 2012
#492
@coderus yes exactly like that, plus one more last night
wazapp shows offline, billboard shows online
tweetian streaming hanged at the same time so I guess there was some netowk problem that caused this.

you did not say who is updating the BB status exactly? where can I go to read logs or debug?
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#493
why you cant write on device using Nano or KhtSimpleText? Why you always searching for stupid troubles, using windows?
__________________
Telegram | Openrepos | GitHub | Revolut donations
 
Moderator | Posts: 6,215 | Thanked: 6,400 times | Joined on Nov 2011
#494
Originally Posted by coderus View Post
why you cant write on device using Nano or KhtSimpleText? Why you always searching for stupid troubles, using windows?
Because there are multiple ways to skin a cat and uniformity is for sheep?
 

The Following 3 Users Say Thank You to thedead1440 For This Useful Post:
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#495
Originally Posted by Win7Mac View Post
Here's what I can't get to work:
{{blue}}{events}{events? ☚} only works as desired if there's 1 event.

If there's 2 or more, only the first is shown blue (the rest is white) and only the last has the ☚ (which is obvious)
This is handled by Billboard, so can't help you there.

Originally Posted by Win7Mac View Post
{script: /home/user/alarm.py} is not showing at all with the last line of script edited to
Code:
sys.stdout.write('\n'.join(sorted(get_queued_alarms())))
instead of
Code:
print '\n'.join(sorted(get_queued_alarms())) or 'No alarms'
This modification is supposed to enable special characters in the BB text, but I get nothing at all.

Any help on this would be great.

Would it be possible to get events and alarms via shell script too?
What does it say in termimal when you run it? The python interpreter usually tells you where the problem is. Did you import the sys module?

You can get special characters with the print function, too. Just encode them to utf-8. For example, in the python interpreter:
Code:
u"☚".encode('utf-8')
Gives you:
Code:
'\xe2\x98\x9a'
Just add this string to the string you're printing and it will show up in Billboard. It's a good idea to declare the encoding at the second line of the script with:
Code:
# -*- coding: utf-8 -*-
It's possible to write shell scripts for those but you should be able to do the same things with python. Basically you need to query the timed daemon for active events/alarms with atttributes, get their cookies, match those cookies to events, sort them and print them.
 

The Following User Says Thank You to slarti For This Useful Post:
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#496
Originally Posted by Zvjer View Post
I can confirm that wazapp-status in 1.0.7 does not do it's job. My wazapp crashed a few minutes ago, and I did not start it again because I'm waiting on the standby screen to see if billboard will understand that wazapp is crashed but no - it still says "online".
The reason for this is the same as with the current music track being the last played video player when the Videos app gets closed - the app that sets the context property does not update it, and there's nothing Billboard can do about it (short from periodically checking which programs are still running, which I won't do for battery usage and simplicity reasons).

Here's how to fix the problem: Wazapp should update the contextkit property when it crashes. "But how can a program do something when it crashes?" i hear you say. There are several possibilities, for example implement a signal handler for SIGSEGV that cleans up things like the contextkit property, or wrap the executable in a script that does the clean-up work after the program has exited (one could check the exit code to find out if it was a normal or abnormal termination). And for "normal termination" of the application, one can use atexit(3) as a means to do clean-ups (in case it's not possible to modify other parts of the code directly.

In that case, when Wazapp reports the right status in its ContextKit property, everything will work right. I won't change Billboard, as ContextKit properties are a nice and simple way to get quick updates (as soon as the value changes) while still having very low battery usage (no polling or expensive "alive" checks).

Originally Posted by Zvjer View Post
Right now I'm on a WiFi router with broken internet connection. Nothing works, but wazapp thinks he is online, but it's not. Billboard thinks we are online too. Useless plugin? NHF.
Again, what Wazapp thinks is something that Billboard has no influence over. If it reports "online", that's a bug in Wazapp.

As far as Billboard goes, what does "thinks we are online too" mean? There's no "online" status as such in Billboard proper. What we have is the network name (obviously you *are* connected to Wifi network "XYZ" if you are connected to it - even if it does not have an uplink to Teh Internets), and the presence status (this again comes from the presence framework, and there's nothing we can do here to fix this).

Of course, you can write a script that checks if there's a real internet connection (but then, how far do you go? pinging google.com is enough? what about hotspots in cafes with login pages? do you try to open a webpage? what if that server is down, and the rest of the internet is up? you see, "being connected to the internet" isn't that easy to determine, and you don't want to constantly send traffic if you are on a battery budget, or worse - a limited data plan).

In short: Can it be done? Probably yes. Is it worth it? Probably no.

Originally Posted by Win7Mac View Post
Here's what I can't get to work:
  • - {{blue}}{events}{events? ☚} only works as desired if there's 1 event.
    If there's 2 or more, only the first is shown blue (the rest is white) and only the last has the ☚ (which is obvious)
Yes, {{color}} only goes to the end of the current line for now. What you could do is set the global color to blue, and then prefix every line that you don't want to have in blue with the desired color. At least this works as long as you don't have any other multi-line fields (for scripts, you can modify them to output the color prefix on every line).
 

The Following 3 Users Say Thank You to thp For This Useful Post:
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#497
Originally Posted by slarti View Post
What does it say in termimal when you run it? The python interpreter usually tells you where the problem is.
The output for
Code:
sys.stdout.write('\n'.join(sorted(get_queued_alarms())))
is >-sh: syntax error: unexpected word (expecting ")")<

The output for
Code:
print '\n'.join(sorted(get_queued_alarms())) or 'No alarms'
is >-sh: syntax error: unexpected "("<
So there seems an issue with the "()'s" - I just can't resolve it.

Originally Posted by slarti View Post
Did you import the sys module?
What's that exactly? - I only installed python an python-dbus.

Originally Posted by slarti View Post
You can get special characters with the print function, too. Just encode them to utf-8.
Could you paste your code in the script, so it's placed correct and post here?

Originally Posted by thp View Post
Yes, {{color}} only goes to the end of the current line for now. What you could do is set the global color to blue, and then prefix every line that you don't want to have in blue with the desired color.
Will try that.
Thanks everybody.
__________________
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: 277 | Thanked: 319 times | Joined on Jan 2010
#498
Originally Posted by Win7Mac View Post
What's that exactly? - I only installed python an python-dbus.


Could you paste your code in the script, so it's placed correct and post here?
If you want to use the sys module then you have to import it just like you import other modules. Simply write import sys at the top.

I'm having trouble making thp's script behave nicely because of the generator object from which he prints the alarms. If you can settle for just the next alarm, here is my script added with a special character at the end of the line. If you want it explained or modified, just ask.

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
# Horribly mangled by slarti to find only the next alarm
# (set from clock application); 2012-06-19
# from http://talk.maemo.org/showpost.php?p=1224180&postcount=107

import dbus
from datetime import datetime, timedelta
import time

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'})
today = datetime.now()
tomorrow = today + timedelta(days=1)

def list_queued_alarms():
    for cookie in cookies:
        attributes = time_intf.query_attributes(cookie)
        alarmtime = attributes['alarmtime']
        if attributes['STATE'] == 'QUEUED':
            if 'recurrence' in attributes:
                days = tuple(attributes['recurrence'])
            else:
                if datetime.time(datetime.strptime(alarmtime, ("%H:%M"))) > datetime.time(datetime.now()):
                    days = time.strftime("%w")
                else:
                    days = tomorrow.strftime("%w")
            weekdays = dict([(day, time.strptime((day + " " + alarmtime),'%w %H:%M' )) for day in days])
            for day in days:
                yield ' '.join((day,time.strftime('%a %H:%M',weekdays[day]),attributes['TITLE']))


findme_list = [' '.join((time.strftime('%w %a %H:%M'),'findme'))]
L = list(list_queued_alarms()) + findme_list
L.sort()
findme_string = ' '.join((time.strftime('%w %a %H:%M'),'findme'))
findme_int = L.index(findme_string)
if len(L) == 1:
    next_alarm = 'xxNo alarms'
else:
    if findme_int == (len(L) - 1):
        next_alarm = L[0]
    else:
        next_alarm = L[findme_int + 1]

print next_alarm[2:].encode('utf-8') + '\xe2\x98\x9a'
 

The Following User Says Thank You to slarti For This Useful Post:
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#499
Big thanks slarti!
Originally Posted by slarti View Post
If you want to use the sys module then you have to import it just like you import other modules. Simply write import sys at the top.

I'm having trouble making thp's script behave nicely because of the generator object from which he prints the alarms.
I couldn't get it to work by simply adding import sys at the top too. So what about the syntax errors?

Originally Posted by slarti View Post
If you can settle for just the next alarm, here is my script added with a special character at the end of the line.
Yeah! Now I got the picture about the special chars in python. Works great.
Almost done now, just get rid of the 'No alarms' msg in a way that the line in BB disappears (and won't leave a blank line), if there's no alarm. Add the second alarm probably?
Edit: I'm already using your script for short weekday, could this be implemented in the above script to adopt to my language? I prefer short weekday very much over the "+1" from {events}, good idea! Probably we can have that for events too

General question:
Is "#!/bin/sh" or "#!/usr/bin/python" required in each script top line?
I thought "#" makes it get ignored...
__________________
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

Last edited by Win7Mac; 2013-01-12 at 01:12.
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#500
 

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


 
Forum Jump


All times are GMT. The time now is 17:39.