69 lines
1.4 KiB
Python
69 lines
1.4 KiB
Python
|
class Station:
|
||
|
def __init__(self, name, sttype, extid = None, xcoord = None, ycoord = None, prodclass = None):
|
||
|
self.name = name
|
||
|
self.sttype = stype
|
||
|
self.extid = extid
|
||
|
self.xcoord = xcoord
|
||
|
self.ycoord = ycoord
|
||
|
self.prodclass = prodclass
|
||
|
|
||
|
class Service:
|
||
|
def __init__(self, name, svtype, depst, deptime, arrst, arrtime, deppf = None, currdep = None, arrpf = None, curarr = None, img = None, url = None):
|
||
|
self.name = name
|
||
|
self.svtype = svtype
|
||
|
self.depst = depst
|
||
|
self.deptime = deptime
|
||
|
self.arrst = arrst
|
||
|
self.arrtime = arrtime
|
||
|
self.deppf = deppf
|
||
|
self.currdep = currdep
|
||
|
self.arrpf = arrpf
|
||
|
self.curarr = curarr
|
||
|
self.img = img
|
||
|
self.url = url
|
||
|
|
||
|
class Connection:
|
||
|
def __init__(self, buyurl = None, statusurl = None):
|
||
|
self.services = []
|
||
|
self.buyurl = buyurl
|
||
|
self.statusurl = statusurl
|
||
|
|
||
|
def addService(self, service):
|
||
|
self.services.append(service)
|
||
|
|
||
|
def depst(self):
|
||
|
try:
|
||
|
return self.services[0].depst
|
||
|
except:
|
||
|
return None
|
||
|
|
||
|
def arrst(self):
|
||
|
try:
|
||
|
return self.services[-1].arrst
|
||
|
except:
|
||
|
return None
|
||
|
|
||
|
def deptime(self):
|
||
|
try:
|
||
|
return self.services[0].deptime
|
||
|
except:
|
||
|
return None
|
||
|
|
||
|
def arrtime(self):
|
||
|
try:
|
||
|
return self.services[-1].arrtime
|
||
|
except:
|
||
|
return None
|
||
|
|
||
|
def currdep(self):
|
||
|
try:
|
||
|
return self.services[0].currdep
|
||
|
except:
|
||
|
return None
|
||
|
|
||
|
def currarr(self):
|
||
|
try:
|
||
|
return self.services[-1].currarr
|
||
|
except:
|
||
|
return None
|