Notices


Reply
Thread Tools
Posts: 638 | Thanked: 1,692 times | Joined on Aug 2009
#1
While walking on the road to prepare a widget to notify the latest seismic events....

Here attached you can find the script
earthquakes.sh

It is a parser that can retrieve data from USGS, EMSC, INGV(italy) and CRS(north italy), format all information, convert time to GMT and calculate distance from your position.

At the beginning of the file you have to define your position (default is Rome)
At the end of file you can choose the output format.

Pay attention! To run correctly, the command "date" must be the gnu version... So it should be linked to /usr/bin/gnu/date

The syntax is:
earthquakes.sh all|crs|ingv|emsc|usgs MaxNumEvents

(if not specified, MaxNumEvents = 20. Maximum is 50)

So, running:
earthquakes.sh all 30

Will produce:
2375.2 km;2012-12-04;16:29:48;ML 2.0;39.34;40.55;EASTERN TURKEY;EMSC;
1063.4 km;2012-12-04;16:24:35;ML 2.8;36.92;23.06;SOUTHERN GREECE;EMSC;
909.9 km;2012-12-04;16:22:07;MB 3.3;36.59;4.44;STRAIT OF GIBRALTAR;EMSC;
909.2 km;2012-12-04;16:21:48;ML 2.2;38.35;22.12;GREECE;EMSC;
2608.9 km;2012-12-04;15:55:00;ML 2.4;37.43;42.57;TURKEY-SYRIA-IRAQ BORDER REGION;EMSC;
5231.2 km;2012-12-04;15:46:28;ML 2.6;32.45;71.53;OFFSHORE VALPARAISO, CHILE;EMSC;
1465.6 km;2012-12-04;15:45:05;ML 2.4;40.32;29.88;WESTERN TURKEY;EMSC;
12642.3 km;2012-12-04;15:41:33;M 4.5;7.32;143.77;NEAR S COAST OF NEW GUINEA, PNG.;EMSC;
8446.9 km;2012-12-04;15:35:33;ML 3.3;61.2312;-150.8077;48km W of Anchorage Alaska;USGS;
1504.7 km;2012-12-04;15:27:58;ML 2.4;39.69;30.15;WESTERN TURKEY;EMSC;
850.1 km;2012-12-04;15:23:31;ML 3.1;36.78;5.14;NORTHERN ALGERIA;EMSC;
5219.7 km;2012-12-04;15:17:56;ML 2.4;33.93;72.36;OFFSHORE O'HIGGINS, CHILE;EMSC;
5225.1 km;2012-12-04;15:15:54;ML 2.7;33.92;72.42;OFFSHORE O'HIGGINS, CHILE;EMSC;
5817.1 km;2012-12-04;15:10:02;ML 2.9;19.88;69.19;TARAPACA, CHILE;EMSC;
8441.1 km;2012-12-04;15:08:16;ML 2.9;60.8733;-147.4063;64km WSW of Valdez Alaska;USGS;
2423.9 km;2012-12-04;15:02:39;ML 1.9;39.13;41.06;EASTERN TURKEY;EMSC;
9895.9 km;2012-12-04;14:44:00;ML 2.6;40.3132;-124.4685;33km SSW of Ferndale California;USGS;
9897.3 km;2012-12-04;14:32:01;ML 3.3;40.2953;-124.4628;35km SSW of Ferndale California;USGS;
1724.2 km;2012-12-04;13:50:31;ML 3.0;40.51;33.06;CENTRAL TURKEY;EMSC;
5213.2 km;2012-12-04;13:24:33;ML 3.3;32.54;71.37;VALPARAISO, CHILE;EMSC;
5216.3 km;2012-12-04;13:05:02;ML 3.3;32.68;71.50;OFFSHORE VALPARAISO, CHILE;EMSC;
8449.1 km;2012-12-04;13:01:04;ML 2.6;61.2118;-150.8212;49km W of Anchorage Alaska;USGS;
.....

So, while waiting some developer to help me preparing a real widget...
I'm using this with "Desktop Command Execution Widget"
(http://maemo.org/packages/view/desktop-cmd-exec/)

Attached, the screenshot obtained with this applet...



....
Now i would prepare something to obtain a widget for maemo.
Anyone knows if there is something already developed usable to obtain this kind of widget?

Anyone could give me some help or idea?
Attached Images
 
Attached Files
File Type: zip earthquakes.zip (2.1 KB, 87 views)

Last edited by xes; 2012-12-04 at 17:53.
 

The Following 6 Users Say Thank You to xes For This Useful Post:
Posts: 2,290 | Thanked: 4,133 times | Joined on Apr 2010 @ UK
#2
Use an API to get your data as it should be easier to work with.

Here's a website that seems to be able to provide JSON
www.geonames.org/export/JSON-webservices.html

There are other maemo apps that have used JSON before. Look at the sources for bfbc2stats for example.
__________________

Wiki Admin
sixwheeledbeast's wiki
Testing Squad Subscriber
- mcallerx - tenminutecore - FlopSwap - Qnotted - zzztop - Bander - Fight2048 -


Before posting or starting a thread please try this.
 

The Following 2 Users Say Thank You to sixwheeledbeast For This Useful Post:
Posts: 638 | Thanked: 1,692 times | Joined on Aug 2009
#3
Originally Posted by sixwheeledbeast View Post
Use an API to get your data as it should be easier to work with.

Here's a website that seems to be able to provide JSON
www.geonames.org/export/JSON-webservices.html

There are other maemo apps that have used JSON before. Look at the sources for bfbc2stats for example.
Thanks for your reply. I suppose that json is the best way to handle this kind of data but unfortunately not all organization support json....so, with some local organization, the start point is often a csv or an html page to parse and convert to csv.

Anyway, i think that the widget structure is the most difficult part of the work..(sorry, i don't own a "developer inside" shirt... )

Do you know if there is any piece of code usable to obtain a widget with a click-to-update/timer list?
Until now, the search button didn't helped too much so i'm choosing the "ask" option.

Any help will be really appreciated.
 

The Following User Says Thank You to xes For This Useful Post:
Posts: 2,290 | Thanked: 4,133 times | Joined on Apr 2010 @ UK
#4
There are other ways other than JSON, but this seems the most logical to use.

If your not really in to coding and you have a html source, look up Oculo.
This is a widget for your desktop that can display "screenshots" of a webpage. Should be able to give you your information straight to the desktop with no messing.
__________________

Wiki Admin
sixwheeledbeast's wiki
Testing Squad Subscriber
- mcallerx - tenminutecore - FlopSwap - Qnotted - zzztop - Bander - Fight2048 -


Before posting or starting a thread please try this.
 

The Following User Says Thank You to sixwheeledbeast For This Useful Post:
Posts: 638 | Thanked: 1,692 times | Joined on Aug 2009
#5
...Oculo was the first try, but 10MB of ram for every widget is a cost too high considering also that this kind of pages with long lists and a lot of javascript are not so easy to load and cut to obtain something of readable.
I have also contacted the developer but there is no source and no future for that project...

Last edited by xes; 2012-11-05 at 14:21.
 
Posts: 638 | Thanked: 1,692 times | Joined on Aug 2009
#6
...still wishing some help..
 
Estel's Avatar
Posts: 5,028 | Thanked: 8,613 times | Joined on Mar 2011
#7
I think (ab)using QueenBeeconWidget engine is best way to go. I'm not expert on widgets (rarely ever use them), but unless you want to code it as you would do with any other program, already available widget engine should do the trick.

And, from those, QBW is the most powerful. I can hardly imagine a practical usage for widget, that you couldn't script there.

/Estel
__________________
N900's aluminum backcover / body replacement
-
N900's HDMI-Out
-
Camera cover MOD
-
Measure battery's real capacity on-device
-
TrueCrypt 7.1 | ereswap | bnf
-
Hardware's mods research is costly. To support my work, please consider donating. Thank You!
 

The Following User Says Thank You to Estel For This Useful Post:
Posts: 638 | Thanked: 1,692 times | Joined on Aug 2009
#8
in the meanwhile... some provider of seismic events had changed the format of data he gives.. (usgs,emsc) So the script needs a restyling and some fix..
work in progresss..... ;-)
 

The Following 2 Users Say Thank You to xes For This Useful Post:
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#9
I didn't look in depth what you're doing there, but aiui maybe a close look at "Fahrplan" app might provide some code snippets you might find useful.

cheers
jOERG
__________________
Maemo Community Council member [2012-10, 2013-05, 2013-11, 2014-06 terms]
Hildon Foundation Council inaugural member.
MCe.V. foundation member

EX Hildon Foundation approved
Maemo Administration Coordinator (stepped down due to bullying 2014-04-05)
aka "techstaff" - the guys who keep your infra running - Devotion to Duty http://xkcd.com/705/

IRC(freenode): DocScrutinizer*
First USB hostmode fanatic, father of H-E-N
 

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


 
Forum Jump


All times are GMT. The time now is 09:22.