<? echo isset($_SESSION['displaylib']) && $_SESSION['displaylib'] == 1 ? 1 : 0;?>/*is enabled?*/, <? echo isset($_SESSION['displaylibastab']) && $_SESSION['displaylibastab'] == 1 ? 1 : 0;?>/*display as tab or in browse view?*/, <? echo $sezione == 'index' ? 1 : 0; ?>/*should load it?*/ ); </script> <!--[if lt IE 8]> <script src="js/icon-font-ie7.js"></script> <script src="js/icon-font-ie7-24.js"></script> <![endif]--> <?php // write backend response on UI Notify popup if (isset($_SESSION['notify']) && $_SESSION['notify'] != '') { sleep(1); ui_notify($_SESSION['notify']); session_start(); $_SESSION['notify'] = ''; session_write_close(); } ?> <div id="debug" <?php if ($_SESSION['hiddendebug'] == 1 or $_SESSION['debug'] == 0) { echo "class=\"hide\""; } ?> > <pre> <?php debug_footer($db);
if ($_GET['switchplayer'] === 'Spotify') { if ($redis->hGet('spotify', 'enable') === '1') { $switchOK = 1; } else { $switchOK = 0; } } if ($switchOK === 1 or $_GET['switchplayer'] === 'MPD') { // switch player engine $jobID = wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'switchplayer', 'args' => $_GET['switchplayer'])); $notification = new stdClass(); $notification->title = 'Switch Player'; $notification->text = 'Switch player backend started...'; wrk_notify($redis, 'startjob', $notification, $jobID); } else { ui_notify('Spotify not enabled', 'Enable and configure it under the Settings screen'); } } elseif (isset($_GET['cmd']) && $_GET['cmd'] !== '') { // debug // runelog('MPD command: ',$_GET['cmd']); if ($_GET['cmd'] === 'renderui') { if ($activePlayer === 'MPD') { $socket = $mpd; } elseif ($activePlayer === 'Spotify') { $socket = $spop; } $response = ui_update($redis, $socket); } elseif ($_GET['cmd'] === 'wifiscan') { wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'wificfg', 'action' => 'scan')); echo 'wlan scan queued'; die;
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; } // Get primaryCategories if ($_POST['querytype'] === 'categories' or $_POST['querytype'] === 'primaryCategories') {
function ui_mpd_response($mpd, $notify = null) { runelog('ui_mpd_response invoked'); $response = json_encode(readMpdResponse($mpd)); // --- TODO: check this condition if (strpos($response, "OK") && isset($notify)) { runelog('send UI notify: ', $notify); ui_notify($notify['title'], $notify['text']); } echo $response; }