Thread: [Fremantle Maemo5] Share your code
View Single Post
Posts: 391 | Thanked: 908 times | Joined on Aug 2011 @ suncity
#17
Hi All!

Based on dying's idea I created a script and service to see some useful information and not the operator's name

So, as I'm hungarian there is a hungarian version which writes the nameday too...

Installation:
- dependency: sudo, custom-operator-name-widget
- unzip the attached zip file to /opt/onr/ (you have to create onr directory in /opt)
- move the file named 'onr' to /etc/init.d/ make it executable (sudo chmod +x onr) and run the following command in terminal: sudo update-rc.d onr defaults
- move the file named 'onr_startup' to /etc/event.d/. This makes possible to start service automatically after boot.
- edit /opt/onr/GetMoonInfo file 'hemisphere' line (3. line)
- edit /opt/onr/GetWeatherInfo file 'address' line (93. line) - example: http://rss.accuweather.com/rss/livew...B|GB007|LONDON or http://rss.accuweather.com/rss/livew...NY007|NEW-YORK
- run the following command in terminal: sudo /etc/init.d/onr start

What it writes:
- 1. line: time and date
- 2. line: (nameday), number of birthday today, number of events or tasks today (it does not handle repeating events and tasks!), battery level (based on bme; if you have bq27200 feel free to modify the script)
- 3. line: weather now, moon illumination and if waning ("-") or waxing ("+")
- 4. line: weather today
- 5. line: weather tomorrow

If there is a internet connection (cannot test it with mobile net...) it refreshes weather and moon data every 15 minutes (You can modify it in ONR.py script, line 105(this line number is 486 in hun version): time.sleep(whatyouwantinseconds)).
The script runs in every two seconds; you can modify it in line 187 (568 in hun version).
The script checks its' memory usage every minute (you can modify it in line 189 (570 in hun version)) as it raises through time (I do not know why) and restarts itself if it is equal or greater then 3%.

Known bugs:
- sometimes it just freezes (the python script runs though); I do not know why. I suspect it is the hildon-desktop/hildon-home because it happens after waking up the device from locked state. In ths case you have to manually restart it: sudo /etc/init.d/onr restart.
- sometimes it creates a linebreak and shifts the lines lower.

Cheers,

jm

//Edit: If something is not working or you simply do not want the service you can test the python script itself by running it: python /opt/onr/ONR.py or cd /opt/onr then ./ONR.py. If you do this you can see the output so if something is not working it eases debugging (press Ctrl+c for skip).

//Edit2 (2016-05-13 12:26): Corrected moon phases names so it writes the "-" and "+" correctly and don't have the "moon referenced before assignment" error. Please use these if you downloaded the one(s) that I first uploaded.
Attached Images
 
Attached Files
File Type: zip onr.zip (5.4 KB, 197 views)
File Type: zip onr_hun.zip (8.8 KB, 228 views)

Last edited by justmemory; 2016-05-13 at 12:24.
 

The Following 8 Users Say Thank You to justmemory For This Useful Post: