Use IDFM website instead of official API

This commit is contained in:
nemunaire 2022-10-23 00:13:02 +02:00
commit c458a32d7b
4 changed files with 195 additions and 134 deletions

View file

@ -82,6 +82,16 @@ func convertLineType(old string) string {
}
}
func searchLine(t, code string) string {
for _, line := range IDFMLines {
if line.Fields.ShortName == code && (line.Fields.TransportMode == t || line.Fields.NetworkName == t) {
return line.Fields.IdLine
}
}
return code
}
func declareLinesRoutes(router *gin.RouterGroup) {
router.GET("/lines", func(c *gin.Context) {
var modes []string
@ -121,10 +131,10 @@ func declareLinesRoutes(router *gin.RouterGroup) {
}
pgline := PGLine{
Code: fmt.Sprintf("STIF:Line::%s:", line.Fields.IdLine),
Code: line.Fields.ShortName,
Name: name,
Directions: "",
Id: line.Fields.IdLine,
Id: fmt.Sprintf("STIF:Line::%s:", line.Fields.IdLine),
}
lines = append(lines, pgline)