Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BVG: include Berlkönig #26

Closed
alexander-albers opened this issue Apr 7, 2021 · 2 comments
Closed

BVG: include Berlkönig #26

alexander-albers opened this issue Apr 7, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@alexander-albers
Copy link
Owner

BVG requires, for whatever reason, that the product type "BERLKOENIG" is included, or otherwise some trips may fail, even if those don't include any Berlkönig products.

See for example this request:

{
  "auth": {
    "aid": <secret>,
    "type": "AID"
  },
  "svcReqL": [
    {
      "meth": "TripSearch",
      "cfg": {},
      "req": {
        "arrLocL": [
          {
            "type": "S",
            "lid": "A=1@O=U Elsterwerdaer Platz (Berlin)@X=13560758@Y=52504644@U=86@L=900171006@B=1@p=1617247685@"
          }
        ],
        "getPolyline": true,
        "gisFltrL": [
          {
            "type": "M",
            "meta": "foot_speed_normal",
            "profile": {
              "linDistRouting": false,
              "maxdist": 2000,
              "type": "F"
            },
            "mode": "FB"
          }
        ],
        "depLocL": [
          {
            "lid": "A=1@O=Pilgramer Str./Rahnsdorfer Str. (Berlin)@X=13619395@Y=52496554@U=86@L=900176540@B=1@p=1617247685@",
            "type": "S"
          }
        ],
        "outFrwd": true,
        "outTime": "080000",
        "extChgTime": -1,
        "getPasslist": true,
        "trfReq": {
          "jnyCl": 2,
          "tvlrProf": [
            {
              "type": "E"
            }
          ],
          "cType": "PK"
        },
        "jnyFltrL": [
          {
            "value": "1111111111",
            "mode": "BIT",
            "type": "PROD"
          },
          {
      -->   "value": "BERLKOENIG",
            "mode": "INC",
            "type": "GROUP"
          }
        ],
        "outDate": "20210409"
      }
    }
  ],
  "ext": "BVG.1",
  "formatted": true,
  "lang": "de",
  "ver": "1.24",
  "client": {
    "id": "BVG",
    "type": "IPH",
  }
}

However, enabling this option leads to a new JNY-type named "KISS", which is currently not handled and results in a parse error.

--> Revert this commit after KISS is handled: b04f52c

@alexander-albers alexander-albers added the bug Something isn't working label Apr 7, 2021
@derhuerst
Copy link

hafas-client implementation:

https://github.com/public-transport/hafas-client/blob/92fb29d6875de870302a21ae68131361b8446fce/p/bvg/index.js#L65-L93

@alexander-albers
Copy link
Owner Author

When enabling the Berlkönig flag, always getting a Berlkönig trip as the very first trip result is probably very annoying, as it is often times way slower than taking a regular train/bus.
My new resolution is setting the following jnyFilterIncludes:

[
   ["value": "BERLKOENIG", "mode": "INC", "type": "GROUP"],
   ["value": "berlkoenig", "mode": "EXC", "type": "GISPROD"]
]

It might seem unnecessary to first enable the product and then disable it again right away, but this is also what the official BVG App does when disabling the product. The main advantage is that we still find all regular trips, like the trip mentioned above, while excluding Berlkönig products from the search results. Not including both flags would again lead to an error for the above mentioned trip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants