Cleaned up code

This commit is contained in:
2021-06-11 19:08:27 +02:00
parent f5b751409e
commit 209aee5632
2 changed files with 92 additions and 103 deletions
+5 -8
View File
@@ -106,11 +106,10 @@ class osu_parser
continue; // this line has been analyzed continue; // this line has been analyzed
} }
if (mb_strpos($line, "//") === 0 || // the editor puts hella lot of comments in the files if (!(mb_strpos($line, "//") === 0 || // the editor puts hella lot of comments in the files
$section_type === false) $section_type === false))
{ {
} if ($section_type == "key-value pairs")
else if ($section_type == "key-value pairs")
{ {
// init empty array // init empty array
if (!isset($parsed[$current_section])) $parsed[$current_section] = array(); if (!isset($parsed[$current_section])) $parsed[$current_section] = array();
@@ -144,9 +143,6 @@ class osu_parser
list($event_type, $source_files) = self::gather_source_files($list, $variables); list($event_type, $source_files) = self::gather_source_files($list, $variables);
if ($event_type === false)
{
}
else if ($event_type == "Background") else if ($event_type == "Background")
{ {
$parsed["background"] = $source_files[0] ?? ""; $parsed["background"] = $source_files[0] ?? "";
@@ -155,7 +151,7 @@ class osu_parser
{ {
$parsed["video"] = $source_files[0] ?? ""; $parsed["video"] = $source_files[0] ?? "";
} }
else else if ($event_type !== false)
{ {
// init empty array // init empty array
if (!isset($parsed["storyboard"])) $parsed["storyboard"] = array(); if (!isset($parsed["storyboard"])) $parsed["storyboard"] = array();
@@ -208,6 +204,7 @@ class osu_parser
} }
} }
} }
}
unset($file); // remove the memory leak unset($file); // remove the memory leak
// storyboards/hitsounds are overloaded with dupes (renumber to make json export to arrays) // storyboards/hitsounds are overloaded with dupes (renumber to make json export to arrays)
+1 -9
View File
@@ -1,12 +1,4 @@
<?php <?php
// todo: cleanup repacker
// todo: cleanup cache
// todo: cleanup db
// todo: cleanup settings (full reset)
// todo: whitelist / blacklist
// todo: dupe checker
// todo: stardiff deleter
// todo: mode deleter
// git does not like empty folders // git does not like empty folders
if (!file_exists("session")) mkdir("session"); if (!file_exists("session")) mkdir("session");
@@ -33,7 +25,7 @@ $display = "start";
if (isset($_GET["settings"]) || empty($settings->get_osu_path())) if (isset($_GET["settings"]) || empty($settings->get_osu_path()))
{ {
// $display = "start"; $display = "start";
} }
else if (isset($_GET["cleanup"])) else if (isset($_GET["cleanup"]))
{ {