[tarent-useful-scripts SCM] {mirkarte} branch master updated. aeaf2fb4a723ad1677013b839eb4a37fb7804f7a

mirabilos at evolvis.org mirabilos at evolvis.org
Sat Oct 18 17:55:56 CEST 2014 • <20141018155556.EC5FD4A2559@evolvis.org>


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MirKarte source code repository".

The branch, master has been updated
       via  aeaf2fb4a723ad1677013b839eb4a37fb7804f7a (commit)
       via  fbdb5466d3c54af6377150a898e2f1241576764c (commit)
       via  733692e4b71e56e76913c89ad04bda8a6ade591a (commit)
      from  b3c6738bfb3d9563dde0e2a8e75efd8128ca114f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit aeaf2fb4a723ad1677013b839eb4a37fb7804f7a
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Sat Oct 18 15:56:15 2014 +0000

    denote month/year used

commit fbdb5466d3c54af6377150a898e2f1241576764c
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Sat Oct 18 15:50:45 2014 +0000

    MirPorts fix

commit 733692e4b71e56e76913c89ad04bda8a6ade591a
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Sat Oct 18 15:39:53 2014 +0000

    GeoDashing, too

-----------------------------------------------------------------------

Summary of changes:
 README                           |    4 +++-
 geovexilla.cgi => geodashing.cgi |   43 +++++++++++++++++++++++---------------
 2 files changed, 29 insertions(+), 18 deletions(-)
 copy geovexilla.cgi => geodashing.cgi (72%)

diff --git a/README b/README
index da4fe20..ab0c2c5 100644
--- a/README
+++ b/README
@@ -28,6 +28,7 @@ Variants:
 – geohashing.cgi (mirkarte.js): displays xkcd Geo Hashing waypoints
 – ghtomorrow.cgi (mirkarte.js): same, but for the next day
 – geovexilla.cgi (mirkarte.js): displays GeoVexilla.gpsgames.org flags
+- geodashing.cgi (mirkarte.js): displays GeoDashing.gpsgames.org dashpoints
 
 VCS repository:
 https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=useful-scripts/mirkarte.git
@@ -71,4 +72,5 @@ The area is limited to a hard-coded value, currently
 in between 42°N 6°W and 56°N 12°E. Run xkcd2js.sh
 and change the CGIs to change this range.
 
-Centre coordinates for GeoVexilla are currently hardcoded.
+Centre coordinates for GeoDashing and GeoVexilla and
+month/year for GeoDashing are currently hardcoded.
diff --git a/geovexilla.cgi b/geodashing.cgi
similarity index 72%
copy from geovexilla.cgi
copy to geodashing.cgi
index 9ef8163..5a73667 100755
--- a/geovexilla.cgi
+++ b/geodashing.cgi
@@ -22,10 +22,19 @@
 deflat=50.7
 deflon=7.11
 defzoom=9
+set -A defyear -- $(date +'%y %m')
+defmon=${defyear[1]}
 
 fetch='ftp -o -'
 whence -p wget >/dev/null 2>&1 && fetch='wget -qO- -T3'
 
+# for xmlstarlet on MirPorts
+PATH=$PATH:/usr/mpkg/bin
+
+set -A mirtime_months -- Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
+set -A mirtime_wdays -- Sun Mon Tue Wed Thu Fri Sat
+readonly mirtime_months[*] mirtime_wdays[*]
+
 cat <<'EOF'
 Content-type: text/html; charset=utf-8
 
@@ -34,7 +43,7 @@ Content-type: text/html; charset=utf-8
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta name="copyright" content="see mirkarte.js" />
- <title>MirKarte for GeoVexilla (Beta)</title>
+ <title>MirKarte for GeoDashing (Beta)</title>
  <link rel="stylesheet" type="text/css" href="leaflet/leaflet.css" />
  <style type="text/css"><!--/*--><![CDATA[/*><!--*/
   #nomap {
@@ -82,33 +91,30 @@ Content-type: text/html; charset=utf-8
 EOF
 print "  mirkarte_default_loc = [$deflat, $deflon, $defzoom];"
 
-$fetch "http://geovexilla.gpsgames.org/cgi-bin/vx.pl?zoom=$defzoom&lat=$deflat&lon=$deflon" | \
-    fgrep google.maps.InfoWindow | sed \
-    -e 's/^.*content: "[	 '\'']*//' \
-    -e 's/[	 '\''
]*".*$//' \
-    -e "s!'/cgi-bin!'http://geovexilla.gpsgames.org/cgi-bin!g" |&
-n=0; print "  var geovexilla_arr = ["
-while IFS= read -pr line; do
-	print -r -- "	[$((++n)), \"$line\"],"
+$fetch "http://geodashing.gpsgames.org/cgi-bin/stats.pl?startmonth=$defmon&startyear=$defyear&endmonth=$defmon&endyear=$defyear&radius=200&lat_1=$deflat&lon_1=$deflon&statstype=circle&download=Download&downloadformat=LOC" | \
+    xmlstarlet sel -t -m //waypoint -v name/@id -o ' ' -v coord/@lat -o ' ' -v coord/@lon -n |&
+n=0; print "  var geodashing_arr = ["
+while read -pr id lat lon; do
+	[[ $id = [0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z] ]] || continue
+	print -r -- "	[$((++n)), $lat, $lon, \"GD${id::2}-${id:2}\"],"
 done
-print '	[0, ""]'
+print '	[0, 0, 0, ""]'
 print '  ];'
 
 cat <<'EOF'
 
   function mirkarte_hookfn(map) {
 	var i = 0;
-	var xre = /&lat=([0-9.-]*)&lon=([0-9.-]*)'/;
-
-	while (geovexilla_arr[i][0] != 0) {
-		var xs = xre.exec(geovexilla_arr[i][1]);
-		var ghlat = parseFloat(xs[1]);
-		var ghlon = parseFloat(xs[2]);
+	while (geodashing_arr[i][0] != 0) {
+		var ghlat = geodashing_arr[i][1];
+		var ghlon = geodashing_arr[i][2];
 		var ghmarker = L.marker([ghlat, ghlon], {
 			"draggable": false
 		    }).addTo(map);
 		var f = llformat(ghlat, ghlon, 1);
-		ghmarker.bindPopup(f[0] + ' ' + f[1] + '<br />' + geovexilla_arr[i][1]);
+		ghmarker.bindPopup(f[0] + ' ' + f[1] +
+		    '<br /><a href="http://geodashing.gpsgames.org/cgi-bin/dp.pl?dp=' +
+		    geodashing_arr[i][3] + '">' + geodashing_arr[i][3] + '</a>');
 		i++;
 	}
   }
@@ -126,6 +132,9 @@ cat <<'EOF'
   </p>
  </div>
  <div id="map_coors">
+EOF
+echo "  <span>GeoDashing ${mirtime_months[defmon - 1]} 20$defyear</span><br />"
+cat <<'EOF'
   <span id="map_coors_ns"></span><br />
   <span id="map_coors_we"></span>
  </div>


hooks/post-receive
-- 
MirKarte source code repository
(Evolvis project useful-scripts repository mirkarte)


More information about the useful-scripts-commits mailing list