[OPEN-ILS-GENERAL] Covers and ISBNs
Ian Bays
ian.bays at ptfs-europe.com
Fri Oct 7 10:57:47 EDT 2011
Hi Gordona,
(dev list copied in case we need to submit a patch) - I have just seen
Dan's latest post so will contribute it properly:-)
So in case you want it before it goes through the process here it is.
Using documentation from Business::ISBN:
Changes are to:
/openils/lib/perl5/OpenILS/WWW/AddedContent$ diff Amazon.pm Amazon_safe.pm
9d8
< use Business::ISBN;
70,81d68
< # open( my $diag, '>>/tmp/diagISBN.log' );
< # print $diag "before: $key\n";
< # print $diag "length: " . length($key) . "\n";
< if (length($key) == 13) {
< my $isbn = Business::ISBN->new( $key );
< $isbn = $isbn->as_isbn10 if $isbn->type eq 'ISBN13';
< if (defined $isbn) {
< $key = $isbn->as_string([]);
< }
< }
< # print $diag "after : $key\n";
< # close ($diag);
So the subroutine (without diagnostic comments) is:
# returns the HTTP response object from the URL fetch
sub fetch_response {
my( $self, $page, $key ) = @_;
my $uname = $self->userid;
if (length($key) == 13) {
my $isbn = Business::ISBN->new( $key );
$isbn = $isbn->as_isbn10 if $isbn->type eq 'ISBN13';
if (defined $isbn) {
$key = $isbn->as_string([]);
}
}
my $url = $self->base_url . "$key.01.$page";
return $AC->get_url($url);
}
This of course assumes you are using Amazon content. I think we had to
restart caching to make it work.
Good luck.
Ian
On 07/10/2011 15:18, Gordana Vitez wrote:
> Hi Ian,
> I would be interested to know how you got this to work.
> Thanks!
> Gordana
> Gordana Vitez
> Library Services & Systems Coordinator
> NC Libraries and Learning Commons
> Niagara College
> 300 Woodlawn Rd
> Welland Ontario
> L3C 7L3
> Phone: (905) 735 2211 ext 7404
> Fax: (905) 736 6021
> gvitez at niagaracollege.ca
>
>
> >>> Ian Bays <ian.bays at ptfs-europe.com> 10/7/2011 5:52 AM >>>
> Hi Ben, Brian et al,
>
> We came across this when trying to show images from Amazon. We know
> from experience that Amazon mostly only responds to 10-digit ISBNs as
> the Amazon ID matched the 10-digit ISBN. Amazon's line has always
> been that they provide images keyed on their Amazon ID.
>
> When loading data there are 10-digit and 13-digit ISBNs often in no
> particular order. So we found the script in Evergreen that forms the
> URL for the image from Amazon and test if the ISBN is 13-digits, and
> if so convert it using Business::ISBN perl module to be a 10-digit
> ISBN. So no messing with the data in bib at all. Seems to work well.
>
> On our system the script to change is:
> /openils/lib/perl5/OpenILS/WWW/AddedContent/Amazon.pm
>
> We're happy to share - it's just a few lines. Maybe this should be on
> the DEV list?
>
> Also we noticed that if your ISBNs have hyphens in them then the ISBN
> only comes through as the digits up to the first hyphen (in our case
> usually "0"). We do get lots of cataloguers who believe ISBNs should
> have hyphens. So we are weighing up removing hyphens in data
> conversion versus finding the code that writes the ISBN field and
> getting it to skip/ignore hyphens. Should make it look real pretty!
>
> All the best.
>
> Ian
>
> On 06/10/2011 18:56, Ben Shum wrote:
>> Hi Brian,
>>
>> As far as I know, the first ISBN entry of a record will always be
>> used to retrieve added content images. I'm not familiar with any
>> workarounds other than editing the records to order the information
>> in them accordingly, but maybe someone is working on this?
>> Otherwise, I think that'd be a useful feature to have in the future.
>>
>> -- Ben
>>
>> On 10/6/2011 1:17 PM, Brian Greene wrote:
>>> In many cases covers won't display in our OPAC if the 13-digit ISBN
>>> is above the 10-digit ISBN in the bib record. If I switch the order
>>> of the ISBNs so that the 10-digit one is first then the cover
>>> displays. This is the case most of the time, although I have come
>>> across instances where the 13-digit ISBN displays the cover
>>> properly. Does anyone know of a fix for this? Is there a setting we
>>> can change to use a second ISBN if the first one doesn't retrieve a
>>> cover? We're running 2.1.
>>> Thanks,
>>> Brian Greene, Library Director
>>> Columbia Gorge Community College
>>> The Dalles, Oregon 97058
>>> (541) 506-6080 | www.cgcc.cc.or.us <http://www.cgcc.cc.or.us/>
>>
>> --
>> Benjamin Shum
>> Open Source Software Coordinator
>> Bibliomation, Inc.
>> 32 Crest Road
>> Middlebury, CT 06762
>> 203-577-4070, ext. 113
>
> --
> Ian Bays
> Director of Projects
> PTFS Europe
> mobile: +44 (0) 7774995297
> phone: +44 (0) 800 756 6803
> skype: ian.bays
> email:ian.bays at ptfs-europe.com
--
Ian Bays
Director of Projects
PTFS Europe
mobile: +44 (0) 7774995297
phone: +44 (0) 800 756 6803
skype: ian.bays
email: ian.bays at ptfs-europe.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libmail.georgialibraries.org/pipermail/open-ils-general/attachments/20111007/bc35facf/attachment.htm>
More information about the Open-ils-general
mailing list