Author: Adam <git@apiote.xyz>
support duplicated feeds in findValidVersions
traffic/feeds.go | 6 +++++- traffic/gzm_ztm.go | 10 +++++-----
diff --git a/traffic/feeds.go b/traffic/feeds.go index 1a7e3268e2e481f3f5af1538a692d7a968361a07..b7f05884a8d7f2e11139e7d96bd2d56fefd5e278 100644 --- a/traffic/feeds.go +++ b/traffic/feeds.go @@ -177,7 +177,11 @@ } i++ } } else { - // NOTE unsupported + if i < len(versions) { + left = versions[i] + lastInResult = false + } + i++ } } if !lastInResult { diff --git a/traffic/gzm_ztm.go b/traffic/gzm_ztm.go index c407b3050e121198212a86d898fd95935ce349dc..082f6a58b09d29876f7bbf45cc5d8acdee6bda8f 100644 --- a/traffic/gzm_ztm.go +++ b/traffic/gzm_ztm.go @@ -44,22 +44,22 @@ regex, err := regexp.Compile("https://otwartedane.metropoliagzm.pl/dataset/86b5ce0c-daea-4b40-bc60-af2c80477d21/resource/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/download/schedule_([0-9]{4}).([0-9]{2}).([0-9]{2})_[0-9]{13}_[0-9]{4}.ext_gtfs.zip") urls := regex.FindAllStringSubmatch(string(doc), -1) - versionsMap := map[string]struct{}{} + // versionsMap := map[string]struct{}{} versions := []Version{} for _, u := range urls { if u[1] < "2024" { continue } - if _, ok := versionsMap[u[1]+u[2]+u[3]]; ok { - continue - } + // if _, ok := versionsMap[u[1]+u[2]+u[3]]; ok { + // continue + // } version, err := MakeVersionTimezone(u[1]+u[2]+u[3]+"_99991231", timezone) if err != nil { return nil, err } version.Link = u[0] versions = append(versions, version) - versionsMap[u[1]+u[2]+u[3]] = struct{}{} + // versionsMap[u[1]+u[2]+u[3]] = struct{}{} } return versions, nil }