From bd0d44b9c9e69ff4b6200a9ecae96032c1cd6766 Mon Sep 17 00:00:00 2001 From: smashery Date: Tue, 21 Mar 2023 16:47:12 +1100 Subject: [PATCH] Fix de-sync between models and labels --- scripts/config.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/scripts/config.php b/scripts/config.php index 6912af4..fc76879 100644 --- a/scripts/config.php +++ b/scripts/config.php @@ -107,20 +107,8 @@ if(isset($_GET["latitude"])){ } elseif (file_exists('./scripts/firstrun.ini')) { $lang_config = parse_ini_file('./scripts/firstrun.ini'); } - if ($language != $lang_config['DATABASE_LANG']){ - $user = trim(shell_exec("awk -F: '/1000/{print $1}' /etc/passwd")); - $home = trim(shell_exec("awk -F: '/1000/{print $6}' /etc/passwd")); - // Archive old language file - syslog_shell_exec("cp -f $home/BirdNET-Pi/model/labels.txt $home/BirdNET-Pi/model/labels.txt.old", $user); - - // Install new language label file - syslog_shell_exec("$home/BirdNET-Pi/scripts/install_language_label.sh -l $language", $user); - - syslog(LOG_INFO, "Successfully changed language to '$language'"); - } - - if ($model != $lang_config['MODEL']){ + if ($model != $lang_config['MODEL'] || $language != $lang_config['DATABASE_LANG']){ $user = trim(shell_exec("awk -F: '/1000/{print $1}' /etc/passwd")); $home = trim(shell_exec("awk -F: '/1000/{print $6}' /etc/passwd")); @@ -134,7 +122,7 @@ if(isset($_GET["latitude"])){ syslog_shell_exec("$home/BirdNET-Pi/scripts/install_language_label.sh -l $language", $user); } - syslog(LOG_INFO, "Successfully changed language to '$language'"); + syslog(LOG_INFO, "Successfully changed language to '$language' and model to '$model'"); }