Throw out station IDs in connection display by default

This commit is contained in:
Klaus-Uwe Mitterer 2017-09-25 22:27:33 +02:00
parent a6ff5fe157
commit 85dc66aed3

View file

@ -80,7 +80,11 @@ class Service:
out = " " * indent + "<service%s>\n" % ("" if iid is False else " id=\"%i\"" % iid)
out += (" " * indent + " <name>%s</name>\n" % self.name) if name else ""
out += (" " * indent + " <destination>%s</destination>\n" % self.dest.name) if dest and self.dest else ""
if dest and self.dest:
out += " " * indent + " <destination>\n"
out += self.dest.xml(indent + 2, **stationkwargs) + "\n"
out += " " * indent + " </destination>\n"
if depst or deptime or deppf or currdep:
out += " " * indent + " <departure>\n"
@ -119,7 +123,10 @@ class Service:
out += (" " * indent + " \"@id\": %i,\n" % iid) if iid is not False else ""
out += (" " * indent + " \"name\": \"%s\",\n" % self.name) if name else ""
out += (" " * indent + " \"destination\": \"%s\",\n" % self.dest.name) if dest and self.dest else ""
if dest and self.dest:
out += " " * indent + " \"destination\":\n"
out += self.dest.json(indent + 2, **stationkwargs) + ",\n"
if depst or deptime or deppf or currdep:
dep = " " * indent + " \"departure\": {\n"
@ -220,7 +227,7 @@ class Connection:
def changes(self):
return max(len([service for service in self.services if service.name != "Walk"]) - 1, 0) if self.details else max(len([service for service in self.services[0].name.split("/") if service != "Walk"]) - 1, 0)
def xml(self, indent = 0, cid = False, frm = True, to = True, deptime = True, arrtime = True, duration = True, changes = True, services = True, servicekwargs = {}, stationkwargs = {}):
def xml(self, indent = 0, cid = False, frm = True, to = True, deptime = True, arrtime = True, duration = True, changes = True, services = True, servicekwargs = {"stationkwargs": {"extid": False}}, stationkwargs = {"extid": False}):
out = " " * indent + "<connection%s>\n" % ("" if cid is False else " id=\"%i\"" % cid)
if frm:
@ -265,7 +272,7 @@ class Connection:
return out
def json(self, indent = 0, cid = False, frm = True, to = True, deptime = True, arrtime = True, duration = True, changes = True, services = True, servicekwargs = {}, stationkwargs = {}):
def json(self, indent = 0, cid = False, frm = True, to = True, deptime = True, arrtime = True, duration = True, changes = True, services = True, servicekwargs = {"stationkwargs": {"extid": False}}, stationkwargs = {"extid": False}):
out = " " * indent + "{\n"
out += (" " * indent + " \"@id\": %i,\n" % cid) if cid is not False else ""