/** * Constructor for the class. * * @author Ross Carlson * @version 2/9/05 * @since 2/9/05 */ function jzJukebox() { global $include_path, $jbArr; jzJukebox::getJbArr(); // Ok, now we need to include the right subclass for this player // TODO: make getting jukebox by description the only available method. if (isset($_SESSION['jb_id']) && !is_numeric($_SESSION['jb_id'])) { foreach ($jbArr as $id => $jb) { if ($jb['description'] == $_SESSION['jb_id']) { $_SESSION['jb_id'] = $id; $this->id = $id; break; } } } if (!isset($_SESSION['jb_id']) || $_SESSION['jb_id'] >= sizeof($jbArr)) { $_SESSION['jb_id'] = 0; } if ($this->id === false) { $this->id = $_SESSION['jb_id']; } // Now let's make sure they have installed the jukebox if (!isset($jbArr[0]['type'])) { // Let's take them through the installer $this->install(); } writeLogData("messages", "Jukebox: building the jukebox object of type " . $this->getSetting('type')); include_once $include_path . "jukebox/jukeboxes/" . $this->getSetting('type') . ".php"; }
/** Updates a node's cache nonrecursively. * * @author Ben Dodson */ function updateNodeCache($node, $recursive = false, $showStatus = false, $force = false, $readTags = true, $root_path = false) { global $media_dirs, $live_update, $jzSERVICES, $hierarchy, $backend, $default_importer, $jukebox, $include_path; $flags = array(); $flags['showstatus'] = $showStatus; $flags['force'] = $force; $flags['readtags'] = $readTags; $flags['recursive'] = $recursive; $importer = $default_importer; // TODO: more dynamic choice of importer. if (false !== stristr($importer, "id3tags")) { // id3tag importer doesn't care about your hierarchy. // TODO: seperate hierarchy for display / import. } else { // TODO: Remove this stuff once we have a propper way // of getting the path from the node. Make // the function recursive with respect to the node. $mypath = array(); if (false !== ($val = getInformation($node, "genre"))) { $mypath['genre'] = $val; } if (false !== ($val = getInformation($node, "subgenre"))) { $mypath['subgenre'] = $val; } if (false !== ($val = getInformation($node, "artist"))) { $mypath['artist'] = $val; } if (false !== ($val = getInformation($node, "album"))) { $mypath['album'] = $val; } if (false !== ($val = getInformation($node, "disk"))) { $mypath['disk'] = $val; } $flags['path'] = $mypath; $flags['hierarchy'] = array_slice($hierarchy, sizeof($mypath), sizeof($hierarchy) - sizeof($mypath)); } $jzSERVICES->loadService("importing", $importer); // TODO: Move flags array into parameters of this function. /*if ($flags['recursive']) { @ini_set("max_execution_time","0"); @ini_set("memory_limit","64"); }*/ if ($node->getLevel() == 0 && $root_path === false) { $mediapaths = explode("|", $media_dirs); for ($i = 0; $i < sizeof($mediapaths); $i++) { if (is_dir($mediapaths[$i]) && $mediapaths[$i] != "/" && $mediapaths[$i] != "") { //$node->updateCache($recursive,$mediapaths[$i], $showStatus,$force,$readTags); $jzSERVICES->importMedia($node, $mediapaths[$i], $flags); } } } else { //$node->updateCache($recursive,$root_path,$showStatus,$force, $readTags); $jzSERVICES->importMedia($node, $root_path, $flags); if ($recursive === false && $node->getSubNodeCount('tracks', -1) == 0) { //$node->updateCache(true,$root_path,$showStatus,$force,$readTags); $flags['recursive'] = true; $jzSERVICES->importMedia($node, $root_path, $flags); } } if ($jukebox == "true") { include_once $include_path . "jukebox/class.php"; $jb = new jzJukebox(); $jb->updateDB($node, $recursive, $root_path); } }
/** * Creates a small version of the jukebox block. * * @author Ben Dodson * @since 4/29/05 * @version 4/29/05 * @param text: the text to display in the box. 'off' means no text. * @buttons: one of: "top|default|off". Top means toggle with the header text when applicable. **/ function smallJukebox($text = false, $buttons = "default", $linebreaks = true) { global $jbArr, $jzUSER, $include_path, $jukebox_display; if ($text == "") { $text = false; } $display = new jzDisplay(); include_once $include_path . "jukebox/class.php"; $jb = new jzJukebox(); if (!$jb->connect()) { echo '<strong>Error connecting to jukebox. Please make sure your jukebox settings are correct. (jukebox/settings.php)</strong>'; $jb_playwhere = ""; } else { if (isset($_SESSION['jb_playwhere'])) { $jb_playwhere = $_SESSION['jb_playwhere']; } else { $jb_playwhere = "stream"; } } $url_array = array(); $url_array['action'] = "popup"; $url_array['ptype'] = "jukezora"; ?> <script> sm_text = '<?php echo $text; ?> '; sm_buttons = '<?php echo $buttons; ?> '; sm_linebreaks = '<?php echo $linebreaks; ?> '; </script> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td width="100%" valign="top"> <?php $showText = true; if ($buttons == "top" && checkPermission($jzUSER, "jukebox_admin") === true && $_SESSION['jb_playwhere'] != "stream") { // Ok, now we need to make sure we can do things $func = $jb->jbAbilities(); echo "<nobr>"; if ($func['playbutton']) { $display->displayJukeboxButton("play"); $showText = false; } if ($func['pausebutton']) { $display->displayJukeboxButton("pause"); $showText = false; } if ($func['stopbutton']) { $display->displayJukeboxButton("stop"); $showText = false; } if ($func['nextbutton']) { $display->displayJukeboxButton("previous"); $showText = false; } if ($func['prevbutton']) { $display->displayJukeboxButton("next"); $showText = false; } if ($func['shufflebutton']) { //$display->displayJukeboxButton("random_play"); //$showText = false; } if ($func['clearbutton']) { $display->displayJukeboxButton("clear"); $showText = false; } echo "</nobr>"; } if ($showText) { ?> <?php if (isNothing($text)) { ?> <font size="1"> <strong> <?php if (checkPlayback() == "jukebox") { $theJWord = word("Jukebox"); } else { $theJWord = word("Playback"); } $display->popupLink("jukezora", $theJWord); if (checkPlayback() == "jukebox") { $jz_jbstatus = $jb->getPlayerStatus(); echo " - " . ucwords($jz_jbstatus); } ?> </strong> </font> <?php } else { if ($text != "off") { echo $text; } } ?> <?php } ?> </td> </tr> <tr> <td width="100%" valign="top"> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "playwhere"; ?> <form action="<?php echo urlize($arr); ?> " method="POST" name="playbackForm"> <select name="jbplaywhere" id="smallJukeboxSelect" class="jz_select" style="width:132;" onChange="updateSmallJukebox()"> <?php if (checkPermission($jzUSER, 'stream')) { ?> <option value="stream">Stream</option> <?php } // Now let's get a list of all the jukeboxes that are installed for ($i = 0; $i < count($jbArr); $i++) { echo '<option '; if ($jb_playwhere == $jbArr[$i]['description']) { echo " selected "; } echo 'value="' . $jbArr[$i]['description'] . '">' . $jbArr[$i]['description'] . '</option>'; } ?> </select> </form> <?php if ($linebreaks) { echo '</td></tr><tr><td width="100%">'; } else { echo "   "; } if ($jb_playwhere != "stream" && checkPermission($jzUSER, "jukebox_admin") === true && $buttons == "default") { // Ok, now we need to make sure we can do things $func = $jb->jbAbilities(); echo "<nobr>"; if ($func['playbutton']) { $display->displayJukeboxButton("play"); } if ($func['pausebutton']) { $display->displayJukeboxButton("pause"); } if ($func['stopbutton']) { $display->displayJukeboxButton("stop"); } if ($func['nextbutton']) { $display->displayJukeboxButton("previous"); } if ($func['prevbutton']) { $display->displayJukeboxButton("next"); } if ($func['shufflebutton']) { //$display->displayJukeboxButton("random_play"); } if ($func['clearbutton']) { $display->displayJukeboxButton("clear"); } echo "</nobr>"; } ?> </td> </tr> </table> <?php }
function doTemplate($node) { global $jzUSER; $display =& new jzDisplay(); $smarty = mobileSmarty(); $jb = new jzJukebox(); if (!$jb->connect()) { //jzTemplate($smarty,'jukeboxError'); echo 'Error connecting to jukebox.'; return; } $smarty->assign('Play', word('Play')); $smarty->assign('Pause', word('Pause')); $smarty->assign('Stop', word('Stop')); $smarty->assign('Previous', word('Previous')); $smarty->assign('Next', word('Next')); $smarty->assign('Shuffle', word('Shuffle')); $smarty->assign('Clear', word('Clear')); /* buttons */ if (checkPermission($jzUSER, "jukebox_admin")) { $func = $jb->jbAbilities(); if ($func['playbutton']) { $smarty->assign('openPlayTag', $display->getOpenJukeboxActionTag('play')); } if ($func['pausebutton']) { $smarty->assign('openPauseTag', $display->getOpenJukeboxActionTag('pause')); } if ($func['stopbutton']) { $smarty->assign('openStopTag', $display->getOpenJukeboxActionTag('stop')); } if ($func['prevbutton']) { $smarty->assign('openPrevTag', $display->getOpenJukeboxActionTag('previous')); } if ($func['nextbutton']) { $smarty->assign('openNextTag', $display->getOpenJukeboxActionTag('next')); } if ($func['shufflebutton']) { $smarty->assign('openShuffleTag', $display->getOpenJukeboxActionTag('random_play')); } if ($func['clearbutton']) { $smarty->assign('openClearTag', $display->getOpenJukeboxActionTag('clear')); } if ($func['volume']) { $smarty->assign('Volume', word('Volume:')); $smarty->assign('volumeSteps', range(0, 100, 5)); $vol = $_SESSION['jz_jbvol-' . $_SESSION['jb_id']]; if (!isset($vol) || !is_numeric($vol)) { $vol = 0; } $smarty->assign('currentVolume', $vol); } if ($func['addtype']) { /* how to add media */ $smarty->assign('whereAdd', word('Add media:')); function jbHREF($type) { return "javascript:sendJukeboxRequest('addwhere','{$type}');"; } $set = array(); $set[] = array('href' => jbHREF('current'), 'label' => 'After current track', 'selected' => $_SESSION['jb-addtype'] == "current"); $set[] = array('href' => jbHREF('begin'), 'label' => 'At beginning of playlist', 'selected' => $_SESSION['jb-addtype'] == "begin"); $set[] = array('href' => jbHREF('end'), 'label' => 'At end of playlist', 'selected' => $_SESSION['jb-addtype'] == "end"); $set[] = array('href' => jbHREF('replace'), 'label' => 'Replace current playlist', 'selected' => $_SESSION['jb-addtype'] == "replace"); $smarty->assign('addTypes', $set); } } jzTemplate($smarty, 'jukebox'); }
/** * Sends the playlist to the jukebox * * @author Ross Carlson * @version 2/10/05 * @since 2/10/05 */ function jukebox($playlist = false) { global $include_path, $web_root, $root_dir, $media_dir, $audio_mimes, $playlist_ext; if ($playlist === false) { $playlist = $this; } // Now let's create the jukebox object include_once $include_path . "jukebox/class.php"; $jb = new jzJukebox(); $jb->passPlaylist($playlist); }
case "jukebox": // 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) {
<?php if (!defined(JZ_SECURE_ACCESS)) { die('Security breach detected.'); } include_once $include_path . "jukebox/class.php"; ?> <script> var jb_types = ["stream"]; <?php $jbArr = jzJukebox::getJbArr(); for ($i = 0; $i < count($jbArr); $i++) { echo 'jb_types.push("' . $jbArr[$i]['type'] . "\");\n"; } ?> function setJbFormCommand(cmd) { document.getElementById('jbPlaylistForm').elements['command'].value = cmd; } function setPlayback(obj) { playback = obj.options[obj.selectedIndex].value; if (playback != "stream") { playback = "jukebox"; } else { playback = streamto; } // javascript hook for a jukebox if (playback == "jukebox" && jb_types[obj.selectedIndex] == "junction") {
$_SESSION['jb_playwhere'] = "stream"; } else { if ($_SESSION['jb_playwhere'] != 'quickbox') { $_SESSION['jb_playwhere'] = $jbArr[0]['description']; } } } $jb_playwhere = $_SESSION['jb_playwhere']; ?> <table width="100%" cellpadding="0" cellspacing="0" border="0" class="jz_block_td" height="100%"> <tr> <td width="5%" valign="top" height="100%"> <nobr> <?php // Now let's create our Jukebox class and connect to it to make sure it works $jb = new jzJukebox(); if (!$jb->connect()) { echo "We had a problem connecting to the player, sorry this is a fatal error!<br><br>"; echo "Player Settings:<br>"; for ($i = 0; $i < count($jbArr); $i++) { if ($jbArr[$i]['description'] == $_SESSION['jb_playwhere']) { foreach ($jbArr[$i] as $setting => $value) { echo $setting . " - " . $value . "<br>"; } } } echo "<br>Please check these with your player's settings"; echo "<br>"; ?> Playback to:<br> <?php
/** * Draws the play controller for the Jukezora interface * * @author Ross Carlson * @version 01/21/05 * @since 01/21/05 */ function jukeboxBlock() { global $this_page, $media_dirs, $jbArr, $root_dir, $include_path; $display = new jzDisplay(); include_once $include_path . "jukebox/class.php"; if (!isset($_SESSION['jb_playwhere'])) { $_SESSION['jb_playwhere'] = "stream"; } $jb_playwhere = $_SESSION['jb_playwhere']; ?> <table width="100%" cellpadding="2" cellspacing="0" border="0" class="jz_block_td" height="100%"> <tr> <td width="50%" valign="top" height="100%"> <nobr> <?php // Now let's create our Jukebox class and connect to it to make sure it works $jb = new jzJukebox(); if (!$jb->connect()) { echo "We had a problem connecting to the player, sorry this is a fatal error!<br><br>"; echo "Player Settings:<br>"; for ($i = 0; $i < count($jbArr); $i++) { if ($jbArr[$i]['description'] == $_SESSION['jb_playwhere']) { foreach ($jbArr[$i] as $setting => $value) { echo $setting . " - " . $value . "<br>"; } } } echo "<br>Please check these with your player's settings"; echo "<br>"; ?> Playback to:<br> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "playwhere"; ?> <form action="<?php echo urlize($arr); ?> " method="post"> <select name="jbplaywhere" class="jz_select" style="width:142;" onChange="submit()"> <option <?php if ($jb_playwhere == "stream") { echo " selected "; } ?> value="stream">Stream</option> <?php // Now let's get a list of all the jukeboxes that are installed for ($i = 0; $i < count($jbArr); $i++) { echo '<option '; if ($jb_playwhere == $jbArr[$i]['description']) { echo " selected "; } echo 'value="' . $jbArr[$i]['description'] . '">' . $jbArr[$i]['description'] . '</option>'; } ?> </select> </form> <?php return; } // Let's figure out where they are playing if (isset($_SESSION['jb_playwhere'])) { $jb_playwhere = $_SESSION['jb_playwhere']; } else { $jb_playwhere = ""; } $remain = $jb->getCurrentTrackRemaining() + 1; $jz_jbstatus = $jb->getPlayerStatus(); if ($jz_jbstatus != "playing") { $remain = 0; } if ($remain == 1) { $remain = 0; } if ($jb_playwhere != "stream") { // Ok, now we need to make sure we can do things $func = $jb->jbAbilities(); if ($func['playbutton']) { $display->displayJukeboxButton("play"); } if ($func['pausebutton']) { $display->displayJukeboxButton("pause"); } if ($func['stopbutton']) { $display->displayJukeboxButton("stop"); } if ($func['shufflebutton']) { $display->displayJukeboxButton("random_play"); } echo "<br>"; if ($func['nextbutton']) { $display->displayJukeboxButton("previous"); } if ($func['prevbutton']) { $display->displayJukeboxButton("next"); } if ($func['clearbutton']) { $display->displayJukeboxButton("clear"); } ?> <br> <?php if ($func['status']) { ?> Status: <?php echo ucwords($jz_jbstatus); ?> <br> <?php } ?> <?php if ($func['stats']) { $jb->returnJBStats(); echo '<br>'; } ?> <?php if ($func['progress']) { ?> Progress: <span id="timer"></span> <script> <!--// var loadedcolor='green' ; // PROGRESS BAR COLOR var unloadedcolor='lightgrey'; // BGCOLOR OF UNLOADED AREA var barheight=10; // HEIGHT OF PROGRESS BAR IN PIXELS var barwidth=120; // WIDTH OF THE BAR IN PIXELS var bordercolor='black'; // COLOR OF THE BORDER var waitTime=<?php echo $remain; ?> ; // NUMBER OF SECONDS FOR PROGRESSBAR --> </script> <script language="javascript" src="<?php echo $root_dir; ?> /jukebox/pbar.js"></script> <?php if ($jz_jbstatus == 'playing') { ?> <script> <!--// var seconds = <?php echo $jb->getCurrentTrackLocation(); ?> ; var time = ''; t = document.getElementById("timer"); function converTime(sec){ ctr=0; while (sec >= 60){ sec = sec - 60; ctr++; } if (ctr<0){ctr=0} if (sec<0){sec=0} if (sec < 10){ sec = "0" + sec; } return ctr + ":" + sec; } function display(){ seconds++ t.innerHTML = converTime(seconds) + "/" + "<?php echo convertSecMins($jb->getCurrentTrackLength()); ?> "; ctr=0; setTimeout("display()",1000) } display() --> </script> <?php } ?> <?php } ?> <?php if ($func['volume']) { ?> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "volume"; $arr['frame'] = $_GET['frame']; ?> <form action="<?php echo urlize($arr); ?> " method="post"> <input type="hidden" name="action" value="jukebox"> <input type="hidden" name="subaction" value="jukebox-command"> <input type="hidden" name="command" value="volume"> <input type="hidden" name="frame" value="top"> <select name="jbvol" class="jz_select" style="width:120px;" onChange="submit()"> <?php $vol = ""; if (isset($_SESSION['jz_jbvol-' . $_SESSION['jb_id']])) { $vol = $_SESSION['jz_jbvol-' . $_SESSION['jb_id']]; } $c = 100; while ($c > 0) { echo '<option '; if ($c == $vol) { echo ' selected '; } echo 'value="' . $c . '">Volume ' . $c . '%</option>'; $c = $c - 10; } ?> <option value="0">Mute</option> </select> </form> <br> <?php } ?> <?php // This closes our if to see if we are streaming or not } ?> Playback to:<br> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "playwhere"; $arr['frame'] = $_GET['frame']; ?> <form action="<?php echo urlize($arr); ?> " method="post"> <input type="hidden" name="action" value="jukebox"> <input type="hidden" name="subaction" value="jukebox-command"> <input type="hidden" name="command" value="playwhere"> <input type="hidden" name="frame" value="top"> <select name="jbplaywhere" class="jz_select" style="width:120px;" onChange="submit()"> <option <?php if ($jb_playwhere == "stream") { echo " selected "; } ?> value="stream">Stream</option> <?php // Now let's get a list of all the jukeboxes that are installed for ($i = 0; $i < count($jbArr); $i++) { echo '<option '; if ($jb_playwhere == $jbArr[$i]['description']) { echo " selected "; } echo 'value="' . $jbArr[$i]['description'] . '">' . $jbArr[$i]['description'] . '</option>'; } ?> </select> </form> <?php if ($jb_playwhere != "stream" and $func['addtype']) { ?> <br> Add type:<br> <?php // Now let's set the add type IF it hasn't been set if (!isset($_SESSION['jb-addtype'])) { $_SESSION['jb-addtype'] = "current"; } ?> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "addwhere"; $arr['frame'] = $_GET['frame']; ?> <form action="<?php echo urlize($arr); ?> " method="post"> <input type="hidden" name="action" value="jukebox"> <input type="hidden" name="subaction" value="jukebox-command"> <input type="hidden" name="command" value="addwhere"> <select name="addplat" class="jz_select" style="width:142;" onChange="submit()"> <option <?php if ($_SESSION['jb-addtype'] == "current") { echo " selected "; } ?> value="current">At Current</option> <option <?php if ($_SESSION['jb-addtype'] == "end") { echo " selected "; } ?> value="end">At End</option> <option <?php if ($_SESSION['jb-addtype'] == "begin") { echo " selected "; } ?> value="begin">At Beginning</option> <option <?php if ($_SESSION['jb-addtype'] == "replace") { echo " selected "; } ?> value="replace">Replace</option> </select> </form> </nobr> <?php } ?> </td> <td width="50%" valign="top"> <?php // Let's make sure they aren't streaming if ($jb_playwhere == "stream") { return; } ?> <?php if ($func['nowplaying']) { ?> <nobr><?php echo word("Now Playing:"); ?> <br> <?php $curTrack = $jb->getCurrentTrackName(); if (strlen($curTrack) > 20) { $curTrack = substr($curTrack, 0, 20) . "..."; } echo ' ' . $curTrack . "</nobr>"; ?> <br> <?php } ?> <?php if ($func['nexttrack']) { ?> <nobr><?php echo word("Next Track:"); ?> <br> <?php // Now let's figure out the next track and clean it up $fullList = $jb->getCurrentPlaylist(); if (getCurPlayingTrack() + 1 < sizeof($fullList)) { $nextTrack = $fullList[getCurPlayingTrack() + 1]; } else { $nextTrack = '-'; } if (stristr($nextTrack, "/")) { $nArr = explode("/", $nextTrack); $nextTrack = $nArr[count($nArr) - 1]; } $nextTrack = str_replace(".mp3", "", $nextTrack); if (strlen($nextTrack) > 20) { $nextTrack = substr($nextTrack, 0, 20) . "..."; } echo ' ' . $nextTrack . "</nobr>"; ?> <br><br> <?php } ?> <?php if ($func['fullplaylist']) { ?> Complete Playlist <br> <?php // Now let's get the full playlist back $curTrackNum = $jb->getCurrentPlayingTrack(); ?> <?php $arr = array(); $arr['action'] = "jukebox"; $arr['subaction'] = "jukebox-command"; $arr['command'] = "jumpto"; ?> <form action="<?php echo urlize($arr); ?> " method="post"> <input type="hidden" name="action" value="jukebox"> <input type="hidden" name="subaction" value="jukebox-command"> <input type="hidden" name="command" value="jumpto"> <input type="hidden" name="frame" value="top"> <select name="jbjumpto" class="jz_select" size="5" style="width:165px;"<?php if ($func['jump']) { echo 'onChange="submit()"'; } ?> > <?php for ($i = 0; $i < count($fullList); $i++) { echo '<option value="' . $i . '"'; if ($curTrackNum == $i) { echo " selected "; } echo '>' . $fullList[$i] . '</option>'; } ?> </select> </form> <?php } ?> </td> </tr> </table> <?php }
/** * Returns the AJAX code for the small jukebox * * @author Ben Dodson * @since 8/21/05 * @param new_jb: the jukebox to change to. **/ function ajaxSmallJukebox($new_jb = false, $text = false, $buttons = false, $linebreaks = false) { global $include_path; writeLogData("messages", "Jukebox: Displaying the small jukebox interface"); $blocks = new jzBlocks(); if ($new_jb !== false) { // Change the jukebox include_once $include_path . "jukebox/class.php"; $jbArr = jzJukebox::getJbArr(); for ($i = 0; $i < count($jbArr); $i++) { if ($jbArr[$i]['description'] == $new_jb) { $_SESSION['jb_id'] = $i; } } $_POST['jbplaywhere'] = $new_jb; ajaxJukeboxRequest('playwhere'); } $blocks->smallJukebox($text, $buttons, $linebreaks); }
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); } }