"; echo "Index array\n"; print_r($index); echo "\nVals array\n"; print_r($vals); echo "\n\n"; } $fHeader = false; if ( $vals[ $index["NOW_PLAYING"][0] ]["attributes"]["PLAYING"] == 1 ) { foreach ( $index["TITLE"] as $i => $j ) { $url = ''; $title = $vals[ $index["TITLE"][$i] ]["value"]; if ( strlen( $title ) > 0 ) { $artist = $vals[ $index["ARTIST"][$i] ]["value"]; $album = $vals[ $index["ALBUM"][$i] ]["value"]; $genre = $vals[ $index["GENRE"][$i] ]["value"]; $kind = $vals[ $index["KIND"][$i] ]["value"]; $track = $vals[ $index["TRACK"][$i] ]["value"]; $numtracks = $vals[ $index["NUMTRACKS"][$i] ]["value"]; $year = $vals[$index["YEAR"][$i] ]["value"]; $comments = $vals[ $index["COMMENTS"][$i] ]["value"]; $time = $vals[ $index["TIME"][$i] ]["value"]; $bitrate = $vals[ $index["BITRATE"][$i] ]["value"]; $rating = $vals[ $index["RATING"][$i] ]["value"]; $disc = $vals[ $index["DISC"][$i] ]["value"]; $numdiscs = $vals[ $index["NUMDISCS"][$i] ]["value"]; $playcount = $vals[ $index["PLAYCOUNT"][$i] ]["value"]; $compilation = $vals[ $index["COMPILATION"][$i] ]["value"]; $urlamazon = $vals[ $index["URLAMAZON"][$i] ]["value"]; $urlapple = $vals[ $index["URLAPPLE"][$i] ]["value"]; $imageurl = $vals[ $index["IMAGE"][$i] ]["value"]; $composer = $vals[ $index["COMPOSER"][$i] ]["value"]; $urlsource = $vals[ $index["URLSOURCE"][$i] ]["value"]; $grouping = $vals[ $index["GROUPING"][$i] ]["value"]; $file = $vals[ $index["FILE"][$i] ]["value"]; $artworkID = $vals[ $index["ARTWORKID"][$i] ]["value"]; if ( is_file( "now_playing-" . $artworkID . ".jpg" ) ) { $imageurl = $virtualpath . "now_playing-" . $artworkID . ".jpg"; } else if ( is_file( "now_playing-" . $artworkID . ".png" ) ) { $imageurl = $virtualpath . "now_playing-" . $artworkID . ".png"; } else if ( is_file( "now_playing-" . $artworkID . ".bmp" ) ) { $imageurl = $virtualpath . "now_playing-" . $artworkID . ".bmp"; } else if ( strlen( $grouping ) > 0 && strcmp( $grouping, "Podcast" ) == 0 ) { $imageurl = '/images/podcast.gif'; } else if ( strlen( $imageurl ) == 0 ) { $imageurl = '/images/music-no-image.gif'; } else { list($width, $height, $type, $attr) = getimagesize( $imageurl ); if ( $width == 1 || $height == 1 ) { $imageurl = '/images/music-no-image.gif'; } } # # If we couldn't find them at Amazon, let's just do an artist search at B&N # if ( strlen( $urlamazon ) > 0 ) { $url = $urlamazon; } else if ( strncmp( $comments, "http://", 7 ) == 0 ) { $url = $comments; } else if ( strlen( $urlsource ) > 0 ) { $url = $urlsource; } else { $url = 'http://music.barnesandnoble.com/search/results.asp?NME=' . urlencode( $artist ) . '&SNG=&INS=&LBL=&TYP=P&CAT=&Search=Search'; } # # Output # if ( isset( $_GET["debug"] ) ) { echo "\n"; } } } } } ?>