]> Joshua Wise's Git repositories - patchfork.git/commitdiff
Tweak support for Amazon coverart grabbing to be able to use keyword search, too...
authorJoshua Wise <joshua@h2so4.joshuawise.com>
Mon, 1 Mar 2010 01:04:40 +0000 (20:04 -0500)
committerJoshua Wise <joshua@h2so4.joshuawise.com>
Mon, 1 Mar 2010 01:04:40 +0000 (20:04 -0500)
player/metadata.php
player/metadata_cover.php

index 93d8871ee58c5fc0d7b33ed1c5a5b8e6dd99abd0..9de3be3f3b5b0a0bc5d79f62fdcdd30691d540b3 100644 (file)
        /* 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 */
        /* 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;
                $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;
                        $xml = amazonlink($params);
                        if($xml&&isset($xml->Items[0])&&isset($xml->Items[0]->Item[0]))
                                return $xml;
+                        unset($params[$st]);
                }
                return false;
        }
                }
                return false;
        }
                                $asin = false;
                        }
                        else {
                                $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])) {
                        }
                        if($res) {
                                if($res&&isset($res->Items[0])&&isset($res->Items[0]->Item[0])) {
index 38d29479ac1ab0ff45c076684e2a1af602b4758e..50daeb4d4aeed72ce8edd4c446f2b3de6e7358bd 100644 (file)
@@ -29,7 +29,7 @@
        function amazon_search_cover($artist, $album) {
                global $amazon_cover_url, $metadata_dir;
 
        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];
                if($xml) {
                        if(isset($xml->Items[0])&&isset($xml->Items[0]->Item[0])) {
                                $item = $xml->Items[0]->Item[0];
This page took 0.027972 seconds and 4 git commands to generate.