gtfs changes..
This commit is contained in:
commit
0a21330efd
|
@ -191,7 +191,6 @@ SERVICE_SCHEDULE = [
|
|||
{'id':1,'code':'HOL','days':[7,8]}, # should be only 8
|
||||
{'id':2,'code':'SUN','days':[7]},
|
||||
{'id':3,'code':'MF&HOL','days':[1,2,3,4,5,8]},
|
||||
{'id':3,'code':'MS&SUN','days':[1,2,3,4,5,7,8]},
|
||||
{'id':4,'code':'SAT','days':[6]},
|
||||
{'id':5,'code':'MF','days':[1,2,3,4,5]},
|
||||
{'id':6,'code':'SH','days':[7,8]},
|
||||
|
@ -206,6 +205,7 @@ SERVICE_SCHEDULE = [
|
|||
{'id':15,'code':'S/H','days':[7,8]},
|
||||
{'id':16,'code':'SAT,SUN&HOL','days':[6,7,8]},
|
||||
{'id':17,'code':'FH','days':[5,8]},
|
||||
{'id':18,'code':'MS&SUN','days':[1,2,3,4,5,7]},
|
||||
]
|
||||
|
||||
#{'id':18,'code':'2nd &4th','days':[7,8]},
|
||||
|
@ -251,9 +251,9 @@ def export_calendar():
|
|||
# data checks here
|
||||
running = [1 if day in ss['days'] else 0 for day in range(1,8)]
|
||||
if 8 in ss['days']:
|
||||
# check holidays, if not sunday, and in time period between start_date and stop_date then, load in cal_dates
|
||||
# check holidays, if in time period between start_date and stop_date then, load in cal_dates
|
||||
for hol in Holiday.objects.all():
|
||||
if hol.date > start_date and hol.date < end_date and hol.date.isoweekday != 7:
|
||||
if hol.date > start_date and hol.date < end_date:
|
||||
f2.writerow([ss['code']]+ [hol.date.__str__().replace("-","")] + ["1"])
|
||||
|
||||
f.writerow([ss['code']] + running + [start_date_str,end_date_str])
|
||||
|
@ -985,11 +985,14 @@ def export_stop_times(routelist):
|
|||
|
||||
dist = dist3
|
||||
|
||||
#--------------------- get distance ---------------
|
||||
#---------------------end get distance ---------------
|
||||
|
||||
#--------------------- s ---------------
|
||||
|
||||
runtime = runtime_in_minutes(schedule) #j runtime should be calculated for each separate runtime entry, so stop_times becomes a bit more accurate.
|
||||
# if ring route, then double the runtime as runtime is calculated uptil the 'via' point.
|
||||
if str(route.code)[3]==4:
|
||||
runtime= int(2*runtime)
|
||||
|
||||
#if dist == 0.0 or runtime == 0
|
||||
avgspeed = 12.0/60.0
|
||||
|
|
|
@ -17,3 +17,4 @@ SAT/SUND&HOL,0,0,0,0,0,1,1,20120701,20121130
|
|||
S/H,0,0,0,0,0,0,1,20120701,20121130
|
||||
"SAT,SUN&HOL",0,0,0,0,0,1,1,20120701,20121130
|
||||
FH,0,0,0,0,1,0,0,20120701,20121130
|
||||
MS&SUN,1,1,1,1,1,0,1,20120701,20121130
|
||||
|
|
|
@ -2925,8 +2925,6 @@ trip_id,start_time,end_time,headway_secs
|
|||
3780_3679_FW_DOWN,11:00:00,16:59:59,660
|
||||
3780_3679_FW_DOWN,17:00:00,19:59:59,480
|
||||
3780_3679_FW_DOWN,20:00:00,25:04:00,480
|
||||
3720_3685__UP,00:00:00,06:59:59,480
|
||||
3720_3685__DOWN,00:00:00,06:59:59,480
|
||||
0768_3691_MF_UP,09:35:00,10:55:00,1800
|
||||
0768_3691_MF_DOWN,00:00:00,06:59:59,9000
|
||||
3760_3687_SH_UP,06:15:00,06:59:59,1320
|
||||
|
@ -3104,6 +3102,8 @@ trip_id,start_time,end_time,headway_secs
|
|||
0830_3722_SH_UP,21:01:00,23:25:00,2580
|
||||
0830_3722_SH_DOWN,19:55:00,19:59:59,2580
|
||||
0830_3722_SH_DOWN,20:00:00,22:03:00,2580
|
||||
3720_3685_FW_UP,00:00:00,06:59:59,480
|
||||
3720_3685_FW_DOWN,00:00:00,06:59:59,480
|
||||
1374_3656_SAT_UP,06:55:00,06:59:59,3000
|
||||
1374_3656_SAT_UP,07:00:00,10:59:59,360
|
||||
1374_3656_SAT_UP,11:00:00,16:59:59,480
|
||||
|
@ -10762,14 +10762,6 @@ trip_id,start_time,end_time,headway_secs
|
|||
0460_4806_SH_DOWN,07:00:00,07:38:00,1620
|
||||
0430_4825_FW_UP,06:25:00,06:55:00,1980
|
||||
0430_4825_FW_DOWN,05:45:00,06:27:00,1980
|
||||
0426_4868_SAT &HOL_UP,07:05:00,10:59:59,960
|
||||
0426_4868_SAT &HOL_UP,11:00:00,16:59:59,1200
|
||||
0426_4868_SAT &HOL_UP,17:00:00,19:59:59,1140
|
||||
0426_4868_SAT &HOL_UP,20:00:00,20:45:00,900
|
||||
0426_4868_SAT &HOL_DOWN,07:15:00,10:59:59,960
|
||||
0426_4868_SAT &HOL_DOWN,11:00:00,16:59:59,1200
|
||||
0426_4868_SAT &HOL_DOWN,17:00:00,19:59:59,1140
|
||||
0426_4868_SAT &HOL_DOWN,20:00:00,22:00:00,900
|
||||
5171_3305_SH_UP,05:45:00,06:05:00,3300
|
||||
5171_3305_SH_DOWN,22:04:00,23:00:00,3300
|
||||
5257_3326_MF_UP,06:03:00,06:59:59,1200
|
||||
|
@ -11236,3 +11228,11 @@ trip_id,start_time,end_time,headway_secs
|
|||
5331_4796_MS_UP,20:48:00,23:15:00,1920
|
||||
5331_4796_MS_DOWN,06:01:00,06:59:59,1920
|
||||
5331_4796_MS_DOWN,07:00:00,07:17:00,1920
|
||||
0426_4868_SAT&HOL_UP,07:05:00,10:59:59,960
|
||||
0426_4868_SAT&HOL_UP,11:00:00,16:59:59,1200
|
||||
0426_4868_SAT&HOL_UP,17:00:00,19:59:59,1140
|
||||
0426_4868_SAT&HOL_UP,20:00:00,20:45:00,900
|
||||
0426_4868_SAT&HOL_DOWN,07:15:00,10:59:59,960
|
||||
0426_4868_SAT&HOL_DOWN,11:00:00,16:59:59,1200
|
||||
0426_4868_SAT&HOL_DOWN,17:00:00,19:59:59,1140
|
||||
0426_4868_SAT&HOL_DOWN,20:00:00,22:00:00,900
|
||||
|
|
|
@ -28018,20 +28018,6 @@ trip_id,arrival_time,departure_time,stop_id,stop_sequence
|
|||
3780_3679_FW_DOWN,06:22:02,06:22:12,357,6
|
||||
3780_3679_FW_DOWN,,,1058,7
|
||||
3780_3679_FW_DOWN,06:25:45,06:25:55,344,8
|
||||
3720_3685__UP,05:00:00,05:00:00,2250,1
|
||||
3720_3685__UP,,,2251,2
|
||||
3720_3685__UP,05:02:31,05:02:41,2252,3
|
||||
3720_3685__UP,,,3158,4
|
||||
3720_3685__UP,05:06:44,05:06:54,343,5
|
||||
3720_3685__UP,,,1756,6
|
||||
3720_3685__UP,05:09:15,05:09:15,337,7
|
||||
3720_3685__DOWN,05:00:00,05:00:00,337,1
|
||||
3720_3685__DOWN,,,1756,2
|
||||
3720_3685__DOWN,,,343,3
|
||||
3720_3685__DOWN,,,3158,4
|
||||
3720_3685__DOWN,05:05:00,05:05:10,2252,5
|
||||
3720_3685__DOWN,,,2251,6
|
||||
3720_3685__DOWN,05:08:00,05:08:10,2250,7
|
||||
0768_3691_MF_UP,05:00:00,05:00:00,4,1
|
||||
0768_3691_MF_UP,05:01:29,05:01:39,5,2
|
||||
0768_3691_MF_UP,05:07:06,05:07:16,3119,3
|
||||
|
@ -29706,6 +29692,20 @@ trip_id,arrival_time,departure_time,stop_id,stop_sequence
|
|||
0830_3722_SH_DOWN,21:41:46,21:41:56,443,37
|
||||
0830_3722_SH_DOWN,,,442,38
|
||||
0830_3722_SH_DOWN,21:44:00,21:44:10,441,39
|
||||
3720_3685_FW_UP,05:00:00,05:00:00,2250,1
|
||||
3720_3685_FW_UP,,,2251,2
|
||||
3720_3685_FW_UP,05:02:31,05:02:41,2252,3
|
||||
3720_3685_FW_UP,,,3158,4
|
||||
3720_3685_FW_UP,05:06:44,05:06:54,343,5
|
||||
3720_3685_FW_UP,,,1756,6
|
||||
3720_3685_FW_UP,05:09:15,05:09:15,337,7
|
||||
3720_3685_FW_DOWN,05:00:00,05:00:00,337,1
|
||||
3720_3685_FW_DOWN,,,1756,2
|
||||
3720_3685_FW_DOWN,,,343,3
|
||||
3720_3685_FW_DOWN,,,3158,4
|
||||
3720_3685_FW_DOWN,05:05:00,05:05:10,2252,5
|
||||
3720_3685_FW_DOWN,,,2251,6
|
||||
3720_3685_FW_DOWN,05:08:00,05:08:10,2250,7
|
||||
1374_3656_SAT_UP,05:00:00,05:00:00,87,1
|
||||
1374_3656_SAT_UP,,,89,2
|
||||
1374_3656_SAT_UP,05:04:22,05:04:32,40,3
|
||||
|
@ -105516,69 +105516,6 @@ trip_id,arrival_time,departure_time,stop_id,stop_sequence
|
|||
0430_4825_FW_DOWN,,,273,7
|
||||
0430_4825_FW_DOWN,06:42:40,06:42:50,710,8
|
||||
0430_4825_FW_DOWN,06:58:00,06:58:10,711,9
|
||||
0426_4868_SAT &HOL_UP,07:15:00,07:15:00,1064,1
|
||||
0426_4868_SAT &HOL_UP,,,153,2
|
||||
0426_4868_SAT &HOL_UP,07:19:01,07:19:11,170,3
|
||||
0426_4868_SAT &HOL_UP,07:20:22,07:20:32,171,4
|
||||
0426_4868_SAT &HOL_UP,07:21:42,07:21:52,3056,5
|
||||
0426_4868_SAT &HOL_UP,07:23:51,07:24:01,319,6
|
||||
0426_4868_SAT &HOL_UP,07:28:25,07:28:35,3051,7
|
||||
0426_4868_SAT &HOL_UP,07:31:06,07:31:16,3709,8
|
||||
0426_4868_SAT &HOL_UP,,,378,9
|
||||
0426_4868_SAT &HOL_UP,07:34:19,07:34:29,379,10
|
||||
0426_4868_SAT &HOL_UP,07:39:41,07:39:51,381,11
|
||||
0426_4868_SAT &HOL_UP,07:43:11,07:43:21,328,12
|
||||
0426_4868_SAT &HOL_UP,,,2608,13
|
||||
0426_4868_SAT &HOL_UP,07:47:28,07:47:38,1177,14
|
||||
0426_4868_SAT &HOL_UP,07:51:46,07:51:56,1261,15
|
||||
0426_4868_SAT &HOL_UP,,,2609,16
|
||||
0426_4868_SAT &HOL_UP,07:59:33,07:59:43,1262,17
|
||||
0426_4868_SAT &HOL_UP,08:03:51,08:04:01,2701,18
|
||||
0426_4868_SAT &HOL_UP,08:07:53,08:08:03,3778,19
|
||||
0426_4868_SAT &HOL_UP,08:09:29,08:09:39,3662,20
|
||||
0426_4868_SAT &HOL_UP,08:11:38,08:11:48,3685,21
|
||||
0426_4868_SAT &HOL_UP,08:13:47,08:13:57,3663,22
|
||||
0426_4868_SAT &HOL_UP,,,3958,23
|
||||
0426_4868_SAT &HOL_UP,08:17:16,08:17:26,3664,24
|
||||
0426_4868_SAT &HOL_UP,,,3930,25
|
||||
0426_4868_SAT &HOL_UP,08:20:46,08:20:56,3929,26
|
||||
0426_4868_SAT &HOL_UP,08:22:38,08:22:48,3928,27
|
||||
0426_4868_SAT &HOL_UP,,,4303,28
|
||||
0426_4868_SAT &HOL_UP,08:25:36,08:25:46,4304,29
|
||||
0426_4868_SAT &HOL_UP,,,4462,30
|
||||
0426_4868_SAT &HOL_UP,,,4305,31
|
||||
0426_4868_SAT &HOL_UP,08:27:45,08:27:55,4301,32
|
||||
0426_4868_SAT &HOL_DOWN,07:05:00,07:05:00,4301,1
|
||||
0426_4868_SAT &HOL_DOWN,,,4305,2
|
||||
0426_4868_SAT &HOL_DOWN,,,4462,3
|
||||
0426_4868_SAT &HOL_DOWN,07:07:08,07:07:18,4304,4
|
||||
0426_4868_SAT &HOL_DOWN,,,4303,5
|
||||
0426_4868_SAT &HOL_DOWN,07:10:06,07:10:16,3928,6
|
||||
0426_4868_SAT &HOL_DOWN,07:11:58,07:12:08,3929,7
|
||||
0426_4868_SAT &HOL_DOWN,,,3930,8
|
||||
0426_4868_SAT &HOL_DOWN,07:15:28,07:15:38,3664,9
|
||||
0426_4868_SAT &HOL_DOWN,,,3958,10
|
||||
0426_4868_SAT &HOL_DOWN,07:18:57,07:19:07,3663,11
|
||||
0426_4868_SAT &HOL_DOWN,07:21:06,07:21:16,3685,12
|
||||
0426_4868_SAT &HOL_DOWN,07:23:15,07:23:25,3662,13
|
||||
0426_4868_SAT &HOL_DOWN,07:24:51,07:25:01,3778,14
|
||||
0426_4868_SAT &HOL_DOWN,07:28:53,07:29:03,2701,15
|
||||
0426_4868_SAT &HOL_DOWN,07:33:11,07:33:21,1262,16
|
||||
0426_4868_SAT &HOL_DOWN,,,2609,17
|
||||
0426_4868_SAT &HOL_DOWN,07:40:58,07:41:08,1261,18
|
||||
0426_4868_SAT &HOL_DOWN,07:45:16,07:45:26,1177,19
|
||||
0426_4868_SAT &HOL_DOWN,,,2608,20
|
||||
0426_4868_SAT &HOL_DOWN,07:49:33,07:49:43,328,21
|
||||
0426_4868_SAT &HOL_DOWN,07:53:03,07:53:13,381,22
|
||||
0426_4868_SAT &HOL_DOWN,07:58:25,07:58:35,379,23
|
||||
0426_4868_SAT &HOL_DOWN,,,378,24
|
||||
0426_4868_SAT &HOL_DOWN,08:01:38,08:01:48,3709,25
|
||||
0426_4868_SAT &HOL_DOWN,08:04:19,08:04:29,3051,26
|
||||
0426_4868_SAT &HOL_DOWN,08:08:53,08:09:03,319,27
|
||||
0426_4868_SAT &HOL_DOWN,08:11:02,08:11:12,3056,28
|
||||
0426_4868_SAT &HOL_DOWN,08:12:22,08:12:32,171,29
|
||||
0426_4868_SAT &HOL_DOWN,08:13:43,08:13:53,170,30
|
||||
0426_4868_SAT &HOL_DOWN,08:17:45,08:17:55,1064,31
|
||||
5171_3305_SH_UP,22:04:00,22:04:00,242,1
|
||||
5171_3305_SH_UP,,,1249,2
|
||||
5171_3305_SH_UP,,,243,3
|
||||
|
@ -114163,3 +114100,66 @@ trip_id,arrival_time,departure_time,stop_id,stop_sequence
|
|||
5331_4796_MS_DOWN,21:16:06,21:16:16,1164,27
|
||||
5331_4796_MS_DOWN,21:17:54,21:18:04,1378,28
|
||||
5331_4796_MS_DOWN,21:20:00,21:20:10,3408,29
|
||||
0426_4868_SAT&HOL_UP,07:15:00,07:15:00,1064,1
|
||||
0426_4868_SAT&HOL_UP,,,153,2
|
||||
0426_4868_SAT&HOL_UP,07:19:01,07:19:11,170,3
|
||||
0426_4868_SAT&HOL_UP,07:20:22,07:20:32,171,4
|
||||
0426_4868_SAT&HOL_UP,07:21:42,07:21:52,3056,5
|
||||
0426_4868_SAT&HOL_UP,07:23:51,07:24:01,319,6
|
||||
0426_4868_SAT&HOL_UP,07:28:25,07:28:35,3051,7
|
||||
0426_4868_SAT&HOL_UP,07:31:06,07:31:16,3709,8
|
||||
0426_4868_SAT&HOL_UP,,,378,9
|
||||
0426_4868_SAT&HOL_UP,07:34:19,07:34:29,379,10
|
||||
0426_4868_SAT&HOL_UP,07:39:41,07:39:51,381,11
|
||||
0426_4868_SAT&HOL_UP,07:43:11,07:43:21,328,12
|
||||
0426_4868_SAT&HOL_UP,,,2608,13
|
||||
0426_4868_SAT&HOL_UP,07:47:28,07:47:38,1177,14
|
||||
0426_4868_SAT&HOL_UP,07:51:46,07:51:56,1261,15
|
||||
0426_4868_SAT&HOL_UP,,,2609,16
|
||||
0426_4868_SAT&HOL_UP,07:59:33,07:59:43,1262,17
|
||||
0426_4868_SAT&HOL_UP,08:03:51,08:04:01,2701,18
|
||||
0426_4868_SAT&HOL_UP,08:07:53,08:08:03,3778,19
|
||||
0426_4868_SAT&HOL_UP,08:09:29,08:09:39,3662,20
|
||||
0426_4868_SAT&HOL_UP,08:11:38,08:11:48,3685,21
|
||||
0426_4868_SAT&HOL_UP,08:13:47,08:13:57,3663,22
|
||||
0426_4868_SAT&HOL_UP,,,3958,23
|
||||
0426_4868_SAT&HOL_UP,08:17:16,08:17:26,3664,24
|
||||
0426_4868_SAT&HOL_UP,,,3930,25
|
||||
0426_4868_SAT&HOL_UP,08:20:46,08:20:56,3929,26
|
||||
0426_4868_SAT&HOL_UP,08:22:38,08:22:48,3928,27
|
||||
0426_4868_SAT&HOL_UP,,,4303,28
|
||||
0426_4868_SAT&HOL_UP,08:25:36,08:25:46,4304,29
|
||||
0426_4868_SAT&HOL_UP,,,4462,30
|
||||
0426_4868_SAT&HOL_UP,,,4305,31
|
||||
0426_4868_SAT&HOL_UP,08:27:45,08:27:55,4301,32
|
||||
0426_4868_SAT&HOL_DOWN,07:05:00,07:05:00,4301,1
|
||||
0426_4868_SAT&HOL_DOWN,,,4305,2
|
||||
0426_4868_SAT&HOL_DOWN,,,4462,3
|
||||
0426_4868_SAT&HOL_DOWN,07:07:08,07:07:18,4304,4
|
||||
0426_4868_SAT&HOL_DOWN,,,4303,5
|
||||
0426_4868_SAT&HOL_DOWN,07:10:06,07:10:16,3928,6
|
||||
0426_4868_SAT&HOL_DOWN,07:11:58,07:12:08,3929,7
|
||||
0426_4868_SAT&HOL_DOWN,,,3930,8
|
||||
0426_4868_SAT&HOL_DOWN,07:15:28,07:15:38,3664,9
|
||||
0426_4868_SAT&HOL_DOWN,,,3958,10
|
||||
0426_4868_SAT&HOL_DOWN,07:18:57,07:19:07,3663,11
|
||||
0426_4868_SAT&HOL_DOWN,07:21:06,07:21:16,3685,12
|
||||
0426_4868_SAT&HOL_DOWN,07:23:15,07:23:25,3662,13
|
||||
0426_4868_SAT&HOL_DOWN,07:24:51,07:25:01,3778,14
|
||||
0426_4868_SAT&HOL_DOWN,07:28:53,07:29:03,2701,15
|
||||
0426_4868_SAT&HOL_DOWN,07:33:11,07:33:21,1262,16
|
||||
0426_4868_SAT&HOL_DOWN,,,2609,17
|
||||
0426_4868_SAT&HOL_DOWN,07:40:58,07:41:08,1261,18
|
||||
0426_4868_SAT&HOL_DOWN,07:45:16,07:45:26,1177,19
|
||||
0426_4868_SAT&HOL_DOWN,,,2608,20
|
||||
0426_4868_SAT&HOL_DOWN,07:49:33,07:49:43,328,21
|
||||
0426_4868_SAT&HOL_DOWN,07:53:03,07:53:13,381,22
|
||||
0426_4868_SAT&HOL_DOWN,07:58:25,07:58:35,379,23
|
||||
0426_4868_SAT&HOL_DOWN,,,378,24
|
||||
0426_4868_SAT&HOL_DOWN,08:01:38,08:01:48,3709,25
|
||||
0426_4868_SAT&HOL_DOWN,08:04:19,08:04:29,3051,26
|
||||
0426_4868_SAT&HOL_DOWN,08:08:53,08:09:03,319,27
|
||||
0426_4868_SAT&HOL_DOWN,08:11:02,08:11:12,3056,28
|
||||
0426_4868_SAT&HOL_DOWN,08:12:22,08:12:32,171,29
|
||||
0426_4868_SAT&HOL_DOWN,08:13:43,08:13:53,170,30
|
||||
0426_4868_SAT&HOL_DOWN,08:17:45,08:17:55,1064,31
|
||||
|
|
|
@ -259,7 +259,6 @@ stop_id,stop_name,stop_lat,stop_lon,stop_desc
|
|||
307,PRATIKSHA NGR.DEPOT,19.0423689584,72.8729261348,Marathi:प्रतिक्षा नगर आगार Road:EAST MARG Area:PRATIKSHA NAGAR
|
||||
308,MAKER TOWER,18.9157373813,72.8174810918,Marathi:मेकर टॉवर Road:SADHU VASWANI MARG Area:BACKBAY
|
||||
310,VIDHAN BHAWAN,18.9253413092,72.8241747462,Marathi:विधान भवन Road:BARRISTER RAJNI PATEL MARG Area:MANTRALAYA
|
||||
311,N.C.P.A.,18.9273134621,72.8216087274,Marathi:एन.सी.पी.ए Road:BAJAJ MARG Area:MANTRALAYA
|
||||
314,PRATIKSHA NGR NO.1/SAMAJMANDIR HALL,19.0392047091,72.8667463252,Marathi:प्रतीक्षा नगर नं.1/समाजमंदीर सभाग्रुह Road:JANPATH MARG Area:PRATIKSHA NAGAR
|
||||
315,TRANSIT CAMP DISPENSARY,19.0402188981,72.8692354152,Marathi:टँन्झीट कँप डिस्पेन्सरी Road:KARYALAYA MARG Area:PRATIKSHA NAGAR
|
||||
317,BEST RECIEVING CENTRE,19.0414764839,72.8703512141,Marathi:बे.स्ट रिसीव्हिंग सेंटर Road:EAST MARG Area:PRATIKSHA NAGAR
|
||||
|
@ -1226,7 +1225,6 @@ stop_id,stop_name,stop_lat,stop_lon,stop_desc
|
|||
1617,MAHARASHTRA NGR.,19.1408574956,72.9281502036,Marathi:महाराष्ट्र नगर भांडुप Road:SARDAR PRATAPSINGH MARG Area:BHANDUP (W)
|
||||
1618,SAHYADRI NGR.,19.1429048934,72.9282789496,Marathi:सह्याद्री नगर भांडुप Road:SARDAR PRATAPSINGH MARG Area:BHANDUP (W)
|
||||
1619,KOKAN NGR.,19.1451549747,72.9284291534,Marathi:कोकन नगर भांडुप Road:SARDAR PRATAPSINGH MARG Area:BHANDUP (W)
|
||||
1620,SARVODAYANGR.,19.146990453,72.9289112655,Marathi:सर्वोद्य नगर भांडुप Road:SANMAN SINGH MARG Area:BHANDUP (W)
|
||||
1622,JUNGAL MANGAL RD.,19.1497563967,72.9326992301,Marathi:जंगल मंगल रोड Road:SARDAR PRATAPSINGH MARG Area:BHANDUP (W)
|
||||
1623,SANTACRUZ STN (E),19.0806793114,72.8428488305,Marathi:सांताक्रुझ स्थानक(पू) Road:JAWAHARLAL NEHRU MARG Area:SANTACRUZ (E)
|
||||
1625,NEHRU LIBRARY (VIDYANGRY),19.0743100856,72.8604836751,Marathi:नेहरु लायब्ररी(विद्यानगरी) Road:*NAME TO BE CONFIRMED Area:KALINA
|
||||
|
@ -1531,7 +1529,6 @@ stop_id,stop_name,stop_lat,stop_lon,stop_desc
|
|||
2102,KOKANI PADA,19.2448352488,72.8728140111,Marathi:कोकणी पाडा बोरीवली Road:SANT KABIR MARG Area:DAHISAR (E)
|
||||
2104,GAWDE NGR.,19.2449061539,72.8699011321,Marathi:गावडे नगर Road:SANT KABIR MARG Area:DAHISAR (E)
|
||||
2105,FISH MARKET,19.246901612,72.872095179,Marathi:फिश मार्केट(बोरीवली) Road:SANT KABIR MARG Area:DAHISAR (E)
|
||||
2106,NIRMAL BLDG.,18.9273627724,72.821748786,Marathi:निर्मल बिल्डींग Road:BARRISTER RAJNI PATEL MARG Area:MANTRALAYA
|
||||
2111,WADALA TRUCK TERMINAL,19.0366233691,72.8753652677,Marathi:वडाळा ट्रक टर्मीनल Road:BHANUSHANKAR YADGNIK MARG Area:ANIK
|
||||
2114,WADALA TRUCK TERMINAL MAIN GATE,19.0357447208,72.8797412645,Marathi:वडाळा ट्रक टर्मीनल मेन गेट Road:BHANUSHANKAR YADGNIK MARG Area:ANIK
|
||||
2115,AMBASSADOR HOTEL,19.1063823964,72.8748815326,Marathi:एम्बॅसीडर होटेल Road:*NAME TO BE CONFIRMED Area:SAHAR
|
||||
|
@ -2113,7 +2110,6 @@ stop_id,stop_name,stop_lat,stop_lon,stop_desc
|
|||
3262,AHILYABAI HOLKAR CHK.,18.9333194533,72.8277272066,Marathi:अहिल्याबाई होळकर चौक Road:VITHALDAS THAKARSEE MARG Area:CHURCHGATE
|
||||
3263,AHILYABAI HOLKAR CHK.,18.9325084892,72.8276842149,Marathi:अहिल्याबाई होळकर चौक Road:J.TATA MARG Area:CHURCHGATE
|
||||
3264,AHILYABAI HOLKAR CHK.,18.9318936516,72.8272023862,Marathi:अहिल्याबाई होळकर चौक Road:J.TATA MARG Area:CHURCHGATE
|
||||
3266,AHILYABAI HOLKAR CHK.,18.9334047442,72.8272466602,Marathi:अहिल्याबाई होळकर चौक Road:INDIAN MERCHANT CHAMBER MARG Area:CHURCHGATE
|
||||
3267,SEWREE COURT,18.9933265109,72.8513480407,Marathi:शिवडी कोर्ट Road:JACKERIA BUNDER MARG Area:SEWREE
|
||||
3268,SEWREE COURT,18.993175108,72.8511449813,Marathi:शिवडी न्यायालय Road:JACKERIA BUNDER MARG Area:SEWREE
|
||||
3270,CHINCHWADI/GARTEN PADA NO.1,19.2528993234,72.8735188251,Marathi:चिंचवाडी / गार्टेन पाडा Road:SUHASINI PAWSKAR MARG Area:DAHISAR (E)
|
||||
|
@ -2203,7 +2199,6 @@ stop_id,stop_name,stop_lat,stop_lon,stop_desc
|
|||
3380,ANUSHAKTI NGR.BUS STN.,19.0425405932,72.9262390529,Marathi:अणुशक्ती नगर बस स्थानक Road:VITHAL NARAYAN PURAV MARG Area:ANUSHAKTI NAGAR
|
||||
3382,ANUSHAKTI NGR.,19.0427191074,72.9261058008,Marathi:अणुशक्ती नगर Road:VITHAL NARAYAN PURAV MARG Area:ANUSHAKTI NAGAR
|
||||
3383,CANTEEN STORES DEPARTMENT,18.9817189438,72.8533268701,Marathi:कँटीन स्टोर्स विभाग Road:HAY BUNDER MARG Area:REAY ROAD (E)
|
||||
3390,RAM MANDIR,19.1525762902,72.8446730484,Marathi:राम मंदिर Road:SWAMI VIVEKANAND MARG Area:GOREGAON (W)
|
||||
3392,YASHODHAM,19.0847704682,72.8325879865,Marathi:यशो धाम Road:RELIEF ROAD (DAULATNAGAR) Area:SANTACRUZ (E)
|
||||
3393,KALA NGR.,19.0555628221,72.8477240989,Marathi:कला नगर Road:RAMKRISHNA PARAMHANS MARG Area:BANDRA (E)
|
||||
3396,ACHARYA VIDYANIKETAN,19.0276369934,72.8894176551,Marathi:आचार्य विद्यानिकेतन Road:R.C.F.MARG Area:MAHUL
|
||||
|
@ -2306,7 +2301,6 @@ stop_id,stop_name,stop_lat,stop_lon,stop_desc
|
|||
3551,VIJAY NGR.,19.1200938136,72.8785141922,Marathi:विजय नगर Road:VIJAY NAGAR FLYOVER BRIDGE Area:MAROL
|
||||
3552,KHERWADI JN.,19.0608002311,72.8464736329,Marathi:खेरवाडी जंक्शन Road:SIR ALIYAWAR JUNG MARG Area:BANDRA (E)
|
||||
3554,WALJI LADHA MARG,19.172482159,72.9488403567,Marathi:वालजी लधा मार्ग Road:WALJI LADHA MARG Area:MULUND (W)
|
||||
3555,NAVJIVAN VIDYAMANDIR,19.1494837228,72.9273663131,Marathi:नवजिवन विद्यामंदीर Road:SANMAN SINGH MARG Area:BHANDUP (W)
|
||||
3556,SIMPLEX MILL,18.9801273169,72.8303735429,Marathi:ुसिम्प्लेक्स मिल Road:KESHAVRAO KHADEY MARG Area:SATRASTA
|
||||
3559,MITH CHKY,19.1953325114,72.8337729794,Marathi:मीठ चौक Road:GANDHINAGAR LINK ROAD Area:MALAD (W)
|
||||
3560,JANTA CLY./SHIV MANDIR,19.1995880419,72.8337729794,Marathi:जनता कॉलनी/शिव मंदिर Road:GANDHINAGAR LINK ROAD Area:MALAD (W)
|
||||
|
@ -2503,7 +2497,6 @@ stop_id,stop_name,stop_lat,stop_lon,stop_desc
|
|||
3889,KORA KENDRA,19.2209677594,72.8527369548,Marathi:मांडली तलाव Road:SWAMI VIVEKANAND MARG Area:KANDIVLI (W)
|
||||
3892,HIRADEVI MANDIR,19.1639610913,72.7904537963,Marathi:जैन मंदिर (भायंदर) Road:BHASKAR BHOPI MARG Area:AKSA
|
||||
3893,NATIONAL(HINDUJA)HOSPITAL,19.0321196196,72.8395790925,Marathi:नॅशनल रुग्णालय(हिंदुजा) Road:TAKANDAS KATARIA MARG Area:MAHIM
|
||||
3898,PRINCESS STREET,18.9454446395,72.8271953675,Marathi:प्रिसेंस स्ट्रीट Road:SHAMALDAS GANDHI MARG Area:MARINE LINES (E)
|
||||
3900,DURGA NGR.(KANDIVLI-E),19.1938809105,72.8682688572,Marathi:दुर्गा नगर(कांदिवली-इ) Road:LOKHANWALA MARG Area:KANDIVLI (E)
|
||||
3901,KADAMWADI(KANDIVLI-E),19.1955446482,72.8683169652,Marathi:कदमवाडी (कांदिवली-प) Road:LOKHANWALA MARG Area:KANDIVLI (E)
|
||||
3902,GREEN MIDOSE,19.1971658136,72.8705056477,Marathi:ग्रीन मिडास Road:LOKHANWALA MARG Area:KANDIVLI (E)
|
||||
|
@ -2844,7 +2837,6 @@ stop_id,stop_name,stop_lat,stop_lon,stop_desc
|
|||
4355,LODHA COMPLEX,19.2934037785,72.8563094213,Marathi:लोधा संकुल Road:NEW GHODBUNDER MARG Area:BHAYANDER (E)
|
||||
4356,ANAND NGR. (BHAYANDER),19.3039375071,72.8637142945,Marathi:आनंद नगर (भायंदर) Road:NEW GHODBUNDER MARG Area:BHAYANDER (E)
|
||||
4357,SHINDEWADI,19.0107028727,72.8427454782,Marathi:शिंदेवाडी Road:DR.BABASAHEB AMBEDKAR MARG Area:DADAR (E)
|
||||
4359,MASRANI EST.,19.0761349248,72.882391495,Marathi:मस्रानी ईस्टेट Road:*NAME TO BE CONFIRMED Area:KURLA (W)
|
||||
4360,RAHAT APT.S,19.0754251468,72.8800526087,Marathi:राहत अपार्टमेंटस Road:NEW MILL ROAD(KURLA) Area:KURLA (W)
|
||||
4364,NAVJEEVAN SCTY.,19.072464326,72.8784218256,Marathi:नवजीवन सोसायटी Road:NEW MILL ROAD(KURLA) Area:KURLA (W)
|
||||
4366,AAKASHGANGA SOC.,19.0397005347,72.8607675504,Marathi:आकाशगंगा सोसायटी Road:SANT ROHIDAS MARG Area:DHARAVI
|
||||
|
@ -3000,7 +2992,6 @@ stop_id,stop_name,stop_lat,stop_lon,stop_desc
|
|||
4614,BUSA UDYOG BHAVAN,18.9981865291,72.850179386,Marathi:बुसा उद्योग भवन Road:TOKARSEE JIVARAJ MARG Area:SEWREE
|
||||
4615,LALIT CLINIC,19.1875907923,73.0214988392,Marathi:ललीत क्लीनीक Road:*NAME TO BE CONFIRMED Area:MUMBRA
|
||||
4616,LODHA PARADISE (COMPLEX),19.2111435777,72.9831498989,Marathi:लोधा संकुल Road:*NAME TO BE CONFIRMED Area:THANE (W)
|
||||
4617,SAIFEE HOSPITAL,18.9518984107,72.8186337563,Marathi:सैफे रुग्णालय Road:MAHARSHI KARVE MARG Area:CHARNI ROAD (E)
|
||||
4618,KUMBHAR TUKDA,18.9533126261,72.8259435523,Marathi:कुंभार तुकडा Road:DR.BABASAHEB JAYKAR MARG Area:GIRGAON
|
||||
4619,CHARNI RD.RLY.STN./PARSHI AGYARI,18.9502763749,72.820440139,Marathi:चर्नी रोड रेल्वे स्थानक/पारशी अग्यारी Road:MAHARSHI KARVE MARG Area:CHARNI ROAD (E)
|
||||
4620,AHILYABAI HOLKAR CHK (E),18.9332960354,72.8278850965,Marathi:अहिल्याबाई होळकर चौक(पू) Road:VEER NARIMAN MARG Area:CHURCHGATE
|
||||
|
@ -3139,4 +3130,3 @@ stop_id,stop_name,stop_lat,stop_lon,stop_desc
|
|||
4820,MUMBAI CRICKET ASSO.EAST GATE,19.0650869845,72.8625407061,Marathi:मुंबई क्रिकेट संघ (पूर्व दरवाजा) Road:*NAME TO BE CONFIRMED Area:BANDRA-KURLA COMPLEX
|
||||
2312,OM NGR.(WARE HOUSE),19.1030486418,72.8663079566,Marathi:ओम नगर (वेर हाउस) Road:*NAME TO BE CONFIRMED Area:ANDHERI (E)
|
||||
4551,SAFED POOL,19.0947834231,72.8834876227,Marathi:सफेद पुल Road:KURLA - ANDHERI MARG Area:SAKI NAKA
|
||||
3899,DAVA BAZAR(KALBADEVI),18.9460737917,72.8286544892,Marathi:डावा बाझार(काळबादेवी) Road:SHAMALDAS GANDHI MARG Area:MARINE LINES (E)
|
||||
|
|
|
@ -819,8 +819,6 @@ route_id,service_id,trip_id
|
|||
0466,MS,0466_3681_MS_DOWN
|
||||
3780,FW,3780_3679_FW_UP
|
||||
3780,FW,3780_3679_FW_DOWN
|
||||
3720,,3720_3685__UP
|
||||
3720,,3720_3685__DOWN
|
||||
0768,MF,0768_3691_MF_UP
|
||||
0768,MF,0768_3691_MF_DOWN
|
||||
3760,SH,3760_3687_SH_UP
|
||||
|
@ -875,6 +873,8 @@ route_id,service_id,trip_id
|
|||
0830,MS,0830_3718_MS_DOWN
|
||||
0830,SH,0830_3722_SH_UP
|
||||
0830,SH,0830_3722_SH_DOWN
|
||||
3720,FW,3720_3685_FW_UP
|
||||
3720,FW,3720_3685_FW_DOWN
|
||||
1374,SAT,1374_3656_SAT_UP
|
||||
1374,SAT,1374_3656_SAT_DOWN
|
||||
2094,MS,2094_3743_MS_UP
|
||||
|
@ -3003,8 +3003,6 @@ route_id,service_id,trip_id
|
|||
0460,SH,0460_4806_SH_DOWN
|
||||
0430,FW,0430_4825_FW_UP
|
||||
0430,FW,0430_4825_FW_DOWN
|
||||
0426,SAT &HOL,0426_4868_SAT &HOL_UP
|
||||
0426,SAT &HOL,0426_4868_SAT &HOL_DOWN
|
||||
5171,SH,5171_3305_SH_UP
|
||||
5171,SH,5171_3305_SH_DOWN
|
||||
5257,MF,5257_3326_MF_UP
|
||||
|
@ -3241,3 +3239,5 @@ route_id,service_id,trip_id
|
|||
5091,FW,5091_4757_FW_DOWN
|
||||
5331,MS,5331_4796_MS_UP
|
||||
5331,MS,5331_4796_MS_DOWN
|
||||
0426,SAT&HOL,0426_4868_SAT&HOL_UP
|
||||
0426,SAT&HOL,0426_4868_SAT&HOL_DOWN
|
||||
|
|
|
@ -8,4 +8,8 @@ urlpatterns = patterns('',
|
|||
(r'^routes/$', apiviews.routes),
|
||||
(r'^areas/$', apiviews.areas),
|
||||
(r'^stops/$', apiviews.stops),
|
||||
|
||||
)
|
||||
|
||||
|
||||
# (r'route/freq/(?P<code>.*)$', views.route_headway),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from models import *
|
||||
from mumbai.models import *
|
||||
from ox.django.shortcuts import get_object_or_404_json, render_to_json_response
|
||||
from django.contrib.auth.decorators import login_required
|
||||
import json
|
||||
|
@ -90,3 +90,28 @@ def stop(request, slug):
|
|||
else:
|
||||
stop = get_object_or_404_json(Stop, slug=slug)
|
||||
return render_to_json_response(stop.get_geojson(srid=srid)) #FIXME: please don't repeat this code, its retarded.
|
||||
|
||||
|
||||
def route_headway(request, code):
|
||||
"""
|
||||
Given a route code, gets the current frequency of the buses at the current time.
|
||||
"""
|
||||
return render_to_json_response("hello")
|
||||
route = get_object_or_404(Route, code=code)
|
||||
import datetime.datetime
|
||||
current_time = datetime.datetime.now
|
||||
day = current_time.isoweekday
|
||||
|
||||
scheds = []
|
||||
for rs in RouteSchedule.objects.filter(unique_route__route=route):
|
||||
if day in SCHED[rs.schedule_type]:
|
||||
scheds.append(rs)
|
||||
|
||||
return render_to_json_response("hello")
|
||||
|
||||
# {
|
||||
# 'route': route.get_dict(),
|
||||
# 'scheds': [ s.__dict__ for s in scheds]
|
||||
# })
|
||||
|
||||
|
||||
|
|
|
@ -25,29 +25,33 @@ DAYS = {
|
|||
}
|
||||
|
||||
SCHED = {
|
||||
'MS':[1,2,3,4,5,6],
|
||||
'HOL':[8],
|
||||
'SUN':[7],
|
||||
'MF&HOL':[1,2,3,4,5,8],
|
||||
'SAT':[6],
|
||||
'MF':[1,2,3,4,5],
|
||||
'SH':[7,8],
|
||||
'AD':[1,2,3,4,5,6,7,8],
|
||||
'SAT&SUN':[6,7],
|
||||
'MS&HOL':[1,2,3,4,5,6,8],
|
||||
'FW':[1,2,3,4,5,6,7],
|
||||
'SAT/SH':[6,7,8],
|
||||
'FH':[1,2,3,4,5,6,8],
|
||||
'SAT&HOL':[6,8],
|
||||
'SAT&SH':[6,7,8],
|
||||
'SAT/SUND&HOL':[6,7,8],
|
||||
'S/H':[7,8],
|
||||
'SAT,SUN&HOL':[6,7,8],
|
||||
'2nd &4th':['???']
|
||||
'MS':[1, 2, 3, 4, 5, 6],
|
||||
'HOL':[7, 8],
|
||||
'SUN':[7],
|
||||
'MF&HOL':[1, 2, 3, 4, 5, 8],
|
||||
'SAT':[6],
|
||||
'MF':[1, 2, 3, 4, 5],
|
||||
'SH':[7, 8],
|
||||
'AD':[1, 2, 3, 4, 5, 6, 7, 8],
|
||||
'SAT&SUN':[6, 7],
|
||||
'MS&HOL':[1, 2, 3, 4, 5, 6, 8],
|
||||
'FW':[1, 2, 3, 4, 5, 6, 7],
|
||||
'SAT/SH':[6, 7, 8],
|
||||
'SAT&HOL':[6, 8],
|
||||
'SAT&SH':[6, 7, 8],
|
||||
'SAT/SUND&HOL':[6, 7, 8],
|
||||
'S/H':[7, 8],
|
||||
'SAT,SUN&HOL':[6, 7, 8],
|
||||
'FH':[5, 8]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Runtime start and end hour
|
||||
# matching column `runtimen` where `n` = index % 4 + 1
|
||||
# matching column `runtime$` where `$` = index % 4 + 1
|
||||
RUNTIMES = (
|
||||
(00, 07),
|
||||
(07, 11),
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# Create your views here.
|
||||
from models import *
|
||||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from ox.django.shortcuts import get_object_or_404_json, render_to_json_response
|
||||
|
||||
from django.template import RequestContext
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
@ -27,6 +29,7 @@ def route(request, alias):
|
|||
})
|
||||
return render_to_response("route.html", context)
|
||||
|
||||
|
||||
def areas(request):
|
||||
context = RequestContext(request, {
|
||||
'areas': Area.objects.all()
|
||||
|
@ -216,3 +219,36 @@ def fuzzystops_edit(request):
|
|||
# })
|
||||
## pdb.set_trace()
|
||||
# return render_to_response("fuzzystops.html", context)
|
||||
|
||||
|
||||
def route_headway(request, code):
|
||||
"""
|
||||
Given a route code, gets the current frequency of the buses at the current time.
|
||||
"""
|
||||
route = get_object_or_404(Route, code=code)
|
||||
import datetime
|
||||
current_time = datetime.datetime.now()
|
||||
day = current_time.isoweekday()
|
||||
|
||||
scheds = []
|
||||
for rs in RouteSchedule.objects.filter(unique_route__route=route):
|
||||
if day in SCHED[rs.schedule_type]:
|
||||
scheds.append(rs)
|
||||
|
||||
|
||||
TIMESPANS = ((None,"06:59:59"),
|
||||
("07:00:00","10:59:59"),
|
||||
("11:00:00","16:59:59"),
|
||||
("17:00:00","19:59:59"),
|
||||
("20:00:00",None))
|
||||
|
||||
#for s in scheds:
|
||||
# if current_time< time_of("")
|
||||
|
||||
return render_to_json_response(
|
||||
{
|
||||
'route': route.get_dict(),
|
||||
'scheds': [ (s.headway1, s.headway2, s.headway3, s.headway4, str(s.unique_route) ) for s in scheds]
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class Train(models.Model):
|
|||
class Station(models.Model):
|
||||
name = models.CharField(max_length=128)
|
||||
point = models.PointField(null=True, blank=True)
|
||||
# line = models.CharField(choices=LINE_CHOICES, db_index=True)
|
||||
# line = models.CharField(choices=LINE_CHOICES, db_index=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
|
|
@ -5,9 +5,10 @@ import datetime
|
|||
BASE_URL = 'http://mumbailifeline.com/'
|
||||
|
||||
'''
|
||||
eg.:
|
||||
>>>parseURL('http://mumbailifeline.com/timetable.php?sel_route=central&sfrom=Mumbai_CST&sto=Masjid&time1=4:00%20am&time2=11:59%20PM', Central')
|
||||
eg.: parseURL('http://mumbailifeline.com/timetable.php?sel_route=central&sfrom=Mumbai_CST&sto=Masjid&time1=4:00%20am&time2=11:59%20PM', Central')
|
||||
|
||||
'''
|
||||
|
||||
def parseURL(url, line):
|
||||
d = pq(url=url)
|
||||
table = d('#gradient-style')
|
||||
|
|
|
@ -106,6 +106,7 @@ function saveUNR(elem, markChecked) {
|
|||
<th>To Txt</th>
|
||||
<th>To Stop</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -141,6 +142,12 @@ function saveUNR(elem, markChecked) {
|
|||
<button class="markChecked">Checked</button>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<a href="/admin/mumbai/route/{{ u.unr.route.id}}">R</a>
|
||||
<a href="/admin/mumbai/uniqueroute/{{ u.unr.id }}">UNR</a>
|
||||
<a href="/route/{{ u.unr.route.alias }}">Map</a>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
|
@ -27,6 +27,7 @@ urlpatterns = patterns('',
|
|||
(r'^editstops/$', 'mumbai.views.editstops'),
|
||||
#(r'^accounts/', include('allauth.urls')),
|
||||
(r'^1.0/', include('mumbai.apiurls')),
|
||||
(r'^route/freq/(?P<code>.*)$', 'mumbai.views.route_headway'),
|
||||
#url(r'^login/', include('socialregistration.urls',namespace='socialregistration')),
|
||||
# Uncomment the admin/doc line below to enable admin documentation:
|
||||
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
|
|
|
@ -3,6 +3,7 @@ PIL==1.1.7
|
|||
RapidSMS==0.9.6a
|
||||
South==0.7.5
|
||||
-e git://github.com/schuyler/arrest.git@0017837a45bcb31786f953fba976d454ae684ecc#egg=arrest-dev
|
||||
-e git://github.com/etianen/django-reversion.git#egg=reversion
|
||||
chardet==1.0.1
|
||||
django-allauth==0.5.0
|
||||
django-avatar==1.0.5
|
||||
|
@ -19,9 +20,12 @@ django-socialregistration==0.5.4
|
|||
django-userena==1.1.2
|
||||
djappsettings==0.1.0
|
||||
djtables==0.1.2
|
||||
|
||||
#facebook-python-sdk==0.1
|
||||
#-e git://github.com/jhaddad/facebook-python-sdk#egg=facebook-python-sdk
|
||||
|
||||
easy-thumbnails==1.0.3
|
||||
facebook-python-sdk==0.1
|
||||
facebook-sdk==0.3.1
|
||||
#facebook-sdk==0.3.1
|
||||
feedparser==5.1.2
|
||||
-e git://github.com/seatgeek/fuzzywuzzy.git@c73e3d32e3bb4d31dc38cc64e3a3362855d4d249#egg=fuzzywuzzy-dev
|
||||
httplib2==0.7.4
|
||||
|
|
|
@ -18,6 +18,46 @@ STYLE = {"start": "", "repeat": "; ", "end": ""}
|
|||
|
||||
ChaloBest = arrest.Client("http://chalobest.in/1.0")
|
||||
|
||||
def get_routes_for_matches(stops):
|
||||
# same_stops = []
|
||||
# same_stops.append(stops[0])
|
||||
# if len(stops) > 1:
|
||||
# for s in stops[1:]:
|
||||
# if s['properties']['official_name'] == stops[0]['properties']['official_name']:
|
||||
# same_stops.append(s)
|
||||
routes = []
|
||||
for stop in stops:
|
||||
routes.extend(stop['properties']['routes'].split(", "))
|
||||
return routes
|
||||
|
||||
def get_stops_for_string(s):
|
||||
stops = []
|
||||
s = s.strip()
|
||||
areas = ChaloBest.areas(q=s)
|
||||
if len(areas) > 0:
|
||||
for a in areas:
|
||||
area = ChaloBest.area[a]
|
||||
for stop in area['stops']['features']:
|
||||
stops.append(stop)
|
||||
return {
|
||||
'name': ", ".join(areas),
|
||||
'stops': stops
|
||||
}
|
||||
else:
|
||||
stops_results = ChaloBest.stops(q=s)['features']
|
||||
if len(stops_results) == 0:
|
||||
return None
|
||||
same_stops = []
|
||||
same_stops.append(stops_results[0])
|
||||
if len(stops_results) > 1:
|
||||
for s in stops_results[1:]:
|
||||
if s['properties']['official_name'] == same_stops[0]['properties']['official_name']:
|
||||
same_stops.append(s)
|
||||
return {
|
||||
'name': same_stops[0]['properties']['display_name'],
|
||||
'stops': same_stops
|
||||
}
|
||||
|
||||
class App(AppBase):
|
||||
def handle(self, msg):
|
||||
if DIGIT.search(msg.text):
|
||||
|
@ -25,6 +65,12 @@ class App(AppBase):
|
|||
if not routes:
|
||||
msg.respond("Sorry, we found no route marked '%(text)s'.", text=msg.text)
|
||||
return
|
||||
detail = None
|
||||
for route in routes:
|
||||
if route.replace(" ", "").upper() == msg.text.replace(" ", "").upper():
|
||||
detail = ChaloBest.route[route]
|
||||
if detail == None:
|
||||
detail = ChaloBest.route[routes[0]]
|
||||
detail = ChaloBest.route[routes[0]]
|
||||
stops = detail['stops']['features']
|
||||
origin, dest = stops[0]['properties'], stops[-1]['properties']
|
||||
|
@ -32,6 +78,36 @@ class App(AppBase):
|
|||
origin_area, dest_area = PUNCT.sub('', origin['area']), PUNCT.sub('', dest['area'])
|
||||
msg.respond("%s: %s (%s) to %s (%s)" % (
|
||||
",".join(routes), origin_name, origin_area, dest_name, dest_area))
|
||||
elif msg.text.find(" to ") != -1:
|
||||
|
||||
from_txt = msg.text.split("to")[0].strip()
|
||||
to_txt = msg.text.split("to")[1].strip()
|
||||
|
||||
from_matches = get_stops_for_string(from_txt)
|
||||
to_matches = get_stops_for_string(to_txt)
|
||||
|
||||
# stop1matches = ChaloBest.stops(q=stop1txt)['features']
|
||||
if not from_matches:
|
||||
msg.respond("Sorry, found no stop matching '%s'" % from_txt)
|
||||
return
|
||||
#best_match1 = stop1matches[0]
|
||||
routes1 = set(get_routes_for_matches(from_matches['stops']))
|
||||
#stop2matches = ChaloBest.stops(q=stop2txt)['features']
|
||||
if not to_matches:
|
||||
msg.respond("Sorry, found no stop matching '%s'" % to_txt)
|
||||
#best_match2 = stop2matches[0]
|
||||
routes2 = set(get_routes_for_matches(to_matches['stops']))
|
||||
#routes1arr = set(routes1.split(", "))
|
||||
#routes2arr = set(routes2.split(", "))
|
||||
intersection = list(routes1.intersection(routes2))
|
||||
if len(intersection) == 0:
|
||||
msg.respond("Sorry, no direct buses found between %s and %s" % (from_matches['name'], to_matches['name'],))
|
||||
return
|
||||
routesFound = ", ".join(intersection)
|
||||
msg.respond("%s to %s: %s" % (from_matches['name'], to_matches['name'], routesFound,))
|
||||
return
|
||||
|
||||
|
||||
else:
|
||||
features = ChaloBest.stops(q=msg.text)['features']
|
||||
if not features:
|
||||
|
|
|
@ -150,7 +150,7 @@ LOG_BACKUPS = 256 # number of logs to keep
|
|||
# these weird dependencies should be handled by their respective apps,
|
||||
# but they're not, so here they are. most of them are for django admin.
|
||||
TEMPLATE_CONTEXT_PROCESSORS = [
|
||||
"django.core.context_processors.auth",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.core.context_processors.debug",
|
||||
"django.core.context_processors.i18n",
|
||||
"django.core.context_processors.media",
|
||||
|
|
Loading…
Reference in New Issue
Block a user