/** * playAlfredPlaylist function. * * @access public * @param mixed $w * @return void */ function playAlfredPlaylist($w) { // // Read settings from JSON // $settings = getSettings($w); $is_alfred_playlist_active = $settings->is_alfred_playlist_active; $alfred_playlist_uri = $settings->alfred_playlist_uri; $alfred_playlist_name = $settings->alfred_playlist_name; $use_mopidy = $settings->use_mopidy; if ($alfred_playlist_uri == "" || $alfred_playlist_name == "") { displayNotificationWithArtwork("Alfred Playlist is not set", './images/warning.png'); return; } if ($use_mopidy) { playUriWithMopidy($w, $alfred_playlist_uri); } else { exec("osascript -e 'tell application \"Spotify\" to play track \"{$alfred_playlist_uri}\"'"); addPlaylistToPlayQueue($w, $alfred_playlist_uri, $alfred_playlist_name); } $playlist_artwork_path = getPlaylistArtwork($w, $alfred_playlist_uri, true, true); displayNotificationWithArtwork('🔈 Alfred Playlist ' . $alfred_playlist_name, $playlist_artwork_path, 'Play Alfred Playlist'); }
return; } } if ($use_mopidy) { playUriWithMopidy($w, $playlist_uri); } else { exec("osascript -e 'tell application \"Spotify\" to play track \"{$playlist_uri}\"'"); } if ($playlist_artwork_path == '') { $playlist_artwork_path = getPlaylistArtwork($w, $playlist_uri, true, false); } displayNotificationWithArtwork('🔈 Playlist ' . $playlist_name, $playlist_artwork_path, 'Launch Playlist'); if ($userid != 'vdesabou') { stathat_ez_count('AlfredSpotifyMiniPlayer', 'play', 1); } addPlaylistToPlayQueue($w, $playlist_uri, $playlist_name); return; } } else { if ($type == "ALBUM") { if ($album_uri == "") { if ($track_uri == "") { displayNotificationWithArtwork("Cannot get current album", './images/warning.png', 'Error!'); return; } // case of current song with alt $album_uri = getAlbumUriFromTrack($w, $track_uri); if ($album_uri == false) { displayNotificationWithArtwork("Cannot get current album", './images/warning.png', 'Error!'); return; }