/** * Handles a jukebox action (play/stop/forward/etc.) * * @author Ben Dodson * @since 8/21/05 **/ function ajaxJukeboxRequest($command, $arg = false) { global $include_path; writeLogData("messages", "Jukebox: Passing command '" . $command . "' to the jukebox"); include_once $include_path . "jukebox/class.php"; if ($command == 'playwhere') { $jbArr = jzJukebox::getJbArr(); // Ok, let's set where they are playing $_SESSION['jb_playwhere'] = $_POST['jbplaywhere']; // Now let's figure out it's ID for ($i = 0; $i < count($jbArr); $i++) { if ($jbArr[$i]['description'] == $_SESSION['jb_playwhere']) { $_SESSION['jb_id'] = $i; break; } } return; } $jb = new jzJukebox(); if ($command == "volume") { $_POST['jbvol'] = $arg; } else { if ($command == "addwhere") { $_POST['addplat'] = $arg; } else { if ($command == "jumpto") { $arg = explode(',', $arg); $_POST['jbjumpto'] = $arg[0]; } else { $_POST['jbSelectedItems'] = explode(',', $arg); } } } $jb->passCommand($command); }
// Do we need to use the standard jukebox or not? // Now did they have a subcommand? if ($jzUSER->getSetting('jukebox_admin') === false && $jzUSER->getSetting('jukebox_queue') === false) { echo 'insufficient permissions.'; exit; } if (isset($_GET['subaction']) or isset($_POST['subaction'])) { // Now let's pass our command if (isset($_REQUEST['command'])) { $command = $_REQUEST['command']; } // Let's include the Jukebox classes writeLogData("messages", "Index: Passing command: " . $command . " to the jukebox"); include_once $include_path . "jukebox/class.php"; $jb = new jzJukebox(); $jb->passCommand($command); } //flushdisplay(); usleep(750000); if (isset($_GET['frame'])) { include_once $include_path . "frontend/frontends/jukezora/topframe.php"; exit; } else { include_once $include_path . "jukebox.php"; exit; } break; case "generateRandom": writeLogData("messages", "Index: Generating a random playlist"); if ($jzUSER->getSetting('stream') === false && $jzUSER->getSetting('lofi') === false) { exit;
function jukebox() { global $jzUSER; if (!isset($_REQUEST['jb_id']) && $_REQUEST['action'] != 'list') { return; } $_SESSION['jb_id'] = $_REQUEST['jb_id']; if (isset($_REQUEST['action'])) { if ($_REQUEST['action'] == 'list') { if ($jzUSER->getSetting('jukebox_admin') === false && $jzUSER->getSetting('jukebox_queue') === false) { echo ""; return; } @(include_once 'jukebox/class.php'); $jbArr = jzJukebox::getJbArr(); foreach ($jbArr as $key => $val) { echo $key . ':' . $val['description'] . "\n"; } } } // Do we need to use the standard jukebox or not? // Now did they have a subcommand? if ($jzUSER->getSetting('jukebox_admin') === false && $jzUSER->getSetting('jukebox_queue') === false) { echo 'insufficient permissions.'; exit; } if (isset($_REQUEST['external_playlist'])) { require_once 'playlists/class.php'; $pl = new JzPlaylist(); $pl->addFromExternal($_REQUEST['external_player']); $pl->jukebox(); // Questions: how to handle addwhere param; // how to bring in media as JzObject (without breaking built-in calls) return; } // Jukebox commands: if (isset($_REQUEST['command'])) { $command = $_REQUEST['command']; // Let's include the Jukebox classes writeLogData("messages", "API: Passing command: " . $command . " to the jukebox"); include_once "jukebox/class.php"; $jb = new jzJukebox(); $jb->passCommand($command); } }