djbrown / spielerplus-calendar

1 stars 1 forks source link

Parsing error multi day events #7

Closed odin568 closed 1 year ago

odin568 commented 1 year ago

Hi @djbrown For one event, I get a parsing error. The reason might be it was a multi-day event?

Details:

Could not parse event list item:
invalid literal for int() with base 10: '00 am 17.07.'
Traceback (most recent call last):
  File "/app/spielerplus_calendar/parsing.py", line 39, in parse_event_list_items
    events.append(_parse_event_list_item(item))
  File "/app/spielerplus_calendar/parsing.py", line 60, in _parse_event_list_item
    end = _parse_end(item, begin)
  File "/app/spielerplus_calendar/parsing.py", line 103, in _parse_end
    (end_hour, end_minutes) = (int(end_hour_text), int(end_minutes_text))
ValueError: invalid literal for int() with base 10: '00 am 17.07.'
b'<div class="list event">\n        <div class="panel" id="event-event-1106819">\n                    <div class="panel-heading ">\n            <a class="event-header-border" href="/event/view?id=1106819"></a>\n            <div class="panel-heading-info">\n                <div class="panel-title">Sa.</div><div class="panel-subtitle">16.07 </div>\n            </div>\n\n            <div class="panel-heading-text">\n                <div class="panel-title">Abschlussfeier mit &#220;bernachtung </div>\n                \n            </div>\n\n            <div class="panel-drilldown">\n                \n                <i id="w0" class="fa-drilldown sp fa-sm" style="color: #FFFFFF;"></i>\n            </div>\n            <img class="bg" src="//assets.spielerplus.de/assets/22126a30971e28255886e108619ddfa820dc/images/assets/panel_background_darkgreen_soccer.jpg" alt="">\n        </div>            <div class="panel-content">\n                        <div class="event-time">\n            <div class="col-xs-4">\n                <div class="event-time-item">\n                    <div class="event-time-label">Treffen</div><div class="event-time-value">-:-</div>\n                </div>\n            </div>\n            <div class="col-xs-4">\n                <div class="event-time-item">\n                    <div class="event-time-label">Beginn</div><div class="event-time-value">17:00</div>\n                </div>\n            </div>\n            <div class="col-xs-4">\n                <div class="event-time-item">\n                    <div class="event-time-label">Ende</div><div class="event-time-value">13:00 am 17.07.</div>\n                </div>\n            </div>\n        </div>\n\n\n<!-- CARPOOL USAGE -->\n\n\n<!-- ASSIGNMENTS -->\n\n\n<!-- TOURNAMENT -->\n\n<!-- FITNESS USAGE -->\n\n\n                <!-- EVENT COUNTDOWN -->\n                <div class="list-item small countdown red"><div class="list-icon size-16"><i id="w1" class="fa-countdown sp fa-fw fa-sm" style="color: #D63636;"></i></div><span id="sp-event-countdown-1106819">Zeit zum Zu-/Absagen abgelaufen</span></div>            </div>\n            <div class="participation-flex">\n                <!-- EVENT PARTICIPATION -->\n                <div class="participation-widget participation-widget-event-1106819" style="position:relative; display: inline-block;"><div class="btn-group participation-widget-buttons"><button type="button" class="participation-button selected" disabled title="Zugesagt" style="background-color: #87ce7d; color:white" onclick=\'showParticipationForm("event", 1106819, 1, 6440999)\'><i id="w2" class="fa-participation-yes sp fa-fw fa-lg" style="color: #FFFFFF;"></i><div class="participation-number">16</div></button><button type="button" class="participation-button" disabled title="Unsicher" style="background-color: #fff; color:dark-grey" onclick=\'showParticipationForm("event", 1106819, 2, 6440999)\'><i id="w3" class="fa-participation-maybe sp fa-fw fa-lg" style="color: #535353;"></i><div class="participation-number">0</div></button><button type="button" class="participation-button" disabled title="Absagen / Abwesend" style="background-color: #fff; color:dark-grey" onclick=\'showParticipationForm("event", 1106819, 0, 6440999)\'><i id="w4" class="fa-participation-no sp fa-fw fa-lg" style="color: #535353;"></i><div class="participation-number">0</div></button></div></div>                <button type="button" class="participants-button" title="Teilnehmer anzeigen" onclick=\'showParticipation("event",1106819)\'><i id="w5" class="fa-nav-members sp fa-fw fa-2x" style="color: #44AD34;"></i></button>            </div>\n        </div>\n    </div>\n'
djbrown commented 1 year ago

@odin568 thanks for reporting this issue. I have had problems with a multi day event too, but thought the only problem was parsing the event year (see fix in 7c72e4a7a9869b790f48f80183f42bbe95040f20). For the event end time I believed it was just a singular free text problem which wouldn't be worth fixing. My previous workaround was to improve error handling, so parsing errors on a single event won't fail the whole parsing procedure (see 98b6a53f16f89928e26a47407592184af94ad781). Maybe there is yet a good solution for this, I'll have a look.

odin568 commented 1 year ago

In this case, Generation failed completely with HTTP 500 but I will also recheck

djbrown commented 1 year ago

As of 98b6a53f16f89928e26a47407592184af94ad781, generation shouldn't fail completely anymore. Maybe you have to update your sources (git pull) or your image (docker pull djbrown/spielerplus-calendar)

Parsing multi day events should be fixed now. Can you confirm that it works for you?

odin568 commented 1 year ago

Ah, you are right. I see that my reverse proxy is killing the session after 1min :)