function seperateSimilar($array) { if (!is_array($array) || sizeof($array) == 0) { $ret = array(); $ret['nonmatches'] = array(); $ret['matches'] = array(); return $ret; } // We don't want more artists in the array than we came with. // The searching is what actually needs to be improved (with operator = "exact-or") $ret = array(); $root = new jzMediaNode(); $found = $root->search($array, "nodes", distanceTo('artist'), sizeof($array), "or"); $ret['matches'] = $found; // Now let's remove the matches: $matches = array(); foreach ($found as $e) { $matches[] = $e->getName(); } $nonmatches = array(); foreach ($array as $entry) { $foundit = false; foreach ($matches as $match) { if (0 == strcmp(strtolower($match), strtolower($entry))) { // Found it $foundit = true; break; } } if (!$foundit) { $nonmatches[] = $entry; } } $ret['nonmatches'] = $nonmatches; return $ret; }
} if (isset($_POST['searchDupAlbums'])) { $distance = distanceTo("album"); $what = "nodes"; } // Ok, now we need to get a list of ALL artist so we can show possible dupes echo word("Retrieving full list...") . "<br><br>"; flushdisplay(); $root = new jzMediaNode(); $artArray = $root->getSubNodes($what, $distance); for ($i = 0; $i < count($artArray); $i++) { $valArray[] = $artArray[$i]->getName(); } echo word("Scanning full list...") . "<br><br>"; flushdisplay(); $found = $root->search($valArray, $what, $distance, sizeof($valArray), "exact"); foreach ($found as $e) { $matches[] = $e->getName(); echo $e->getName() . '<br>'; flushdisplay(); } $this->closeBlock(); exit; } $arr = array(); $arr['action'] = "popup"; $arr['ptype'] = "dupfinder"; echo '<form action="' . urlize($arr) . '" method="POST">'; echo "<br><br>"; echo "<center>"; echo word("Please select what you would like to search for") . "<br><br><br>";