rezemika / humanized_opening_hours

A parser for the opening_hours fields from OpenStreetMap
GNU Affero General Public License v3.0
26 stars 20 forks source link

Alternate week_description() returning a list #37

Closed raphodn closed 4 years ago

raphodn commented 4 years ago

Hello ! Thanks for creating this package :)

I was slightly surprised that oh.description() returned a list, but oh.plaintext_week_description() returned a string using \n. Is there a historical reason or issue for that ? Would you be ok if I considered doing a PR to add oh.week_description() that returns a list ? (and why not oh.plaintext_description() that returned a string using \n - and you could even push it by choosing the delimiter)

Anyway I know I can also just simply do oh.plaintext_week_description().split("\n") so I'm using it like this for now :)

Sorry for the bother

rezemika commented 4 years ago

Hello! Thank you for your issue and your interest!

However, I must warn you that this package is not maintained anymore for now (it may be updated in the future, but I don't have any date). Of course you can use it and modify it as you wish, but I don't have so many time and energy to spend, unfortunately.

In fact, one of the major problems of HOH's implementation is that it's very difficult to properly parse something like an opening_hours field, because it has so many complicated specifications. Mo-Th 09:00-19:00 is a valid field, as well as Mo+ open or 2020-2021 Jan-Feb Sa[2,3] dawn-(dusk+01:30) "on appointement". To make a parser that can handle all these fields is a very hard task, and that is the main reason I quite gave up...

I looked in the code and in my memory, and the reason for that is both an historical reason and an error. This method was written for one of the very first versions of HOH, and it was more a utility to check if the field was correctly parsed. Also, as I used HOH for very simple purposes, I used this method directly at the time. When the description() method was added, I quite forgot it because description() was way more powerful and versatile. I left it mainly for backward compatibility.

You can do a PR for that. However, I'm not very satisfied the way HOH works. It could be so much better and optimized, I would be a little ashamed to continue on this way. I think it would deserve a new rewriting, and it would probably be a good idea to give up to parse all the types of fields. So, I would prefer not to publish a new version on PyPi for now, to draw attention on the fact that HOH is not very maintained for now.

raphodn commented 4 years ago

Hey, thank you for your long reply. I've gotten back to parsing and using opening_hours, I'll see what I can do and if I feel the need to make some improvements to the package :)

rezemika commented 4 years ago

It's okay, good luck to you! :)