maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [announce] Earthquake Script 4 Widget (https://talk.maemo.org/showthread.php?t=87722)

xes 2012-11-04 22:22

[announce] Earthquake Script 4 Widget
 
2 Attachment(s)
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?

sixwheeledbeast 2012-11-04 22:28

Re: [idea] Earthquake Widget (help needed)
 
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.

xes 2012-11-04 23:19

Re: [idea] Earthquake Widget (help needed)
 
Quote:

Originally Posted by sixwheeledbeast (Post 1290165)
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.

sixwheeledbeast 2012-11-05 07:46

Re: [idea] Earthquake Widget (help needed)
 
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.

xes 2012-11-05 08:24

Re: [idea] Earthquake Widget (help needed)
 
...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...

xes 2012-12-04 17:08

Re: [announce] Earthquake Script 4 Widget
 
...still wishing some help.. ;)

Estel 2013-09-01 21:36

Re: [announce] Earthquake Script 4 Widget
 
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

xes 2013-09-01 22:43

Re: [announce] Earthquake Script 4 Widget
 
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..... ;-)

joerg_rw 2013-09-04 12:56

Re: [announce] Earthquake Script 4 Widget
 
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


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

vBulletin® Version 3.8.8