Fixing changeIt.php

This commit is contained in:
Kasper Rynning-Tønnesen
2014-10-10 18:07:49 +02:00
parent 7e7e664d7b
commit 0c417921a9

View File

@@ -10,22 +10,26 @@
{ {
$file = file_get_contents("oldFiles/".$list); $file = file_get_contents("oldFiles/".$list);
$data = json_decode($file); $data = json_decode($file);
for($i = 0; $i < count($data[0]); $i++) if(count($data) > 0)
{ {
if($i > 0) $array = array("nowPlaying" => array(), "songs" => array(), "conf" => array("startTime" => time(), "views" => 0, "skips" => array()));
for($i = 0; $i < count($data[0]); $i++)
{ {
if($i > 0)
{
$arr = "songs"; $arr = "songs";
}
else{
$arr = "nowPlaying";
}
$array[$arr][$data[0][0]] = array("id" => $data[0][0], "title" => str_replace("\"", "\'", $data[3][0]), "votes" => 0, "added" => time(), "guids" => array());
array_shift($data[0]);
array_shift($data[3]);
} }
else{ file_put_contents("oldFiles/".$list, json_encode($array));
$arr = "nowPlaying"; echo $list."\n";
}
$array[$arr][$data[0][0]] = array("id" => $data[0][0], "title" => str_replace("\"", "\'", $data[3][0]), "votes" => 0, "added" => time(), "guids" => array());
array_shift($data[0]);
array_shift($data[3]);
} }
file_put_contents("oldFiles/".$list, json_encode($array));
echo $list."\n";
} }
} }
?> ?>