/** 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); } }