Use IDFM website instead of official API
This commit is contained in:
parent
259b78ebd3
commit
c458a32d7b
4 changed files with 195 additions and 134 deletions
14
api/lines.go
14
api/lines.go
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue