marunjar / anewjkuapp

GNU General Public License v3.0
16 stars 4 forks source link

refactor mensa parser #9

Open marunjar opened 10 years ago

marunjar commented 10 years ago
Nithanim commented 9 years ago

I realized that the oeh-parser has some annoyances and wrote one myself. It is still far from perfect but it could be worth the effort. http://mensaapi.nithanim.me/v1/mensa.json It has the benefit that it already produces less errors than the oeh-parser and if it does it is easy to redeploy it with a fix instead of having to change the app again. Additionally it only uses one http request to load all mensas and has a built in functionality for etag so that the server can return 304 Not Modified.

I started to integrate it in the app with the current system but it seems a lot of code needs to be changed. I have yet to find out how to do that correctly.

Since it is still in development I would like to have some suggestions on how the data should be returned to be able to parse the json easily on the client. I will release the source to github as soon as it reaches an acceptable state.

marunjar commented 8 years ago

hi,

sry for not reacting, i should read this issues more often. at the moment khg and raab mensa are not working and i thought this is the perfect time to write my own parser.

having the parser decoupled from the app is really useful, especially if it's updated and maintained. it would be really cool if we can use your parser. i just had a look at the json and it looks good, a little similar to the oeh-parser s output, that shouldn't be hard to parse.

Nithanim commented 8 years ago

I have actually worked on implementing my api into your app but unfortunately the branch is a lot of commits behind. It is so far behind that your "little" refactoring is not included and I have not been able to merge it. (I even started over two times). Before I publish my work I still need to squash and polish it up a little beforehand. I have very little time at the moment as you might be able to imagine so it might take at least a couple of weeks to get that up. classic choice It is far from perfect, has multiple bugs but the basic integration is there :)

marunjar commented 8 years ago

indeed, there were some changes...

have you commited some changes already? if i can help in any way you just need to say it.

and it must not be perfect, it just has to work better than the oeh app parser ;) and :+1: for the choice view

Nithanim commented 8 years ago

I pushed my work to https://github.com/Nithanim/anewjkuapp/commit/78021c2a23fbb1efa84059499d30c02c459cf3a2. I honestly don't know the current state it is in because too much time has passed. I suspect that it is pretty bad code-wise because I just made it work. However, I think it is better to tidy and fix the bugs after the rebase. I believe that only you are able to rebase properly because you know best what you did (117 commits behind). Do you want to pull that directly from my repo or should I open a pull request (you need to create the target branch in this repo first). Or should we keep that in mime for now? Btw. Only classic an choice work and I deleted the DashClockExtension because I could not figure out how to test it, so we have to re-insert that later on.

Nithanim commented 8 years ago

If the rebase is too difficult, you can always choose to copy my sub-lib over and merge the gui by hand if that seems easier. Also, I am looking into a better way than relying on my private maven repo. I will most likely throw the dependencies into JCenter.

reisi007 commented 6 years ago

I'm unsure if it is known, but the Mensa ist not working ATM for me

Nithanim commented 6 years ago

I think that the mensa is broken for quite some time now. Sadly, I was unable to to merge the changes and my own parser broke every so often. However, I built a new parser but it is still not public yet and only supports the jku mensa and not the others. An interface is available on telegram as jkumensabot. I would be fine if anybody would like to integrate it in the JkuApp but I just can't really wrap my head around android development myself.

marunjar commented 6 years ago

mensa should work again with version 0.50.1, for now, ...

@Nithanim can this app use your interface? what should be done? at the moment i have some free time, so i can give it a try.

Nithanim commented 6 years ago

I finally managed to re-write the bot to support multiple different sources. Also I unified the data-structure that is used both internally and externally. I am sorry that it took so long! The api is held against java6 which should make it possible for you to use it directly. https://github.com/Nithanim/mensaapi Included is a pre-implemented de-serialization with https://github.com/stleary/JSON-java which looks at least similar to the one android used but it possibly is completely incompatible. The serialization provided is the same that my endpoint uses to generate the json.

My public endpoint is located at https://api.mensa.nithanim.me/ and serves exactly the same data as the telegram bot. Etag is supported to prevent unnecessary downloading and parsing. Please use an appropriate useragent.