J-Lindvig / Bibliotek_dk

Custom integration for Home Assistant, scraping loaner status from public libraries in Denmark
GNU General Public License v3.0
9 stars 5 forks source link

Sort fails if loan does not have an expiry date #3

Closed larsalthof closed 9 months ago

larsalthof commented 1 year ago

When a loan does not have an expiry date, the variable defaults to "None", which can't be sorted. Line 184 in library_api.py. Most likely the same will happen in line 194. Problem is seen with audiobooks on eReolen.

image

Suggest to default the dates to a 100 years in the future or something ridiculous.

larsalthof commented 1 year ago

Ok, so this looks like it is simple. I can turn this on and off by making a reservation on eReolen and then removing it. I too think it is a little strange that you have to reserve some materials on an electronic platform

larsalthof commented 1 year ago

Ah, reservations on eReolen have an "expected-date"

image
larsalthof commented 1 year ago

This little hack in "fetchLoans" prevents the error, but does not make reservations work for eReolen

image
larsalthof commented 1 year ago

Going through the HTML reveals that it is possible to find the right type of data. The the panels are called the same whether on a single page or separate pages.. eReolen:

image

bibliotek.dk:

image image
larsalthof commented 10 months ago

7 removes the crash, but does not make e-reservations functional