update install_language_label.sh and callers
This commit is contained in:
+6
-17
@@ -130,22 +130,6 @@ if(isset($_GET["latitude"])){
|
||||
sleep(3);
|
||||
}
|
||||
}
|
||||
if ($model != $config['MODEL'] || $language != $config['DATABASE_LANG']){
|
||||
if(strlen($language) == 2){
|
||||
|
||||
// Archive old language file
|
||||
syslog_shell_exec("cp -f $home/BirdNET-Pi/model/labels.txt $home/BirdNET-Pi/model/labels.txt.old", $user);
|
||||
|
||||
if($model == "BirdNET_GLOBAL_6K_V2.4_Model_FP16"){
|
||||
// Install new language label file
|
||||
syslog_shell_exec("chmod +x $home/BirdNET-Pi/scripts/install_language_label_nm.sh && $home/BirdNET-Pi/scripts/install_language_label_nm.sh -l $language", $user);
|
||||
} else {
|
||||
syslog_shell_exec("$home/BirdNET-Pi/scripts/install_language_label.sh -l $language", $user);
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully changed language to '$language' and model to '$model'");
|
||||
}
|
||||
}
|
||||
|
||||
$contents = file_get_contents("/etc/birdnet/birdnet.conf");
|
||||
$contents = preg_replace("/SITE_NAME=.*/", "SITE_NAME=\"$site_name\"", $contents);
|
||||
@@ -189,7 +173,12 @@ if(isset($_GET["latitude"])){
|
||||
fwrite($appriseconfig, $apprise_input);
|
||||
$apprise_config = $apprise_input;
|
||||
}
|
||||
|
||||
if ($model != $config['MODEL'] || $language != $config['DATABASE_LANG']){
|
||||
if(strlen($language) == 2){
|
||||
syslog_shell_exec("$home/BirdNET-Pi/scripts/install_language_label.sh", $user);
|
||||
syslog(LOG_INFO, "Successfully changed language to '$language' and model to '$model'");
|
||||
}
|
||||
}
|
||||
syslog(LOG_INFO, "Restarting Services");
|
||||
shell_exec("sudo restart_services.sh");
|
||||
}
|
||||
|
||||
@@ -1,34 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage() { echo "Usage: $0 -l <language i18n id>" 1>&2; exit 1; }
|
||||
|
||||
while getopts "l:" o; do
|
||||
case "${o}" in
|
||||
l)
|
||||
lang=${OPTARG}
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
source /etc/birdnet/birdnet.conf
|
||||
HOME=/home/${BIRDNET_USER}
|
||||
if [ "$MODEL" == "BirdNET_GLOBAL_6K_V2.4_Model_FP16" ]; then
|
||||
BASEDIR=/home/$BIRDNET_USER/BirdNET-Pi/model/labels_nm
|
||||
else
|
||||
BASEDIR=/home/$BIRDNET_USER/BirdNET-Pi/model/labels_l18n
|
||||
fi
|
||||
|
||||
label_file_name="labels_${lang}.txt"
|
||||
label_file_name="labels_${DATABASE_LANG}.txt"
|
||||
|
||||
unzip -o $HOME/BirdNET-Pi/model/labels_l18n.zip $label_file_name \
|
||||
-d $HOME/BirdNET-Pi/model \
|
||||
&& mv -f $HOME/BirdNET-Pi/model/$label_file_name $HOME/BirdNET-Pi/model/labels.txt \
|
||||
&& logger "[$0] Changed language label file to '$label_file_name'";
|
||||
|
||||
label_file_name_flickr="labels_en.txt"
|
||||
|
||||
unzip -o $HOME/BirdNET-Pi/model/labels_l18n.zip $label_file_name_flickr \
|
||||
-d $HOME/BirdNET-Pi/model \
|
||||
&& mv -f $HOME/BirdNET-Pi/model/$label_file_name_flickr $HOME/BirdNET-Pi/model/labels_flickr.txt \
|
||||
&& logger "[$0] Set Flickr labels '$label_file_name_flickr'";
|
||||
|
||||
exit 0
|
||||
ln -sf ${BASEDIR}/${label_file_name} $HOME/BirdNET-Pi/model/labels.txt
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage() { echo "Usage: $0 -l <language i18n id>" 1>&2; exit 1; }
|
||||
|
||||
while getopts "l:" o; do
|
||||
case "${o}" in
|
||||
l)
|
||||
lang=${OPTARG}
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
source /etc/birdnet/birdnet.conf
|
||||
HOME=/home/${BIRDNET_USER}
|
||||
|
||||
label_file_name="labels_${lang}.txt"
|
||||
|
||||
unzip -o $HOME/BirdNET-Pi/model/labels_nm.zip $label_file_name \
|
||||
-d $HOME/BirdNET-Pi/model \
|
||||
&& mv -f $HOME/BirdNET-Pi/model/$label_file_name $HOME/BirdNET-Pi/model/labels.txt \
|
||||
&& logger "[$0] Changed language label file to '$label_file_name'";
|
||||
|
||||
label_file_name_flickr="labels_en.txt"
|
||||
|
||||
unzip -o $HOME/BirdNET-Pi/model/labels_nm.zip $label_file_name_flickr \
|
||||
-d $HOME/BirdNET-Pi/model \
|
||||
&& mv -f $HOME/BirdNET-Pi/model/$label_file_name_flickr $HOME/BirdNET-Pi/model/labels_flickr.txt \
|
||||
&& logger "[$0] Set Flickr labels '$label_file_name_flickr'";
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user