Bug 34527 - Enhance the Openlibrary book cover retrieval to use the 024 MARC record and the OLID
Summary: Enhance the Openlibrary book cover retrieval to use the 024 MARC record and t...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: nigel
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-14 11:26 UTC by nigel
Modified: 2023-09-04 23:12 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 34527: Enhance the Openlibrary book cover retrieval to use OLID (11.72 KB, patch)
2023-08-30 10:45 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description nigel 2023-08-14 11:26:10 UTC
Now that OpenLibrary has been added to the SISC list, with identifier "openlib" it is feasible (and correct) to add an OpenLibrary ID (OLID) to MARC record 024

024 7 _ | $2 openlib | $a <OLID>

Enhancing the OpenLibrary book cover retrieval method to include OLIDs in this fashion would allow more complete retrieval of book covers from OpenLibrary even in the case where the book has no ISBN
Comment 1 Jonathan Druart 2023-08-30 10:45:43 UTC
Created attachment 154944 [details] [review]
Bug 34527: Enhance the Openlibrary book cover retrieval to use OLID
Comment 2 Jonathan Druart 2023-08-30 10:47:10 UTC
I think this is not ready, but could be used as a first step.

1. Should we support UNIMARC?

2. The retrieval of the OLID should be move to C4::Koha alongwith GetNormalizedISBN (or Koha::Biblio, with get_normalized_isbn), and test covered.
Comment 3 Jonathan Druart 2023-08-30 10:47:26 UTC
Nigel, is this patch working as you expect?
Comment 4 nigel 2023-08-30 18:35:34 UTC
Many thanks for the work you've done already.

This certainly seems to be retrieving the cover in the case where there is no ISBN and there is an OLID, which is what I wanted.

Looking at the code I think you are missing a test in Search.pm around line 1747. I'm not familiar enough with Koha data structures to actually modify the code but MARC 21 says that you only check subfield 2 if the first indicator contains the value 7 and I think your code checks subfield 2 regardless of the state of the first indicator.
Comment 5 Jonathan Druart 2023-08-31 06:54:05 UTC
Please adopt this patch if you can. I don't know when I will have time to get back to it (and I don't have much interest in it).
Comment 6 nigel 2023-08-31 10:48:18 UTC
Of course I will. 

And I can't say how grateful I am that you've done most of the work.

It mostly looks done. I'll tidy it up as per my previous comments and run it for a bit and give it a thorough test. I'll look at sorting out formal testing.
Comment 7 David Cook 2023-08-31 23:22:30 UTC
(In reply to nigel from comment #6)
> Of course I will. 
> 
> And I can't say how grateful I am that you've done most of the work.
> 
> It mostly looks done. I'll tidy it up as per my previous comments and run it
> for a bit and give it a thorough test. I'll look at sorting out formal
> testing.

Let me know if you need a hand, Nigel. Once you get koha-testing-docker working, writing and testing patches should be straightforward.
Comment 8 nigel 2023-09-04 11:02:03 UTC
I already got koha-testing-docker working and in fact I applied Jonathan's patch to it in order to test it. What I think I now need to do is roll it back to virgin and then create a new branch to apply the patch to. I've read through the code and worked out the minor change that I need to make to check for the correct state of the first indicator. Once I've done that I'll apply the patch to the new branch and test again.

Sorry this is such a laborious process. It's the first time I've dealt with the koha/bugzilla process.
Comment 9 David Cook 2023-09-04 23:12:16 UTC
(In reply to nigel from comment #8)
> Sorry this is such a laborious process. It's the first time I've dealt with
> the koha/bugzilla process.

We all start at the beginning! I don't know if I understood the process you described above but whatever it takes. Just let us know if you need help.