|
|
|
@ -13,7 +13,6 @@ HEADER = '''
|
|
|
|
|
<title>Traffy 73 tracker</title> |
|
|
|
|
<meta name="description" content="Traffy" /> |
|
|
|
|
<meta name="keywords" content="traffy bus tracking 73" /> |
|
|
|
|
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300|Open+Sans' rel='stylesheet' type='text/css'> |
|
|
|
|
<link rel="stylesheet" href="http://bus.traffy.xyz/build/css/style.css"> |
|
|
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> |
|
|
|
|
</head> |
|
|
|
@ -54,6 +53,16 @@ FOOTER = '''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
<script> |
|
|
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
|
|
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
|
|
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
|
|
|
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); |
|
|
|
|
|
|
|
|
|
ga('create', 'UA-72505920-1', 'auto'); |
|
|
|
|
ga('send', 'pageview'); |
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
</body> |
|
|
|
|
</html> |
|
|
|
|
''' |
|
|
|
@ -140,7 +149,7 @@ with open('index.html', 'w') as f:
|
|
|
|
|
prev_stop_id = j['prev_stop']['stop_id'] |
|
|
|
|
next_stop_id = j['next_stop']['stop_id'] |
|
|
|
|
|
|
|
|
|
print ' btw stop %s - %s -- ref = %s' % (prev_stop_id, next_stop_id, rel_ref) |
|
|
|
|
# print ' btw stop %s - %s -- ref = %s' % (prev_stop_id, next_stop_id, rel_ref) |
|
|
|
|
if rel_ref < 10: |
|
|
|
|
stops[prev_stop_id]['at_stop'] = True |
|
|
|
|
elif rel_ref > 90: |
|
|
|
@ -155,11 +164,11 @@ with open('index.html', 'w') as f:
|
|
|
|
|
stop_id = stop['stop_id'] |
|
|
|
|
at_stop_text = '' |
|
|
|
|
if stops[stop_id]['at_stop']: |
|
|
|
|
print ' stop %s has %s bus at stop' % (stop_id, stops[stop_id]['at_stop']) |
|
|
|
|
# print ' stop %s has %s bus at stop' % (stop_id, stops[stop_id]['at_stop']) |
|
|
|
|
at_stop_text = '<i class="fa fa-bus"></i>' |
|
|
|
|
running_text = '' |
|
|
|
|
if stops[stop_id]['running']: |
|
|
|
|
print ' stop %s has %s bus leaving' % (stop_id, stops[stop_id]['running']) |
|
|
|
|
# print ' stop %s has %s bus leaving' % (stop_id, stops[stop_id]['running']) |
|
|
|
|
running_text = GO |
|
|
|
|
stop_data = { |
|
|
|
|
'name': stop['name'], |
|
|
|
@ -168,8 +177,8 @@ with open('index.html', 'w') as f:
|
|
|
|
|
} |
|
|
|
|
s = STOP_TMPL % stop_data |
|
|
|
|
|
|
|
|
|
if at_stop_text or running_text: |
|
|
|
|
print s.encode('utf-8') |
|
|
|
|
# if at_stop_text or running_text: |
|
|
|
|
# print s.encode('utf-8') |
|
|
|
|
content_.append(s) |
|
|
|
|
ind += 1 |
|
|
|
|
|
|
|
|
@ -214,7 +223,7 @@ with open('in.html', 'w') as f:
|
|
|
|
|
prev_stop_id = j['prev_stop']['stop_id'] |
|
|
|
|
next_stop_id = j['next_stop']['stop_id'] |
|
|
|
|
|
|
|
|
|
print ' btw stop %s - %s -- ref = %s' % (prev_stop_id, next_stop_id, rel_ref) |
|
|
|
|
# print ' btw stop %s - %s -- ref = %s' % (prev_stop_id, next_stop_id, rel_ref) |
|
|
|
|
if rel_ref < 10: |
|
|
|
|
stops[prev_stop_id]['at_stop'] = True |
|
|
|
|
elif rel_ref > 90: |
|
|
|
@ -229,11 +238,11 @@ with open('in.html', 'w') as f:
|
|
|
|
|
stop_id = stop['stop_id'] |
|
|
|
|
at_stop_text = '' |
|
|
|
|
if stops[stop_id]['at_stop']: |
|
|
|
|
print ' stop %s has %s bus at stop' % (stop_id, stops[stop_id]['at_stop']) |
|
|
|
|
# print ' stop %s has %s bus at stop' % (stop_id, stops[stop_id]['at_stop']) |
|
|
|
|
at_stop_text = '<i class="fa fa-bus"></i>' |
|
|
|
|
running_text = '' |
|
|
|
|
if stops[stop_id]['running']: |
|
|
|
|
print ' stop %s has %s bus leaving' % (stop_id, stops[stop_id]['running']) |
|
|
|
|
# print ' stop %s has %s bus leaving' % (stop_id, stops[stop_id]['running']) |
|
|
|
|
running_text = GO |
|
|
|
|
stop_data = { |
|
|
|
|
'name': stop['name'], |
|
|
|
@ -242,8 +251,8 @@ with open('in.html', 'w') as f:
|
|
|
|
|
} |
|
|
|
|
s = STOP_TMPL % stop_data |
|
|
|
|
|
|
|
|
|
if at_stop_text or running_text: |
|
|
|
|
print s.encode('utf-8') |
|
|
|
|
# if at_stop_text or running_text: |
|
|
|
|
# print s.encode('utf-8') |
|
|
|
|
content_.append(s) |
|
|
|
|
ind += 1 |
|
|
|
|
|
|
|
|
|