Beispiel #1
0
function SERVICE_GETARTISTMETADATA_yahoo($node, $displayOutput, $return = false)
{
    global $include_path;
    // let's set the artist we're looking at
    $artist = $node->getName();
    include_once $include_path . "lib/snoopy.class.php";
    $snoopy = new Snoopy();
    $snoopy->fetch("http://search.music.yahoo.com/search/?m=artist&x=23&y=10&p=" . urlencode($artist));
    $contents = $snoopy->results;
    unset($snoopy);
    // Did we get anything?
    if (stristr($contents, "no matches found")) {
        return false;
    }
    // Ok, now let's see if we got a direct hit or a link
    if (stristr($contents, $artist)) {
        // Now let's see if we can get the right link
        $contents = substr($contents, strpos($contents, '<a href=http://music.yahoo.com/') + 8);
        $link = trim(substr($contents, 0, strpos($contents, ">")));
        $link = str_replace("---", "-bio--", $link);
        // Now let's get the bio back
        $contents = @file_get_contents($link);
        $bio = substr($contents, strpos($contents, 'width="401">'));
        $bio = substr($bio, strpos($bio, '<td>') + 4);
        $bio = substr($bio, 0, strpos($bio, '</td>'));
        // Now let's get the artist image
        $image = substr($contents, strpos($contents, '<img src="http://') + 10);
        $image = substr($image, 0, strpos($image, '"'));
        if (!stristr($image, ".jpg") or !stristr($image, "http://")) {
            $image = "";
        }
        // Now let's write the data
        if ($return) {
            if ($return == "array") {
                $retArr['bio'] = $bio;
                $retArr['image'] = $image;
                return $retArr;
            } else {
                return ${$return};
            }
            return ${$return};
        } else {
            $artReturn = writeArtistMetaData($node, $image, $bio, $displayOutput);
        }
    }
    return false;
}
Beispiel #2
0
 echo "Retrieving metadata for " . $item->getName() . ".\n";
 // Now let's see if this is an artist
 if ($item->getPType() == 'artist') {
     // Now do we want to look at this?
     // Ok, let's get data for this artist
     // Now let's get the data IF we should
     if ($item->getMainArt() == "" or $item->getDescription() == "") {
         $arr = array();
         $arr = $jzSERVICES->getArtistMetadata($item, true, "array");
         // Now let's see if they want to get art or need to
         if ($item->getMainArt() == "" and $arr['image'] != "") {
             // Ok, we want the art
             writeArtistMetaData($item, $arr['image'], false, false);
         }
         if ($item->getDescription() == "" and $arr['bio'] != "") {
             writeArtistMetaData($item, false, $arr['bio'], false);
         }
     }
 }
 // Now let's look at the album
 if ($item->getPType() == 'album') {
     $parent = $item->getParent();
     $artist = $parent->getName();
     $arr = array();
     $arr = $jzSERVICES->getAlbumMetadata($item, false, "array");
     // Ok, now should we do the art?
     if ($item->getMainArt() == "" and $arr['image'] != "") {
         writeAlbumMetaData($item, false, $arr['image']);
     } else {
         unset($arr['image']);
     }
Beispiel #3
0
function SERVICE_GETARTISTMETADATA_webmosher($node = false, $return = false, $artistName = false)
{
    global $include_path;
    include_once $include_path . "lib/utfnormal/UtfNormal.php";
    $utffix = new UTFNormal();
    // let's set the artist we're looking at
    if (is_object($node)) {
        $artist = $node->getName();
    } else {
        $artist = $node['artist'];
    }
    $artist = preg_replace("/\\&/", 'and', $artist);
    $items = array();
    // Normally, we are probably not overriding our values, so just procede.
    if (empty($_POST[descOVERRIDE]) && empty($_POST[imgOVERRIDE])) {
        $fix_jz_path = urlencode(implode('/', $node->getPath()));
        print "<form action=\"popup.php?action=popup&ptype=getmetadata&jz_path={$fix_jz_path}\" method=\"post\">\n";
        print "<input type=\"hidden\" name=\"edit_search_all_albums\" value=\"off\"/>\n";
        print "<input type=\"hidden\" name=\"edit_search_all_artists\" value=\"on\"/>\n";
        print "<input type=\"hidden\" name=\"metaSearchSubmit\" value=\"Search\"/>\n";
        print "<input type=\"hidden\" name=\"edit_search_images_miss\" value=\"always\"/>\n";
        print "<input type=\"hidden\" name=\"edit_search_desc_miss\" value=\"always\"/>\n";
        $search_artist = urlencode(strtolower(preg_replace('/[^\\w\\s]/', '', $utffix->toNFKD($artist))));
        $yahoo_search = "http://search.music.yahoo.com/search/?m=artist&x=0&y=0&p=" . $search_artist;
        $content_y = getHTMLData($yahoo_search);
        $items['yahoo'] = parseYahooArtist($content_y, $artist);
        print "<h2>YAHOO!</h2>\n";
        print "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n";
        print "<tr>\n";
        print "<td align=\"center\" valign=\"top\"><img width=\"150px\" src=\"" . $items['yahoo']['image'] . "\"/></td>\n";
        print "<td align=\"left\" valign=\"top\">" . substr($items['yahoo']['bio'], 0, 200) . "</td>\n";
        print "</tr><tr>\n";
        print "<td width=\"50%\" align=\"center\"><input type=\"radio\" name=\"imgOVERRIDE\" value=\"" . $items['yahoo']['image'] . "\">Override Image</td>\n";
        print "<td width=\"50%\" align=\"center\"><input type=\"radio\" name=\"descOVERRIDE\" value=\"" . $items['yahoo']['bio'] . "\">Override Bio</td>\n";
        print "</table><hr/>\n";
        // Rhapsody has some very specific artist name search requirements.
        $search_artist = urlencode(strtolower(preg_replace('/[^\\w]/', '', $utffix->toNFKD($artist))));
        $rhaps_search = "http://www.rhapsody.com/" . strtolower(preg_replace('/[^\\w]/', '', $search_artist)) . "/more.html";
        $content_r = getHTMLData($rhaps_search, $artist);
        $items['rhaps'] = parseRhapsodyArtist($content_r, $artist);
        print "<h2>Rhapsody</h2>\n";
        print "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n";
        print "<tr>\n";
        print "<td align=\"center\" valign=\"top\"><img width=\"150px\" src=\"" . $items['rhaps']['image'] . "\"/></td>\n";
        print "<td align=\"left\" valign=\"top\">" . substr($items['rhaps']['bio'], 0, 200) . "</td>\n";
        print "</tr><tr>\n";
        print "<td width=\"50%\" align=\"center\"><input type=\"radio\" name=\"imgOVERRIDE\" value=\"" . $items['rhaps']['image'] . "\">Override Image</td>\n";
        print "<td width=\"50%\" align=\"center\"><input type=\"radio\" name=\"descOVERRIDE\" value=\"" . $items['rhaps']['bio'] . "\">Override Bio</td>\n";
        print "</table><hr/>\n";
        if (isset($items['yahoo']['bio']) && $items['yahoo']['bio'] != 'Not available.') {
            $bio = $items['yahoo']['bio'];
        } elseif (isset($items['rhaps']['bio']) && $items['rhaps']['bio'] != 'Not available.') {
            $bio = $items['rhaps']['bio'];
        } else {
            $bio = '';
        }
        if (isset($items['yahoo']['image']) && $items['yahoo']['image'] != '') {
            $image = $items['yahoo']['image'];
        } elseif (isset($items['rhaps']['image']) && $items['rhaps']['image'] != '') {
            $image = $items['rhaps']['image'];
        } else {
            $image = '';
        }
        print "<div align=\"center\"><input type=\"submit\" value=\"Override Default\" class=\"jz_submit\"/></div>";
        print "</form>";
        flushdisplay();
    } else {
        $retArr = artistOverride();
        print "<h2>OVERRIDE</h2>\n";
        print "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n";
        print "<tr>\n";
        print "<td align=\"center\" valign=\"top\"><img width=\"150px\" src=\"" . (isset($retArr['image']) ? $retArr['image'] : $image) . "\"/></td>\n";
        print "<td align=\"left\" valign=\"top\">" . (isset($retArr['bio']) ? $retArr['bio'] : $bio) . "</td>\n";
        print "</tr><tr>\n";
        print "</table><hr/>\n";
    }
    // Now let's write the data
    if ($return) {
        if ($return == "array") {
            if (empty($retArr['bio'])) {
                $retArr['bio'] = $bio;
            }
            if (empty($retArr['image'])) {
                $retArr['image'] = $image;
            }
            return $retArr;
        } else {
            return ${$return};
        }
        return ${$return};
    } else {
        $artReturn = writeArtistMetaData($node, $image, $bio, $displayOutput);
    }
    return false;
}
Beispiel #4
0
function SERVICE_GETARTISTMETADATA_rs($node = false, $return = false, $artistName = false)
{
    global $include_path;
    // Let's up the max execution time...
    ini_set('max_execution_time', '600');
    // let's set the artist we're looking at
    if ($node) {
        $artist = $node->getName();
    } else {
        $artist = $artistName;
    }
    include_once $include_path . "lib/snoopy.class.php";
    // Now let's open it up
    $snoopy = new Snoopy();
    $snoopy->fetch("http://www.rollingstone.com/?searchtype=RSArtist&query=" . urlencode($artist));
    $contents = $snoopy->results;
    unset($snoopy);
    // Now let's fix up the name
    $albumName = str_replace("&", "&amp;", $album);
    $artist = str_replace("&", "&amp;", $artist);
    // Ok, let's see if we got the exact album or a page of possibles
    $link = false;
    if (strpos($contents, $artist)) {
        // Ok, we found the album (or we think) now let's move to it
        $contents = substr($contents, strpos($contents, '"<strong>') + 10);
        $contents = substr($contents, strpos($contents, '<tr>') + 4);
        // Now let's build an array so we can find the right link
        $linkArray = explode("</tr>", $contents);
        for ($i = 0; $i < count($linkArray); $i++) {
            // Now let's see if this one has our artist
            if (stristr($linkArray[$i], $artist)) {
                // Ok, we've got our block, let's get the link
                $link = substr($linkArray[$i], strpos($linkArray[$i], 'href="') + 6);
                $link = substr($link, 0, strpos($link, '"'));
                break;
            }
        }
    }
    // Ok, did we find a link?
    if ($link) {
        $snoopy = new Snoopy();
        $snoopy->fetch($link . "?rnd=1107178952184&has-player=true&version=6.0.12.1040");
        $contents = $snoopy->results;
        unset($snoopy);
        // First let's get the artist image
        $image = substr($contents, strpos($contents, 'class="artistName">') + 20);
        $image = substr($image, strpos($image, 'src="') + 5);
        $image = substr($image, 0, strpos($image, '"'));
        // Now let's get the bio from that link
        $bioLink = substr($contents, strpos($contents, '/artist/bio/'));
        $bioLink = "http://www.rollingstone.com" . substr($bioLink, 0, strpos($bioLink, '"'));
        $snoopy = new Snoopy();
        $snoopy->fetch($bioLink);
        $contents = $snoopy->results;
        unset($snoopy);
        // Now let's get the bio
        $bio = substr($contents, strpos($contents, '<div class="bio">') + strlen('<div class="bio">'));
        $bio = substr($bio, 0, strpos($bio, "</"));
        // Now let's find the similar artists
        $similar = substr($contents, strpos($contents, 'contemporaries.gif') + 30);
        $similar = substr($similar, strpos($similar, '</td>') + 5);
        $simArray = explode("</tr>", $similar);
        for ($i = 0; $i < count($simArray); $i++) {
            if (stristr($simArray[$i], "title=") and !stristr($simArray[$i], "<img class")) {
                $sim = substr($simArray[$i], strpos($simArray[$i], '<a') + 2);
                $sim = substr($sim, strpos($sim, '">') + 2);
                $sim = substr($sim, 0, strpos($sim, '</'));
            }
        }
        // Now let's get the genre
        $genre = substr($contents, strpos($contents, "Genre:") + 7);
        $genre = substr($genre, strpos($genre, '">') + 2);
        $genre = substr($genre, 0, strpos($genre, ','));
        // Now let's write the data
        if ($return) {
            if ($return == "array") {
                $retArr['bio'] = $bio;
                $retArr['image'] = $image;
                $retArr['genre'] = $genre;
                return $retArr;
            } else {
                return ${$return};
            }
        } else {
            $artReturn = writeArtistMetaData($image, $bio, $genre, $node, $return);
        }
    }
    return false;
}
Beispiel #5
0
function SERVICE_GETARTISTMETADATA_google($node)
{
    global $include_path;
    // Ok, now we need to see if we are reading a album or an artist
    $artist = $node->getName();
    include_once $include_path . "lib/snoopy.class.php";
    $snoopy = new Snoopy();
    $snoopy->fetch("http://www.google.com/musicsearch?btnG=Search+Music&q=%22" . urlencode($artist) . "%22");
    $contents = $snoopy->results;
    unset($snoopy);
    $contents = substr($contents, strpos($contents, "All artists shown"));
    $contents = substr($contents, strpos($contents, "<img src=") + strlen("<img src="));
    $image = trim(substr($contents, 0, strpos($contents, " ")));
    // Now let's write the data
    if ($return) {
        if ($return == "array") {
            $retArr['image'] = $image;
            return $retArr;
        } else {
            return ${$return};
        }
        return ${$return};
    } else {
        $artReturn = writeArtistMetaData($node, $image, "", $displayOutput);
    }
}