Changement codes lignes
This commit is contained in:
38
tcl.py
38
tcl.py
@@ -125,7 +125,7 @@ class Tcl(Plugin):
|
|||||||
ATTENTTION : Le bot ne vérifie pas que la ligne existe
|
ATTENTTION : Le bot ne vérifie pas que la ligne existe
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
url = 'https://download.data.grandlyon.com/ws/rdata/tcl_sytral.tclalertetrafic_2/all.json?maxfeatures=300&start=1'
|
url = 'https://data.grandlyon.com/fr/datapusher/ws/rdata/tcl_sytral.tclalertetrafic_2/all.json?maxfeatures=300&start=1'
|
||||||
resp = await self.http.get(url, headers={'Authorization' : 'Basic ' + base64string.decode('utf-8')})
|
resp = await self.http.get(url, headers={'Authorization' : 'Basic ' + base64string.decode('utf-8')})
|
||||||
ans = await resp.text()
|
ans = await resp.text()
|
||||||
try:
|
try:
|
||||||
@@ -190,13 +190,12 @@ class Tcl(Plugin):
|
|||||||
nomArret = ""
|
nomArret = ""
|
||||||
for value in values:
|
for value in values:
|
||||||
if value["nom"].lower() == arret[0]:
|
if value["nom"].lower() == arret[0]:
|
||||||
|
self.log.info(value["id"])
|
||||||
nomArret = value["nom"]
|
nomArret = value["nom"]
|
||||||
Ids.append(value["id"])
|
Ids.append(value["id"])
|
||||||
|
|
||||||
|
url ='https://data.grandlyon.com/fr/datapusher/ws/rdata/tcl_sytral.tclpassagearret/all.json?maxfeatures=30000&start=1'
|
||||||
url = 'https://download.data.grandlyon.com/ws/rdata/tcl_sytral.tclpassagearret/all.json?maxfeatures=30000&start=1'
|
|
||||||
respText = "### Prochains départs " + nomArret + " :\n"
|
respText = "### Prochains départs " + nomArret + " :\n"
|
||||||
self.log.info(respText)
|
|
||||||
lines = []
|
lines = []
|
||||||
while len(url) > 0:
|
while len(url) > 0:
|
||||||
resp = await self.http.get(url, headers={'Authorization' : 'Basic ' + base64string.decode('utf-8')})
|
resp = await self.http.get(url, headers={'Authorization' : 'Basic ' + base64string.decode('utf-8')})
|
||||||
@@ -216,20 +215,37 @@ class Tcl(Plugin):
|
|||||||
for value in values:
|
for value in values:
|
||||||
if value["id"] in Ids:
|
if value["id"] in Ids:
|
||||||
# Les metros ont leur propre code
|
# Les metros ont leur propre code
|
||||||
if value["coursetheorique"].split('-')[0] == "301A" :
|
code = value["coursetheorique"].split('_')[0]
|
||||||
|
if code == "301" :
|
||||||
transport = "A"
|
transport = "A"
|
||||||
elif value["coursetheorique"].split('-')[0] == "303" :
|
elif code == "303" :
|
||||||
transport = "C"
|
transport = "C"
|
||||||
elif value["coursetheorique"].split('-')[0] == "325" :
|
elif code == "325" :
|
||||||
transport = "F1"
|
transport = "F1"
|
||||||
elif value["coursetheorique"].split('-')[0] == "326" :
|
elif code == "326" :
|
||||||
transport = "F2"
|
transport = "F2"
|
||||||
elif value["coursetheorique"].split('-')[0] == "304" :
|
elif code == "304" :
|
||||||
transport = "D"
|
transport = "D"
|
||||||
elif value["coursetheorique"].split('-')[0] == "302A" :
|
elif code == "302" :
|
||||||
transport = "B"
|
transport = "B"
|
||||||
|
elif code == "520" :
|
||||||
|
transport = "T1"
|
||||||
|
elif code == "530" :
|
||||||
|
transport = "T2"
|
||||||
|
elif code == "540" :
|
||||||
|
transport = "T3"
|
||||||
|
elif code == "550" :
|
||||||
|
transport = "T4"
|
||||||
|
elif code == "570" :
|
||||||
|
transport = "T5"
|
||||||
|
elif code == "590" :
|
||||||
|
transport = "T6"
|
||||||
|
elif code == "510" :
|
||||||
|
transport = "T7"
|
||||||
|
elif code.isdigit() and int(code) >= 900:
|
||||||
|
transport = "C" + str(int(code) - 900)
|
||||||
else:
|
else:
|
||||||
l = value["coursetheorique"].split('-')[0]
|
l = value["coursetheorique"].split('_')[0]
|
||||||
if l[-1:].isdigit():
|
if l[-1:].isdigit():
|
||||||
transport = l
|
transport = l
|
||||||
else:
|
else:
|
||||||
|
|||||||
51162
tcl_sytral.tclarret.json
51162
tcl_sytral.tclarret.json
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user