kml/kmlcgi.py
changeset 0 bb616224c02a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kml/kmlcgi.py	Mon May 18 08:48:51 2020 +0200
@@ -0,0 +1,30 @@
+#!/usr/bin/python3
+# coding=utf8
+
+import sys
+import os
+import time
+import config
+import hh_http
+import flyby
+from kml import deb
+
+# for s in ('PYTHONIOENCODING', 'LC_ALL'):
+# 	if s in os.environ:
+# 		deb(os.environ[s])
+# for s in os.environ:
+#     deb('ENV[{}]={}'.format(s, os.environ[s]))
+
+if(not 'HTTP_HOST' in os.environ):
+    sys.exit(1)
+c = config.Config()
+h = hh_http.Http(c)
+fl = flyby.Flyby(c)
+if c.configReq:             	# on config request (...kml...) configure tour
+    if h.parsehttp(''):			# syntax OK
+        fl.tour()				# generate Google Earth tour
+        h.sendform(confirm=True)
+    else:
+        h.sendform(confirm=False)
+elif c.dnldReq:	                # on download request (...flyby...) send KML-file
+    h.sendfile(c.kmlfile)
\ No newline at end of file