#---------------------------------------------------------------
# ____                   _ _         ____  _
#|  _ \ ___  _   _  __ _| | |_ _   _/ ___|| |__   __ _ _ __ ___
#| |_) / _ \| | | |/ _` | | __| | | \___ \| '_ \ / _` | '__/ _ \
#|  _ < (_) | |_| | (_| | | |_| |_| |___) | | | | (_| | | |  __/
#|_| \_\___/ \__, |\__,_|_|\__|\__, |____/|_| |_|\__,_|_|  \___|
#            |___/             |___/
#
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#---------------------------------------------------------------
package BookPub::Catalog::Import::Process::ImageRetriever::RandomHouse;
use strict;
use warnings;
use Data::Dumper;

use lib '/app/tools/common/lib';
use lib '/app/tools/bookpub/lib';
use Common::Util;
use Common::Assert;

use base 'BookPub::Catalog::Import::Process::ImageRetriever::Base';

sub _downloadURL {
    my ( $self, $url, $destFilePath ) = @_;

    # These randomhouse 'urls' actually contain filenames.
    # We'll convert this into real urls, then pass that along to
    # the inherited method to finish the job.
    #

    $url =~ s/-//g;
    my ( $isbn, $suffix ) = split( /\./, $url );

    $url = "http://www.randomhouse.com/images/dyn/jcover/?source=$isbn&height=450&quality=80";

    return $self->SUPER::_downloadURL( $url, $destFilePath );
}

###
1;    #
###
