Ejemplo n.º 1
0
/**
 * addArtistToPlayQueue function.
 *
 * @access public
 * @param mixed $w
 * @param mixed $artist_uri
 * @param mixed $artist_name
 * @param mixed $country_code
 * @return void
 */
function addArtistToPlayQueue($w, $artist_uri, $artist_name, $country_code)
{
    if (!$w->internet()) {
        return false;
    }
    $tracks = getTheArtistFullTracks($w, $artist_uri, $country_code);
    if ($tracks == false) {
        displayNotificationWithArtwork("Cannot get tracks for artist " . $artist_name, './images/warning.png', 'Error!');
        return false;
    }
    $playqueue = array("type" => "artist", "uri" => $artist_uri, "name" => escapeQuery($artist_name), "current_track_index" => 0, "tracks" => $tracks);
    $w->write($playqueue, 'playqueue.json');
}
/**
 * addArtistToPlayQueue function.
 *
 * @access public
 * @param mixed $w
 * @param mixed $artist_uri
 * @param mixed $artist_name
 * @param mixed $country_code
 * @return void
 */
function addArtistToPlayQueue($w, $artist_uri, $artist_name, $country_code)
{
    if (!$w->internet()) {
        return false;
    }
    //
    // Read settings from JSON
    //
    $settings = getSettings($w);
    $use_mopidy = $settings->use_mopidy;
    $country_code = $settings->country_code;
    if (!$use_mopidy) {
        $tracks = getTheArtistFullTracks($w, $artist_uri, $country_code);
        if ($tracks == false) {
            displayNotificationWithArtwork($w, "Cannot get tracks for artist " . $artist_name, './images/warning.png', 'Error!');
            return false;
        }
    } else {
        $tracks = array();
    }
    $playqueue = array("type" => "artist", "uri" => $artist_uri, "name" => escapeQuery($artist_name), "current_track_index" => 0, "tracks" => $tracks);
    $w->write($playqueue, 'playqueue.json');
}