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

Compatibility with multi-page plans #10

Closed
3liFi opened this issue Dec 29, 2021 · 4 comments
Closed

Compatibility with multi-page plans #10

3liFi opened this issue Dec 29, 2021 · 4 comments
Labels
bug Something isn't working dsb Relates to the `dsb` package that deals with DSBMobile. untis Relates to the `untis` package that deals with Untis parsing.

Comments

@3liFi
Copy link

3liFi commented Dec 29, 2021

Only the first page of the table seems to be processed properly. All the substitutions belonging to the page circled in green show up, the red ones do not.
response
.

The result of getAllData()
grafik

@pixelcmtd
Copy link
Member

That's actually on purpose, because all timetable JSONs I ever had the chance of looking at didn't have multiple Childs.
For example, using the public credentials (accemus -j 187801 public | jq .):

[
  {
    "Id": "c9fb6314-cda8-4c4c-93fe-328580dc3502",
    "Date": "31.03.2020 17:18",
    "Title": "Homeschooling-Stundenplan",
    "Detail": "",
    "Tags": "",
    "ConType": 2,
    "Prio": 0,
    "Index": 0,
    "Childs": [
      {
        "Id": "c9fb6314-cda8-4c4c-93fe-328580dc3502_76",
        "Date": "31.03.2020 17:18",
        "Title": "Homeschooling-Stundenplan",
        "Detail": "https://light.dsbcontrol.de/DSBlightWebsite/Data/13ccccbb-e6a8-466a-addc-00bba830c6cf/c9fb6314-cda8-4c4c-93fe-328580dc3502/c9fb6314-cda8-4c4c-93fe-328580dc3502_000.jpg",
        "Tags": "",
        "ConType": 4,
        "Prio": 0,
        "Index": 76,
        "Childs": [],
        "Preview": "13ccccbb-e6a8-466a-addc-00bba830c6cf/c9fb6314-cda8-4c4c-93fe-328580dc3502/c9fb6314-cda8-4c4c-93fe-328580dc3502_000.jpg"
      }
    ],
    "Preview": ""
  }
]

The same holds true for GymPeg plans: The elements of the outer list represent plans, the Childs just consists of one element containing all the actually relevant information.

Could you please outline, how yours looks? Are the Childs plans now? What are the outer elements?

@3liFi
Copy link
Author

3liFi commented Dec 30, 2021

Hmm, I see. In my case the outer Element also represents a plan, while the Childs hold all the data. However the data is spread out over numerous Child elements. Every Child represents one page of the plan. I guess in my case it would be necessary for this function to not only use p['Childs'][0], but every element in p['Childs']; something like p['Childs'][i], where i iterates through all Childs.

Iterable<DownloadingPlan> downloadPlans(
    List json, {
    bool downloadPreviews = false,
  }) =>
      json.map((p) => p['Childs'][0]).map((p) => DownloadingPlan(
          p['Detail'],
          p['Preview'],
          http.get(p['Detail'],
              ttl: Duration(days: 4),
              defaultCharset: (x) => String.fromCharCodes(x)),
          downloadPreviews
              ? http.getBin('$previewEndpoint/${p['Preview']}')
              : null));

The login info I used is generally considered public, so if you want to replicate it yourself: username: "152321" password: "krsmrz21".

pixelcmtd added a commit that referenced this issue Dec 31, 2021
@pixelcmtd
Copy link
Member

pixelcmtd commented Dec 31, 2021

Ok, I think I understand everything now. 7.1.1 mitigates this by making every "page" its own Plan. While this is not the right behavior, it overcomes the biggest problem, missing data, without breaking the API. A good fix will take a while. Also: Your plans, despite being Untis 2021, are very differently formatted than any other plans I have ever seen. I already have an idea for making the plan parser work.

By the way: Another interesting problem is the info field at the top of the first page of these plans. I hope, I can also get parser support for them working as well.

@pixelcmtd pixelcmtd changed the title only first page of plan loaded Compatibility with multi-page plans and different formatting Dec 31, 2021
@pixelcmtd pixelcmtd added dsb Relates to the `dsb` package that deals with DSBMobile. untis Relates to the `untis` package that deals with Untis parsing. bug Something isn't working labels Mar 8, 2022
pixelcmtd added a commit that referenced this issue Mar 23, 2022
i spent the last weeks splitting up dsbuntis (#11)
it works fine, and multi-page plans are now fully supported in dsb (#10)
@pixelcmtd pixelcmtd changed the title Compatibility with multi-page plans and different formatting Compatibility with multi-page plans Apr 8, 2022
@pixelcmtd
Copy link
Member

#13 is now concerned with extending the compatibility across different orderings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dsb Relates to the `dsb` package that deals with DSBMobile. untis Relates to the `untis` package that deals with Untis parsing.
Projects
None yet
Development

No branches or pull requests

2 participants