Book images on Amazon need 10-digit ISBN
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
Fix Released
|
Undecided
|
Dan Scott | ||
2.0 |
Fix Released
|
Undecided
|
Unassigned | ||
2.1 |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
From experience, Amazon book cover requests mostly only responds to 10-digit ISBNs as the Amazon ID matches the 10-digit ISBN. Amazon's line has always been that they provide images keyed on their Amazon ID. Many catalogue records have a mixture of 10-digit and 13-digit ISBNs in no particular order. Specifically for Amazon content it would be good to intercept the ISBN before the URL is created for the image and convert 13-digit ISBN to 10-digits.
The perl module Business::ISBN can be used for a reliable conversion.
The code to change is in /openils/
We have tested this change on Evergreen version 2.0.5
diff of the code including diagnostic comments is here:
diff Amazon.pm Amazon_safe.pm
9d8
< use Business::ISBN;
70,81d68
< # open( my $diag, '>>/tmp/
< # print $diag "before: $key\n";
< # print $diag "length: " . length($key) . "\n";
< if (length($key) == 13) {
< my $isbn = Business:
< $isbn = $isbn->as_isbn10 if $isbn->type eq 'ISBN13';
< if (defined $isbn) {
< $key = $isbn->
< }
< }
< # print $diag "after : $key\n";
< # close ($diag);
Changed in evergreen: | |
assignee: | nobody → Dan Scott (denials) |
Changed in evergreen: | |
status: | Fix Committed → Fix Released |
Hello, Ian, and thanks for the code submission!
One suggestion for the code as submitted: use Perl to strip hyphens and starting / ending spaces from the incoming ISBN before checking its length (otherwise, it is unlikely to match 13). Otherwise, this looks like it will help sites that are using the Amazon added content plugin.
Note that this qualifies as a small submission under "Small additions and changes" (http:// evergreen- ils.org/ dokuwiki/ doku.php? id=contributing #small_ additions_ and_changes) but we request that the process under "Submitting code o the project" (http:// evergreen- ils.org/ dokuwiki/ doku.php? id=contributing &#submitting_ code_to_ the_project) be followed; for example, the use of the "git sign-off" tag to assert that you have the right to contribute the code.