]> Joshua Wise's Git repositories - patchfork.git/blobdiff - player/metadata.php
Add support for view-only mode.
[patchfork.git] / player / metadata.php
index 41e3e9c399d6b6726ef389774b259bd04b127c27..1b657be979da6432e7df0174c1e05a751a3798d6 100644 (file)
@@ -28,7 +28,9 @@
        function amazonlink($params)
        {
                $params["SubscriptionId"] = "15BH771NY941TX2NKC02";
-               $res = aws_signed_request("com", $params, "Access Key ID", "Secret Access Key");
+               if (strlen(get_config("aws_secret")) == 0)
+                       return False;
+               $res = aws_signed_request("com", $params, get_config("aws_keyid"), get_config("aws_secret"));
                
                return $res;
        }
        /* 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;
        }
                                $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])) {
                $out .= "</tns:getSong></SOAP-ENV:Body></SOAP-ENV:Envelope>\r\n";
 
                $head = "POST /server.php HTTP/1.1\r\n";
-               $head .= "Host: lyricwiki.org\r\n";
+               $head .= "Host: lyrics.wikia.com\r\n";
                $head .= "SOAPAction: urn:LyricWiki#getSong\r\n";
                $head .= "Content-Type: text/xml; charset=UTF-8\r\n";
                $head .= "User-Agent: RemissPitchfork/0.1\r\n";
This page took 0.02502 seconds and 4 git commands to generate.