Exemplo n.º 1
0
/**
 * createRadioArtistPlaylistForCurrentArtist function.
 *
 * @access public
 * @param mixed $w
 * @return void
 */
function createRadioArtistPlaylistForCurrentArtist($w)
{
    //
    // Read settings from JSON
    //
    $settings = getSettings($w);
    $use_mopidy = $settings->use_mopidy;
    if ($use_mopidy) {
        $retArr = array(getCurrentTrackInfoWithMopidy($w));
    } else {
        // get info on current song
        exec("./src/track_info.ksh 2>&1", $retArr, $retVal);
        if ($retVal != 0) {
            displayNotificationWithArtwork('AppleScript Exception: ' . htmlspecialchars($retArr[0]) . ' use spot_mini_debug command', './images/warning.png', 'Error!');
            exec("osascript -e 'tell application \"Alfred 2\" to search \"spot_mini_debug AppleScript Exception: " . htmlspecialchars($retArr[0]) . "\"'");
            return;
        }
    }
    if (isset($retArr[0]) && substr_count($retArr[0], '▹') > 0) {
        $results = explode('▹', $retArr[0]);
        createRadioArtistPlaylist($w, $results[1]);
    } else {
        displayNotificationWithArtwork("Cannot get current artist", './images/warning.png', 'Error!');
    }
}
Exemplo n.º 2
0
/**
 * createRadioArtistPlaylistForCurrentArtist function.
 *
 * @access public
 * @param mixed $w
 * @return void
 */
function createRadioArtistPlaylistForCurrentArtist($w)
{
    exec("./src/track_info.ksh 2>&1", $retArr, $retVal);
    if ($retVal != 0) {
        displayNotificationWithArtwork('AppleScript Exception: ' . htmlspecialchars($retArr[0]) . ' use spot_mini_debug command', './images/warning.png', 'Error!');
        exec("osascript -e 'tell application \"Alfred 2\" to search \"spot_mini_debug AppleScript Exception: " . htmlspecialchars($retArr[0]) . "\"'");
        return;
    }
    if (isset($retArr[0]) && substr_count($retArr[0], '▹') > 0) {
        $results = explode('▹', $retArr[0]);
        createRadioArtistPlaylist($w, $results[1]);
    } else {
        displayNotificationWithArtwork("Cannot get current artist", './images/warning.png', 'Error!');
    }
}
Exemplo n.º 3
0
         } else {
             invokeMopidyMethod($w, "core.tracklist.set_random", array('value' => true));
             $command_output = "Shuffle is now enabled.";
         }
     } else {
         $command_output = exec("osascript -e '\n\t    \ttell application \"Spotify\"\n\t    \tif shuffling enabled is true then\n\t    \t\tif shuffling is true then\n\t\t\t\t\tset shuffling to false\n\t\t\t\t\treturn \"Shuffle is now disabled.\"\n\t\t\t\telse\n\t\t\t\t\tset shuffling to true\n\t\t\t\t\treturn \"Shuffle is now enabled.\"\n\t\t\t\tend if\n\t\t\telse\n\t\t\t\treturn \"Shuffle is not currently enabled.\"\n\t\t\tend if\n\t\t\tend tell'");
     }
     displayNotificationWithArtwork($command_output, './images/shuffle.png', 'Shuffle');
     return;
 } else {
     if ($other_action == "radio_artist") {
         if (file_exists($w->data() . '/update_library_in_progress')) {
             displayNotificationWithArtwork("Cannot modify library while update is in progress", './images/warning.png', 'Error!');
             return;
         }
         createRadioArtistPlaylist($w, $artist_name);
         if ($userid != 'vdesabou') {
             stathat_ez_count('AlfredSpotifyMiniPlayer', 'radio', 1);
         }
         return;
     } else {
         if ($other_action == "complete_collection_artist") {
             if (file_exists($w->data() . '/update_library_in_progress')) {
                 displayNotificationWithArtwork("Cannot modify library while update is in progress", './images/warning.png', 'Error!');
                 return;
             }
             createCompleteCollectionArtistPlaylist($w, $artist_name, $artist_uri);
             return;
         } else {
             if ($other_action == "play_alfred_playlist") {
                 playAlfredPlaylist($w);