vingerha / gtfs2

Support GTFS in Home Assistant GUI-only
https://github.com/vingerha/gtfs2
MIT License
78 stars 7 forks source link

[FEATURE]: Non-zip GTFS-RT data #106

Closed hjri closed 3 days ago

hjri commented 3 days ago

Describe the solution you'd like Add option to make addon skip unzipping if data is presented as raw.

Additional context HSL (helsinki public transport) provides GTFS-RT in raw format - https://hsldevcom.github.io/gtfs_rt/ but addon still treats file as zip, tries to extract it and fails

vingerha commented 3 days ago

Hi, if the source is proper json then it does not extract...at least, it should not do that. How do you come to the conclusion that it does file/zip extraction?

EDIT: sorry, just noticed that this source is GTFS format

vingerha commented 3 days ago

As this was a longer time ago, did a quick check with my own sources and this is the same. It needs to download the file and then decompile it to readable data (json), no way around that. What is the error, i.e. you say it fails? Rin in debug mode or use the service/action to download it with ticking to create a readable format, that will add a json file... if the source is correct along the external libraries I use

hjri commented 3 days ago

I've spent some hours debugging it to figure out what's wrong, it says not a zip file.

URL used is https://realtime.hsl.fi/realtime/trip-updates/v2/hsl and it gives raw GTFS-RT file which is binary (protobuf)

also side note - addon doesn't clean after itself if any error happens, i.e. _temp.zip file remains and attempts to re-configure it anew fail because it thinks archive is still being extracted.

vingerha commented 3 days ago

No clue what you are doing, this is realtime datasource and has to be added to an existing static datasource .... there is no and never has been a zipfile for realtime data. And yes...if you add wrong sources...the integration can not clean. Not planning to resolve all exceptions as you understand (or only at high pay) :)

vingerha commented 3 days ago

Added...I checked with the action/service and the data is extracted fine in a json...whether it matches your statics data is a different matter