Bimba.git

commit f5af1f1b676d8bc1c0c74e0eff56fbc48afcf24a

Author: Adam Pioterek <adam.pioterek@protonmail.ch>

sending current timetable to client

 converter/converter.py | 6 +++---
 converter/gtfs.php | 6 ++++--


diff --git a/converter/converter.py b/converter/converter.py
index 0f1373ae667a71c2cd846c8d62b80a68819afaf9..d5944cf59b07922e436747ce7d6d7a7381439118 100755
--- a/converter/converter.py
+++ b/converter/converter.py
@@ -272,7 +272,7 @@                 self.__cursor.execute('''insert into feed_info values(?, ?, ?, ?,
                                     ?)''', row)
 
     def __create_tables(self):
-        self.__cursor.execute('''create table agency(agency_id INTEGER PRIMARY KEY
+        self.__cursor.execute('''create table agency(agency_id INTEGER PRIMARY KEY,
                    agency_name TEXT,
                    agency_url TEXT,
                    agency_timezone TEXT,
@@ -284,9 +284,9 @@                    stop_name TEXT,
                    stop_lat DOUBLE,
                    stop_lon DOUBLE,
                    zone_id TEXT)''')
-        self.__cursor.execute('''create table routes(route_id INTEGER PRIMARY KEY,
+        self.__cursor.execute('''create table routes(route_id TEXT PRIMARY KEY,
                    agency_id INTEGER,
-                   route_short_name INTEGER,
+                   route_short_name TEXT,
                    route_long_name TEXT,
                    route_desc TEXT,
                    route_type INTEGER,




diff --git a/converter/gtfs.php b/converter/gtfs.php
index 853a6294889261b1522d72b2105f92aaea35370a..ef24767aebb950cb5af6c3de5c69f30abd50c358 100644
--- a/converter/gtfs.php
+++ b/converter/gtfs.php
@@ -26,7 +26,9 @@ if ($etag == $current) {
     http_response_code(304);
 } else {
     header("ETag: $current");
-    // todo send file
-    echo $current;
+    header('Content-Type: application/octet-stream');
+    header('Content-Disposition: attachment; filename="timetable.db.gz"');
+    header('Content-Length: ' . filesize("$current.db.gz"));
+    readfile("$current.db.gz");
 }
 ?>