Added delete after skip

Same as the delete after play function
This commit is contained in:
KasperRT
2014-10-21 01:39:52 +02:00
parent 9e1e0bda66
commit cc1d5965ef

View File

@@ -139,18 +139,23 @@ else if(isset($_GET['skip'])){ //skip song request
//$data["conf"]["skips"]=$skips; //$data["conf"]["skips"]=$skips;
if($skips>=$viewers/2){ if($skips>=$viewers/2){
array_shift($data["songs"]); array_shift($data["songs"]);
$data["songs"][$np[0]["id"]] = array("id" => $np[0]["id"], "title" => $np[0]["title"], "votes" => $np[0]["votes"], "added" => time(), "guids" => array()); $q = $data["conf"];
array_shift($data["nowPlaying"]); $q = array_key_exists("delsongs", $q);
$data["nowPlaying"][$firstSong[0]["id"]] = array("id" => $firstSong[0]["id"], "title" => $firstSong[0]["title"], "votes" => 0, "added" => $firstSong[0]["added"], "guids" => $firstSong[0]["guids"]); if(!$data["conf"]["delsongs"] || $q != 1)
//array_push($data["songs"], $add); {
$data["conf"]["skips"] = array(); $data["songs"][$np[0]["id"]] = array("id" => $np[0]["id"], "title" => $np[0]["title"], "votes" => $np[0]["votes"], "added" => time(), "guids" => array());
$data["conf"]["startTime"] = time(); }
$data["conf"]["views"] = 1; array_shift($data["nowPlaying"]);
foreach($data["songs"] as $k=>$v) { $data["nowPlaying"][$firstSong[0]["id"]] = array("id" => $firstSong[0]["id"], "title" => $firstSong[0]["title"], "votes" => 0, "added" => $firstSong[0]["added"], "guids" => $firstSong[0]["guids"]);
$sort['votes'][$k] = $v['votes']; //array_push($data["songs"], $add);
$sort['added'][$k] = $v['added']; $data["conf"]["skips"] = array();
} $data["conf"]["startTime"] = time();
array_multisort($sort['votes'], SORT_DESC, $sort['added'], SORT_ASC, $data["songs"]); $data["conf"]["views"] = 1;
foreach($data["songs"] as $k=>$v) {
$sort['votes'][$k] = $v['votes'];
$sort['added'][$k] = $v['added'];
}
array_multisort($sort['votes'], SORT_DESC, $sort['added'], SORT_ASC, $data["songs"]);
} }
file_put_contents($list, json_encode($data)); file_put_contents($list, json_encode($data));
} }