-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement support for SLUB Dresden #553
Conversation
Oops, I guess I messed up my git log. I rebased my feat/SLUB-API branch onto the current master (to get the 'upgrade toolchain' commit because I locally already upgraded Kotlin too) and now all the commits that occurred meanwhile are included in this PR. How should I proceed from here? |
ac0792a
to
09c7d54
Compare
I'm not sure what you did, but git can be nasty at times ;) I pulled your branch, re-based it again properly (git rebase -i master, then resolved two pseudeo-conflicts) and force-pushed it back again. You can force-pull it, if you want (but if it's done, you don't need to), but before you do anything to your local history, please double-check I included all your changes ;) |
After a long pause I finally sorted it out to correctly rebase and update the PR without having all old history appended here (thanks to @raphaelm and this SO answer). Now I see the all new additions fail at CI with a long list of lint issues at Google Play Services Debug. Is this something I should worry about? As far as I can see none of them pertain to |
Great, thank you! The error in the Travis CI log seems to be:
so there is a failure in the SLUBTest. Maybe the parsing of |
Oops, I completely overlooked this one in the sheer stream of lint warnings. The reason seems to be |
Hmm, maybe
Well, you can let Travis CI output that file by adjusting the |
Thank you @johan12345, I solved this silly error of mine: I hardcoded the expected formatted date value in the test according to German style but it should have been formatted according to the current locale. So the code was OK, just the test was faulty. |
I quickly tested your API today and it already looks really good! A few tips regarding the remaining
|
Thanks for taking the time and testing the API.
Although I used my debug version for over a year now I still find occasional errors and I have a couple of commits still sitting on my hard disk and also some uncommitted work and tests mainly regarding item details. One question about cover images: the catalogue doesn't supply thumbnails but in some cases there are links to cover images, mainly at http://swbplus.bsz-bw.de but also at the editors' pages. The size of these images typically ranges from about 40 kB to 1MB. Do you think I should include these URLs given that the images could be rather big in some cases? (for items from Deutsche Fotothek the API supplies thumbnails and I use them.) I think I can finish the open issues by beginning of February so you can merge it and then I can complete any open items later. Lastly, from time to time I get leakage warnings (Dumping memory, app will freeze. Brrrr.) when I run the debug version on my phone. This is mainly after a new debug install, didn't get it later when running the app for a longer time. The strange thing is that I can't see further information in the Leaks app/icon on my phone anymore - it just says "Leaks in de.geeksfactory.opacclient.debug". This also happens if I don't query my account or search anything, so I guess this is more related to the app than to libopac. What couId I do here to narrow down the problem? |
Yeah, filterResults won't work in the FOSS app, the UI for that is only implemented in the Plus Edition. Most of the time, that is not such a big problem as fields such as media type are also available in the search form itself - but it seems that this is not the case in the SLUB OPAC. Maybe it would still be possible to add some of the filtering fields to the search form?
Hm, do you have some links with examples for this? Sometimes there are even URL parameters to specify the size of the cover (like with the Amazon cover server, which some OPACs use), but this doesn't sound like it is the case here.
Yes, that's possible: the ReservationResult res = new ReservationResult(MultiStepResult.Status.SELECTION_NEEDED);
res.setSelection(options);
res.setActionIdentifier(ReservationResult.ACTION_BRANCH);
return res
Hmm, interesting... If you push this change somewhere I can take a look, it doesn't sound like this is a general bug in the app.
That's probably not due to your changes - we added LeakCanary to the debug version of the app a long time ago but never had much time to further investigate the leaks that it is sometimes showing (and it wasn't a high priority as we never heard of any real issues arising from these). Sorry! |
One question about strings in libopac: most of the strings from |
The three strings that are in |
example of cover image: https://katalog.slub-dresden.de/id/0-81817546X/ with a 780 kB image
I pushed it to this PR as dde1bba. |
I tested my
It worked correctly and returned the following cancel result:
For the app I'd prefer however to be asked if I really want to cancel the reservation. Do I have to process the |
This API is specific for SLUB in Dresden.
for account, search result and detailed item
Format expected date value according to current locale (required for CI testing)
If the search yields exactly one result then the POST method doesn't return a JSON object but the html catalogue detail web site of this item. Using GET handles this case correctly (returns JSON with one item).
as requested at https://github.com/opacapp/opacclient/wiki
As of Jan 15, 2020, all account POST requests get redirected to the web catalogue login page and POST requests for all search requests get redirected to the html result pages of the web catalogue.
as the former became deprecated in JUnit 4.13
…into feat/SLUB-API � Conflicts: � opacclient/libopac/build.gradle � opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt � opacclient/libopac/src/main/java/de/geeksfactory/opacclient/i18n/StringProvider.java � opacclient/libopac/src/test/java/de/geeksfactory/opacclient/apis/SLUBTest.kt � opacclient/libopac/src/test/resources/slub/account/account.json � opacclient/opacapp/src/main/res/values-de/strings_api_errors.xml � opacclient/opacapp/src/main/res/values/strings_api_errors.xml
which is marked as private in androidx.preference:preference.
@johan12345 - regarding this last commit b5ea66f: |
Hm, that sounds like the string |
to prevent overriding '@string/copy' which is marked as private in androidx.preference:preference. This basically reverts commit b5ea66f and prevents the warning by renaming instead of marking the string as overriding.
@johan12345 thanks for the reply, I renamed it, see 3b7ca5e. |
I've been using with my debug version for over a year now without any problems, so I think you can review this PR for merging. All methods except for There are still some TODOs, but I don't feel like being able to close them in the next couple of weeks. I may get back to them later.
|
(lambda argument should be moved out of parentheses)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @StefRe! Thank you for your hard work on the SLUB API and sorry for taking so long for the review. Your implementation looks very good to me and it is also great that you added good tests - which is especially helpful as we don't have an account in the library to be able to test account features.
I have added a few minor comments below, most of which can probably be addressed very easily. I haven't compiled and tested it on a device yet, but will of course do so before merging.
I agree that the remaining TODOs are all not essential - for some of them I added comments below with suggestions on how they could be implemented (but that doesn't mean that it needs to be done before we merge this).
Could you also please rebase your branch against the current master? GitHub says there are some conflicts (shouldn't be anything too complicated, probably just a few additions to the strings XML files that we have done in the meantime).
opacclient/libopac/src/test/java/de/geeksfactory/opacclient/apis/SLUBTest.kt
Outdated
Show resolved
Hide resolved
opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
Show resolved
Hide resolved
opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
Show resolved
Hide resolved
opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
Outdated
Show resolved
Hide resolved
opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
Show resolved
Hide resolved
opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
Outdated
Show resolved
Hide resolved
opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
Show resolved
Hide resolved
opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
Outdated
Show resolved
Hide resolved
opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
Show resolved
Hide resolved
opacclient/libopac/src/main/java/de/geeksfactory/opacclient/apis/SLUB.kt
Show resolved
Hide resolved
by replacing .map with .forEach
@johan12345 Thanks for the detailed comments in the review, I resolved all but one where I need some more time. Regarding rebasing: I rebased it already on Sep 26 and it's no problem the rebase it again onto the current master but I think I read somewhere that you should never rebase a branch under review as it could mess up the review history/comments (not sure if this is still correct for current versions of git), so I'd like to wait with rebasing until everything is resolved and you're prepared to merge. |
in cases where the item is always available.
@johan12345 I resolved all review comments above and will wait for your go-ahead before rebasing onto the current master, see previous comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think after rebasing and implementing the extension functions (see comment at #553 (comment)) this should be good to go :)
@johan12345 Your commit e573c2c breaks opacclient/opacclient/libopac/src/test/java/de/geeksfactory/opacclient/apis/VuFindSearchTest.java Lines 51 to 52 in e9e14f2
( parseDetail now takes 5 instead of 4 arguments)
How did you manage to compile the project? |
oops... yes, indeed, I forgot to adjust the tests after that commit. Building the app itself worked though. Will fix that tonight... |
Tests should be fixed now with 85a6790. |
I'm having difficulties in rebasing. The last rebasing on Sep 26 went smoothly without any problems (I just had to resolve some conflicts in build.gradle and in the string xml files). If I try to rebase now, I not only need to resolve the same conflicts again (which is very strange) but also need to resolve conflicts for each of my 55 commits of SLUB.kt and SLUBTest.kt relative to the preceding versions of these files. This in principle is no problem but at some point (at commit 22 of 55) git starts to complain that it can't execute the todo command (next pick). I tried some recommendations from stackoverflow but not fully understanding what I'm doing I didn't succeed.
This is strange as github says "This branch has no conflicts with the base branch". I also forked the current master this afternoon and merged my feature branch in it without any problems (https://github.com/StefRe/opacclient/tree/merge_test, this also includes the use of the new extension functions). So my question is whether you could merge this PR as is. I could then make a new PR for commit c79243b (use utility functions for JSONArrays) against the new master. |
That worked, thanks again! 🎉 I also cherry-picked your commit to add the JSONArray extension functions (2739579). |
This API is specific for the new OPAC of Sächsische Landes- und Universitätsbibliothek in Dresden: www.slub-dresden.de.
See also #546.