From: Jeff Godin Date: Sat, 28 Apr 2012 22:38:14 +0000 (-0400) Subject: Remove Amazon added content handler X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fjeff%2Fremove_amazon_added_content;p=working%2FEvergreen.git Remove Amazon added content handler The Amazon added content handler for jacket images is removed by this commit. Signed-off-by: Jeff Godin --- diff --git a/Open-ILS/examples/opensrf.xml.example b/Open-ILS/examples/opensrf.xml.example index ea6f18b397..0f2d11c428 100644 --- a/Open-ILS/examples/opensrf.xml.example +++ b/Open-ILS/examples/opensrf.xml.example @@ -243,11 +243,6 @@ vim:et:ts=4:sw=4: MY_USER_ID - - diff --git a/Open-ILS/src/perlmods/MANIFEST b/Open-ILS/src/perlmods/MANIFEST index 9f30b977ec..8560f4e89c 100644 --- a/Open-ILS/src/perlmods/MANIFEST +++ b/Open-ILS/src/perlmods/MANIFEST @@ -156,7 +156,6 @@ lib/OpenILS/Utils/ScriptRunner.pm lib/OpenILS/Utils/SpiderMonkey.pm lib/OpenILS/Utils/ZClient.pm lib/OpenILS/WWW/AddedContent.pm -lib/OpenILS/WWW/AddedContent/Amazon.pm lib/OpenILS/WWW/AddedContent/ContentCafe.pm lib/OpenILS/WWW/AddedContent/OpenLibrary.pm lib/OpenILS/WWW/AddedContent/Syndetic.pm diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent/Amazon.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent/Amazon.pm deleted file mode 100644 index 9e2c13c595..0000000000 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent/Amazon.pm +++ /dev/null @@ -1,92 +0,0 @@ -package OpenILS::WWW::AddedContent::Amazon; -use strict; use warnings; -use OpenSRF::Utils::Logger qw/$logger/; -use OpenSRF::Utils::SettingsParser; -use OpenILS::WWW::AddedContent; -use OpenSRF::Utils::JSON; -use OpenSRF::EX qw/:try/; -use XML::LibXML; -use Business::ISBN; - -my $AC = 'OpenILS::WWW::AddedContent'; - -sub new { - my( $class, $args ) = @_; - $class = ref $class || $class; - return bless($args, $class); -} - -sub base_url { - my $self = shift; - return $self->{base_url}; -} - -sub userid { - my $self = shift; - return $self->{userid}; -} - - -# -------------------------------------------------------------------------- -sub jacket_small { - my( $self, $key ) = @_; - return $self->send_img( - $self->fetch_response('_SCMZZZZZZZ_.jpg', $key)); -} - -sub jacket_medium { - my( $self, $key ) = @_; - return $self->send_img( - $self->fetch_response('_SCMZZZZZZZ_.jpg', $key)); - -} -sub jacket_large { - my( $self, $key ) = @_; - return $self->send_img( - $self->fetch_response('_SCZZZZZZZ_.jpg', $key)); -} - -# -------------------------------------------------------------------------- - -sub send_img { - my($self, $response) = @_; - return { - content_type => $response->header('Content-type'), - content => $response->content, - binary => 1 - }; -} - -# returns the raw content returned from the URL fetch -sub fetch_content { - my( $self, $page, $key ) = @_; - return $self->fetch_response($page, $key)->content; -} - -# returns the HTTP response object from the URL fetch -sub fetch_response { - my( $self, $page, $key ) = @_; - my $uname = $self->userid; - - # Some sites have entered Amazon IDs in 020 $a, thus we cannot - # simply pass all incoming keys to Business::ISBN for normalization - if (length($key) > 10) { - # Use Business::ISBN to normalize the incoming ISBN - my $isbn = Business::ISBN->new( $key ); - if (!defined $isbn) { - $logger->warning("'$key' is not a valid ISBN"); - return 0; - } - - # Amazon prefers ISBN10 - $isbn = $isbn->as_isbn10 if $isbn->type eq 'ISBN13'; - $key = $isbn->as_string([]); - } - - my $url = $self->base_url . "$key.01.$page"; - return $AC->get_url($url); -} - - - -1; diff --git a/Open-ILS/src/perlmods/t/16-OpenILS-WWW-AddedContent.t b/Open-ILS/src/perlmods/t/16-OpenILS-WWW-AddedContent.t index 10f79c9ec4..3f2c6c65e1 100644 --- a/Open-ILS/src/perlmods/t/16-OpenILS-WWW-AddedContent.t +++ b/Open-ILS/src/perlmods/t/16-OpenILS-WWW-AddedContent.t @@ -6,7 +6,6 @@ BEGIN { use_ok( 'OpenILS::WWW::AddedContent' ); } -use_ok( 'OpenILS::WWW::AddedContent::Amazon' ); use_ok( 'OpenILS::WWW::AddedContent::ContentCafe' ); use_ok( 'OpenILS::WWW::AddedContent::OpenLibrary' ); use_ok( 'OpenILS::WWW::AddedContent::Syndetic' ); diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd index 9b31b218da..4b4589e964 100644 --- a/Open-ILS/web/opac/locale/en-US/opac.dtd +++ b/Open-ILS/web/opac/locale/en-US/opac.dtd @@ -683,9 +683,12 @@ Ensure Caps-Lock is off and try again or contact your local library."> + - - + +