Compare commits
2 Commits
3e39c5e5c0
...
9238097b41
Author | SHA1 | Date | |
---|---|---|---|
9238097b41 | |||
e648d083f8 |
@ -97,6 +97,10 @@ func convertLineType(old string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func convertLineCode(code string) string {
|
||||||
|
return strings.TrimPrefix(strings.TrimSuffix(code, ":"), "STIF:Line::")
|
||||||
|
}
|
||||||
|
|
||||||
func searchLine(t, code string) string {
|
func searchLine(t, code string) string {
|
||||||
if t == "rer" {
|
if t == "rer" {
|
||||||
for _, line := range IDFMLines {
|
for _, line := range IDFMLines {
|
||||||
|
@ -79,13 +79,10 @@ type IDFMRealTime struct {
|
|||||||
|
|
||||||
type PGSchedule struct {
|
type PGSchedule struct {
|
||||||
Destination string `json:"destination"`
|
Destination string `json:"destination"`
|
||||||
|
Mission string `json:"mission,omitempty"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertLineCode(code string) string {
|
|
||||||
return strings.TrimSuffix(code, ":")
|
|
||||||
}
|
|
||||||
|
|
||||||
func getRealTime(code string, stations []string) ([]IDFMMonitoredStopVisit, error) {
|
func getRealTime(code string, stations []string) ([]IDFMMonitoredStopVisit, error) {
|
||||||
rurl, err := url.JoinPath(IDFM_BASEURL, "stop-monitoring")
|
rurl, err := url.JoinPath(IDFM_BASEURL, "stop-monitoring")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -176,9 +173,19 @@ func declareSchedulesRoutes(router *gin.RouterGroup) {
|
|||||||
|
|
||||||
pgs := []PGSchedule{}
|
pgs := []PGSchedule{}
|
||||||
for _, vehicule := range schedules {
|
for _, vehicule := range schedules {
|
||||||
msg := vehicule.MonitoredVehicleJourney.MonitoredCall.ExpectedDepartureTime.String()
|
var msg string
|
||||||
|
var mission string
|
||||||
|
|
||||||
if t == "metro" || t == "bus" || t == "noctiliens" || t == "tramway" {
|
if vehicule.MonitoredVehicleJourney.MonitoredCall.DepartureStatus != "onTime" {
|
||||||
|
log.Println("DepartureStatus =", vehicule.MonitoredVehicleJourney.MonitoredCall.DepartureStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
if t == "rail" {
|
||||||
|
msg = vehicule.MonitoredVehicleJourney.MonitoredCall.ExpectedDepartureTime.Format("15:04")
|
||||||
|
if len(vehicule.MonitoredVehicleJourney.JourneyNote) > 0 {
|
||||||
|
mission = vehicule.MonitoredVehicleJourney.JourneyNote[0].Value
|
||||||
|
}
|
||||||
|
} else if t == "metro" || t == "bus" || t == "noctiliens" || t == "tramway" {
|
||||||
if vehicule.MonitoredVehicleJourney.MonitoredCall.VehicleAtStop {
|
if vehicule.MonitoredVehicleJourney.MonitoredCall.VehicleAtStop {
|
||||||
if t == "metro" {
|
if t == "metro" {
|
||||||
msg = "Train à quai"
|
msg = "Train à quai"
|
||||||
@ -194,10 +201,13 @@ func declareSchedulesRoutes(router *gin.RouterGroup) {
|
|||||||
} else {
|
} else {
|
||||||
msg = fmt.Sprintf("%d mn", int(math.Floor(time.Until(vehicule.MonitoredVehicleJourney.MonitoredCall.ExpectedDepartureTime).Minutes())))
|
msg = fmt.Sprintf("%d mn", int(math.Floor(time.Until(vehicule.MonitoredVehicleJourney.MonitoredCall.ExpectedDepartureTime).Minutes())))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
msg = vehicule.MonitoredVehicleJourney.MonitoredCall.ExpectedDepartureTime.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
pgs = append(pgs, PGSchedule{
|
pgs = append(pgs, PGSchedule{
|
||||||
Destination: vehicule.MonitoredVehicleJourney.MonitoredCall.DestinationDisplay[0].Value,
|
Destination: vehicule.MonitoredVehicleJourney.MonitoredCall.DestinationDisplay[0].Value,
|
||||||
|
Mission: mission,
|
||||||
Message: msg,
|
Message: msg,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user