From: maxious Date: Thu, 10 Mar 2011 03:04:28 +0000 Subject: Fix view.sh startup location X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=05e2c43dd775838abc5097b01528cccd6978014a --- Fix view.sh startup location --- --- a/layar_api.php +++ b/layar_api.php @@ -14,10 +14,8 @@ debug(print_r($contents, true)); $stopNum = 0; foreach ($contents as $row) { - $stopNum++; if ($stopNum > $page_start && $stopNum <= $page_end) { - $hotspot = Array(); $hotspot['id'] = $row[0]; $hotspot['title'] = $row[1]; @@ -25,25 +23,22 @@ $hotspot['lat'] = floor($row[2] * 1000000); $hotspot['lon'] = floor($row[3] * 1000000); $hotspot['distance'] = distance($row[2], $row[3], $_REQUEST['lat'], $_REQUEST['lon']); - if (!isset($_REQUEST['radius']) || $hotspot['distance'] < $radius) { - - $hotspot['actions'] = Array( - Array( - "label" => 'View more trips/information', - 'uri' => 'http://bus.lambdacomplex.org/' . 'stop.php?stopid=' . $row[0] - ) - ); - $url = $APIurl . "/json/stoptrips?stop=" . $row[0] . "&time=" . midnight_seconds() . "&service_period=" . service_period() . "&limit=4&time_range=" . strval(90 * 60); - $trips = json_decode(getPage($url)); - debug(print_r($trips, true)); - foreach ($trips as $key => $row) { - if ($key < 3) { - $hotspot['line' . strval($key + 2) ] = $row[1][1] . ' @ ' . midnight_seconds_to_time($row[0]); - } + $hotspot['actions'] = Array( + Array( + "label" => 'View more trips/information', + 'uri' => 'http://bus.lambdacomplex.org/' . 'stop.php?stopid=' . $row[0] + ) + ); + $url = $APIurl . "/json/stoptrips?stop=" . $row[0] . "&time=" . midnight_seconds() . "&service_period=" . service_period() . "&limit=4&time_range=" . strval(90 * 60); + $trips = json_decode(getPage($url)); + debug(print_r($trips, true)); + foreach ($trips as $key => $row) { + if ($key < 3) { + $hotspot['line' . strval($key + 2) ] = $row[1][1] . ' @ ' . midnight_seconds_to_time($row[0]); } - if (sizeof($trips) == 0) $hotspot['line2'] = 'No trips in the near future.'; - $output['hotspots'][] = $hotspot; } + if (sizeof($trips) == 0) $hotspot['line2'] = 'No trips in the near future.'; + $output['hotspots'][] = $hotspot; } } if (sizeof($hotspot) > 0) { --- a/schedule_viewer.py +++ b/schedule_viewer.py @@ -385,6 +385,7 @@ stops.append(s) if scale == 5: + print stops return [StopToTuple(s) for s in stops] else: dist_stop_list = [] @@ -396,6 +397,7 @@ elif dist < dist_stop_list[-1][0]: bisect.insort(dist_stop_list, (dist, s)) dist_stop_list.pop() # Remove stop with greatest distance + print dist_stop_list return [StopToTuple(s) for dist, s in dist_stop_list] def handle_json_GET_boundboxstops(self, params): --- a/view.sh +++ b/view.sh @@ -1,3 +1,6 @@ -python schedule_viewer.py --feed=/var/www/cbrfeed.zip \ + #!/bin/sh + f=`dirname $0` + cd $f + python schedule_viewer.py --feed=/var/www/cbrfeed.zip \ --key=ABQIAAAA95XYXN0cki3Yj_Sb71CFvBTPaLd08ONybQDjcH_VdYtHHLgZvRTw2INzI_m17_IoOUqH3RNNmlTk1Q