/** * createRadioSongPlaylistForCurrentTrack function. * * @access public * @param mixed $w * @return void */ function createRadioSongPlaylistForCurrentTrack($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]); createRadioSongPlaylist($w, $results[0], $results[4], $results[1]); } else { displayNotificationWithArtwork("Cannot get current track", './images/warning.png', 'Error!'); } }
/** * createRadioSongPlaylistForCurrentTrack function. * * @access public * @param mixed $w * @return void */ function createRadioSongPlaylistForCurrentTrack($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]); createRadioSongPlaylist($w, $results[0], $results[4], $results[1]); } else { displayNotificationWithArtwork("There is not track currently playing", './images/warning.png', 'Error!'); } }