for ($i = 0; $i < $find->Items->TotalResults; $i++) { if (strlen($find->Items->Item[$i]->ItemAttributes->ISBN . "") > 0) { $return['objects'][] = makeIsbnReturn($find->Items->Item[$i]); } } } elseif (isset($find->Items->Item)) { if (strlen($find->Items->Item->ItemAttributes->ISBN . "") > 0) { $return['objects'][] = makeIsbnReturn($find->Items->Item); } } } if (preg_match("/^\\s*ISBN\\s*(.+)\\s*\$/i", \filter_input(INPUT_POST, 'query'), $match)) { $return['test'] = true; $return['amazonCom'] = amazon_isbn_search(preg_replace("/\\D/", "", $match[1]), "com"); } else { $return['amazonCom'] = amazon_search(\filter_input(INPUT_POST, 'query'), "com"); } $find = $return['amazonCom']; if (isset($find->Items)) { if (isset($find->Items->TotalResults)) { for ($i = 0; $i < $find->Items->TotalResults; $i++) { if (strlen($find->Items->Item[$i]->ItemAttributes->ISBN . "") > 0) { $return['objects'][] = makeIsbnReturn($find->Items->Item[$i]); } } } elseif (isset($find->Items->Item)) { if (strlen($find->Items->Item->ItemAttributes->ISBN . "") > 0) { $return['objects'][] = makeIsbnReturn($find->Items->Item); } } }
if ($genre == "Soundtrack") { $term = $album; } else { $term = "{$artist} {$album}"; } // don't search on streams (which have no album or artist in iTunes) if ($album || $artist) { require_once dirname(__FILE__) . '/amazon/amazonsearch.php'; $res = amazon_search($term, $associate_id, $dev_key); // if no result on $album and $artist, then just search for $album (if not sound track, as we just searched for $album) if (!$res && $genre != "Soundtrack") { $res = amazon_search($album, $associate_id, $dev_key); } // if still no results, then just search for $artist, don't care if soundtrack, we need to find anything! if (!$res) { $res = amazon_search($artist, $associate_id, $dev_key); } // if we found something if ($res) { $amazon_image = $res->ImageUrlSmall; $amazon_url = $res->url; $image_size = hasImage($amazon_image); if (!$image_size) { $amazon_image = NULL; } } else { $amazon_image = NULL; $amazon_url = NULL; } } $amazon_url = str_replace("amazon.com", "amazon.ca", $amazon_url);