} } break; case 'bookmark': if (isset($_POST['path'])) { if (saveBookmark($redis, $_POST['path'])) { ui_notify('Bookmark saved', $_POST['path'] . ' added to bookmarks'); ui_libraryHome($redis); } else { ui_notify('Error saving bookmark', 'please try again later'); } } if (isset($_POST['id'])) { if (deleteBookmark($redis, $_POST['id'])) { ui_notify('Bookmark deleted', '"' . $_POST['name'] . '" successfully removed'); ui_libraryHome($redis); } else { ui_notify('Error deleting bookmark', 'Please try again later'); } } break; case 'dirble': if ($activePlayer === 'MPD') { $proxy = $redis->hGetall('proxy'); $dirblecfg = $redis->hGetAll('dirble'); if (isset($_POST['querytype'])) { // if ($_POST['querytype'] === 'amountStation') { if ($_POST['querytype'] === 'amountStation') { $dirble = json_decode(curlGet($dirblecfg['baseurl'] . 'amountStation/apikey/' . $dirblecfg['apikey'], $proxy)); echo $dirble->amount; }
function ui_update($redis, $sock) { ui_libraryHome($redis); switch ($redis->get('activePlayer')) { case 'MPD': if ($redis->get('pl_length') !== '0') { sendMpdCommand($sock, 'swap 0 0'); } else { sendMpdCommand($sock, 'clear'); } // return MPD response return readMpdResponse($sock); break; case 'Spotify': sendSpopCommand($sock, 'repeat'); sendSpopCommand($sock, 'repeat'); // return SPOP response return readSpopResponse($sock); break; } }