diff --git a/bin/cron.php b/bin/cron.php index 46de21d..8a3ea40 100644 --- a/bin/cron.php +++ b/bin/cron.php @@ -10,7 +10,8 @@ echo "Filtering invalid entries...\n"; $mobs = array_filter($mobs, fn ($mob) => !str_starts_with($mob, "id=") && !str_contains($mob, "Old ") && - $mob != "NPC" && $mob != "Agent" && + $mob != "NPC" && + $mob != "Agent" && !str_ends_with($mob, "Ghost") && $mob != "Giant" && $mob != "Killer Bunny" @@ -22,6 +23,9 @@ $mobs = array_map(fn ($mob) => [ "image" => getImage($mob) ], $mobs); +echo "Removing non-existing images...\n"; +$mobs = array_filter($mobs, fn ($mob) => $mob["image"] != ""); + echo "Removing duplicates...\n"; $mobs = array_reduce($mobs, function ($mobs, $mob) { $urls = array_map(fn ($mob) => $mob["image"], $mobs); diff --git a/lib/updateData.php b/lib/updateData.php index 0136f92..55b47f7 100644 --- a/lib/updateData.php +++ b/lib/updateData.php @@ -69,7 +69,12 @@ function getImageUrlFromName(string $filename): string { } function getImage(string $name): string { - return getImageUrlFromName(getImageName($name)); + $name = getImageName($name); + if ($name == "") { + return ""; + } else { + return getImageUrlFromName($name); + } } function downloadImage(string $url, string $mobname): string {