phpsearchgracenotealbumart

PHP-Gracenote library doesn't return an album_art_url


The demo file from the php-gracenote library doesn't return an album_art_url. "Moby" is the default search query. Even when I change the search query to something else it still doesn't return an album_art_url.

Is the library broken or does Gracenote disable album_art_url in searches?


Solution

  • This is a limitation of Gracenote's API. It only returns album art when doing a SINGLE_BEST lookup (called BEST_MATCH_ONLY in the php-gracenote library).

    You can pass an extra parameter into any of the search functions of php-gracenote to get album art, but you'll only get the single best result rather than multiple results.

    // No album art, but multiple results.
    $api->searchArtist("Moby");
    
    // You get album art, but only one result.
    $api->searchArtist("Moby", Gracenote\WebAPI\GracenoteWebAPI::BEST_MATCH_ONLY);