cubehouse / themeparks

Unofficial API for accessing ride wait times and schedules for Disneyland, Disney World, Universal Studios, and many more parks
MIT License
542 stars 125 forks source link

Thanks #139

Closed matounet51 closed 5 years ago

matounet51 commented 5 years ago

Hi!

I'm a french user, so... sorry for my bad english!

I use your library for my own app and site. You can see the site here - D-land.fr and the App on Google Playstore (App name is Dland).

For the app, I have a problem... How can I use the library to integrate waits directly in android? My app use webview to my website...

tpxtron commented 5 years ago

I would build my own API for the app. Use the node code from this project to pull the data, (cache it, if necessary, ) and offer the data as JSON data on a (hidden) REST Route on your website instead of HTML code. On the other hand, you can go ahead and try to understand the code for DLP and translate it to Android Java, which is not such a big deal. I had a short look on the DLP code and it is quite complicated (at least compared to e.g. Europa Park), you need to generate Access Tokens and stuff... Therefore I would take the detour using an API on the website for the app to fetch data.

cubehouse commented 5 years ago

Thank you @tpxtron for the reply. What you say is pretty bang on correct.

You need to have a web server running somewhere that will fetch updated data at regular intervals (say, 10 minutes) and store these locally (in memory, a redis store, SQL, whatever takes your fancy). Then build an basic API that returns the last stored value when called so your website and app can display them.

You may find that the JSON object the library returns is already all you need and you can save/return that as it is, but I suspect you'll want to massage it into your own data format that will suit your application better.

Personally, I have a private app I use myself for my vacations that does a bunch of compression and binary diffing on the data (to try and cope with the poor roaming network conditions), injects things like park temperature and other potentially useful information. You want this to always run and digest information over time. You don't want to make requests to the library every single time your API is called, as if you get a lot of users, you'll be making an awful lot of wasted requests that will slow down your application.