From 82791019d27335234ba5ccecdd1f786017d81651 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Sun, 28 Feb 2010 20:04:40 -0500 Subject: [PATCH] =?utf8?q?Tweak=20support=20for=20Amazon=20coverart=20grab?= =?utf8?q?bing=20to=20be=20able=20to=20use=20keyword=20search,=20too.=20(p?= =?utf8?q?atch=20from=20V=C3=A1clav=20Nov=C3=A1=C4=8Dek=20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- player/metadata.php | 6 ++++-- player/metadata_cover.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/player/metadata.php b/player/metadata.php index 93d8871..9de3be3 100644 --- a/player/metadata.php +++ b/player/metadata.php @@ -102,16 +102,18 @@ /* Queries amazon with the specified url, strict serach first and then a more careless one, * will urlencode artist and albumname * returns xml document or false upon failure */ - function amazon_album_query($params) { + function amazon_album_query($params, $album) { $stype = array("Title", "Keywords"); $artist = urlencode($artist); $album = urlencode($album); foreach($stype as $st) { if(!amazon_wait()) return false; + $params[$st] = $album; $xml = amazonlink($params); if($xml&&isset($xml->Items[0])&&isset($xml->Items[0]->Item[0])) return $xml; + unset($params[$st]); } return false; } @@ -330,7 +332,7 @@ $asin = false; } else { - $res = @amazon_album_query(array("Operation"=>"ItemSearch", "SearchIndex"=>"Music", "Artist"=>"$artist", "Album"=>"$album")); + $res = @amazon_album_query(array("Operation"=>"ItemSearch", "SearchIndex"=>"Music", "Artist"=>"$artist"), $album); } if($res) { if($res&&isset($res->Items[0])&&isset($res->Items[0]->Item[0])) { diff --git a/player/metadata_cover.php b/player/metadata_cover.php index 38d2947..50daeb4 100644 --- a/player/metadata_cover.php +++ b/player/metadata_cover.php @@ -29,7 +29,7 @@ function amazon_search_cover($artist, $album) { global $amazon_cover_url, $metadata_dir; - $xml = amazon_album_query(array("Operation"=>"ItemSearch", "SearchIndex"=>"Music", "ResponseGroup"=>"Images", "Artist"=>"$artist", "Album"=>"$album")); + $xml = amazon_album_query(array("Operation"=>"ItemSearch", "SearchIndex"=>"Music", "ResponseGroup"=>"Images", "Artist"=>"$artist"), $album); if($xml) { if(isset($xml->Items[0])&&isset($xml->Items[0]->Item[0])) { $item = $xml->Items[0]->Item[0]; -- 2.39.2