diff --git a/scripts/common.php b/scripts/common.php index 71fb692..fc05fcd 100644 --- a/scripts/common.php +++ b/scripts/common.php @@ -93,32 +93,12 @@ function debug_log($message) { function get_com_en_name($sci_name) { if (!isset($_labels_flickr)) { - $_labels_flickr = file(get_home() . "/BirdNET-Pi/model/labels_flickr.txt"); - } - $engname = null; - foreach ($_labels_flickr as $label) { - if (trim(explode("_", $label)[0]) === $sci_name) { - $engname = trim(explode("_", $label)[1]); - break; - } + $_labels_flickr = json_decode(file_get_contents(get_home() . "/BirdNET-Pi/model/l18n/labels_en.json"), true); } + $engname = $_labels_flickr[$sci_name]; return $engname; } -function get_sci_name($com_name) { - if (!isset($_labels)) { - $_labels = file(get_home() . "/BirdNET-Pi/model/labels.txt"); - } - $sciname = null; - foreach ($_labels as $label) { - if (trim(explode("_", $label)[1]) === $com_name) { - $sciname = trim(explode("_", $label)[0]); - break; - } - } - return $sciname; -} - function get_label($record, $sort_by, $date=null) { $name = $record["Com_Name"]; if ($sort_by == "confidence") { diff --git a/scripts/play.php b/scripts/play.php index 6aa3d54..1b52079 100644 --- a/scripts/play.php +++ b/scripts/play.php @@ -639,8 +639,9 @@ echo "