function lookup($isbn, $type = "medium")
 {
     // Hide warnings on results in safe mode
     //error_reporting(0);
     // Lookup amazon first
     require_once 'cloudfusion/cloudfusion.class.php';
     // Load cover options
     require_once '../classes/CoverOptsQuery.php';
     $opt = CoverOptsQuery::getAWS();
     if (empty($opt['aws_key']) || empty($opt['aws_secret_key'])) {
         $this->_lastError = 'MissingKeyError: Missing AWS keys in Admin > Cover Lookup Options, please fill them.';
         return false;
     }
     define('AWS_KEY', $opt['aws_key']);
     define('AWS_SECRET_KEY', $opt['aws_secret_key']);
     define('AWS_ACCOUNT_ID', $opt['aws_account_id']);
     // Remove trail data from ISBN
     $isbn = explode(' ', $isbn);
     $isbn = preg_replace("/[^x0-9]+/", '', $isbn[0]);
     try {
         $pas = new AmazonPAS();
         $response = $pas->item_lookup($isbn, array('IdType' => 'ISBN', 'SearchIndex' => 'Books', 'ResponseGroup' => 'Images'));
         if (isset($response->body->Error)) {
             $this->_lastError = $response->body->Error->Code . ': ' . $response->body->Error->Message;
             return false;
         }
         if ($type == "large") {
             if (!empty($response->body->Items->Item->LargeImage)) {
                 return '' . $response->body->Items->Item->LargeImage->URL;
             }
         }
         if (!empty($response->body->Items->Item->MediumImage)) {
             return '' . $response->body->Items->Item->MediumImage->URL;
         }
         $this->_lastError = 'ISBNNotFound: Couldn\'t find any information for this ISBN.';
         return false;
     } catch (Exception $e) {
         $this->_lastError = 'ConnectionError: Couldn\'t connect to AWS service.';
         return false;
     }
 }
Ejemplo n.º 2
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('SellerLookup', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 3
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('VehicleSearch', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 4
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('CartCreate', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 5
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('BrowseNodeLookup', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 6
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('SellerListingSearch', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 7
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('ItemLookup', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('CustomerContentSearch', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 9
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('SimilarityLookup', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 10
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('CartGet', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 11
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('TagLookup', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 12
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('CartAdd', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 13
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('CartModify', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 14
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('CartClear', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 15
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('VehiclePartLookup', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 16
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('TransactionLookup', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 17
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('ListLookup', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 18
0
 * Read album art from Amazon PAS service
 * Be sure to review and complete the cloudfusion configuration in config/
 *
 * @package    streeme
 * @author     Richard Hoar
 */
if (sfConfig::get('sf_environment') === 'test') {
    //load a mock for testing - simulates the expected response from amazon for integration tests
    require_once dirname(__FILE__) . '/../../../test/files/cloudfusion.php';
    require_once dirname(__FILE__) . '/../../../test/files/cloudfusion.class.php';
} else {
    require_once dirname(__FILE__) . '/../../../config/cloudfusion.php';
    require_once dirname(__FILE__) . '/../../vendor/cloudfusion/cloudfusion.class.php';
}
$artwork_scanner = new ArtworkScan('amazon');
$associate_services = new AmazonPAS();
$artwork_list = $artwork_scanner->get_unscanned_artwork_list();
$current_album_id = 0;
if (count($artwork_list) == 0) {
    echo "*** Songs have all been cross-checked with Amazon ***";
}
foreach ($artwork_list as $key => $value) {
    //this album has copied art, skip to the next album
    if ($current_album_id == $value['album_id']) {
        continue;
    }
    $art_dir = dirname(__FILE__) . '/../../../data/album_art/' . md5($value['artist_name'] . $value['album_name']);
    echo 'Scanning: ' . $value['album_name'] . ' by: ' . $value['artist_name'] . "\r\n";
    $opts = array('Artist' => $value['artist_name'], 'Creator' => $value['artist_name'], 'SearchIndex' => 'Music', 'ResponseGroup' => 'Medium');
    //Sometimes Amazon returns malformed xml, so we need to catch exceptions. We'll try again on a later scan.
    try {
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('CustomerContentLookup', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 20
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('ListSearch', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.
Ejemplo n.º 21
0
--TEST--
Get a list of all possible options for this operation.

--FILE--
<?php 
// Dependencies
require_once dirname(__FILE__) . '/../../cloudfusion.class.php';
// Get a list of available options
$pas = new AmazonPAS();
$response = $pas->help('ItemSearch', 'Operation');
// View list
print_r($response);
?>

--EXPECT--
All possible options for this operation.