Menturan / MMM-OpeningHours

Magic Mirror module that displays places opening hours.
GNU General Public License v3.0
12 stars 3 forks source link

Support for OpenStreetMap opening_hours #24

Open arthurlutz opened 2 years ago

arthurlutz commented 2 years ago

I'm sorry if this is totally out of topic, feel free to shut this issue if this is the case.

I'm looking for the functionality of this plugin but without using google's data or API. I'd be interested in extracting the data from the OSM geographical database https://www.openstreetmap.org/ In OSM the opening_hours tag is documented here : https://wiki.openstreetmap.org/wiki/Key:opening_hours and I have found a javascript library which could be of some help to add support here (or a separate plugin) : https://github.com/AMDmi3/opening_hours.js

Does that seem feasible ? reasonable ? a completely different plugin ? does it already exist elsewhere ?

I'd be happy to help out but have little skills in javascript, and no idea (yet) on how much time I'd be ready to put into this (I've just started building a mirror, so not sure yet).

Thanks for your feedback.

arthurlutz commented 2 years ago

The maintained version is https://www.npmjs.com/package/opening_hours and it's git repo : https://github.com/opening-hours/opening_hours.js

Menturan commented 2 years ago

I think it sounds like a great idea!

The config could be something like this:

config: {
    googleApi: {
        apiKey: "XXXXXXXXXXXXXX",
        places: ["xxxxxxxx", ["yyyyyyyy", "Alias y"]]
        }
    openstreetmap:{
        places: ["xxxxxxxx", ["yyyyyyyy", "Alias y"]]
        },
    styling: {
          size: 'small'
        }
    }

It would break the current config but it shouldn't be so hard to make the code backward compatible and display a warning.

I would really appreciate if you could give it a try and make a pull request. :+1: I don't know when I have the time to fix this.

arthurlutz commented 2 years ago

Glad you like the idea, and thanks for the feedback. I'll look into it, and will try to submit some changes.