mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 02:11:01 +01:00
Update language setup and remove tphakala model handling
This commit is contained in:
@@ -42,27 +42,6 @@ fi
|
|||||||
# General elements
|
# General elements
|
||||||
##################
|
##################
|
||||||
|
|
||||||
# Use tphakala model v2 if enabled
|
|
||||||
if [[ -f "$HOME/BirdNET-Pi/model/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite2" ]]; then
|
|
||||||
mv "$HOME/BirdNET-Pi/model/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite2" "$HOME/BirdNET-Pi/model/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite"
|
|
||||||
fi
|
|
||||||
if [[ -d "$HOME/BirdNET-Pi/model/labels_nm2" ]]; then
|
|
||||||
mv "$HOME/BirdNET-Pi/model/labels_nm2" "$HOME/BirdNET-Pi/model/labels_nm"
|
|
||||||
fi
|
|
||||||
if false && bashio::config.true 'Use_tphakala_model_v2'; then
|
|
||||||
echo "... applying tphakala model v2"
|
|
||||||
if [[ -f "$HOME/BirdNET-Pi/model/BirdNET-Go_classifier.tflite" ]] && [[ -d "$HOME/BirdNET-Pi/model/labels_go" ]]; then
|
|
||||||
# Move labels
|
|
||||||
mv "$HOME/BirdNET-Pi/model/labels_nm" "$HOME/BirdNET-Pi/model/labels_nm2" || bashio::log.warning "Failed to move labels_nm"
|
|
||||||
mv "$HOME/BirdNET-Pi/model/labels_go" "$HOME/BirdNET-Pi/model/labels_nm" || bashio::log.warning "Failed to move labels_go"
|
|
||||||
# Move model
|
|
||||||
mv "$HOME/BirdNET-Pi/model/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite" "$HOME/BirdNET-Pi/model/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite2" || bashio::log.warning "Failed to move base model"
|
|
||||||
mv "$HOME/BirdNET-Pi/model/BirdNET-Go_classifier.tflite" "$HOME/BirdNET-Pi/model/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite" || bashio::log.warning "Failed to move Go classifier"
|
|
||||||
else
|
|
||||||
bashio::log.fatal "model or labels not found, skipping"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Avoid updates
|
# Avoid updates
|
||||||
echo "... modifying the config to silence update indicators"
|
echo "... modifying the config to silence update indicators"
|
||||||
# Remove if two lines
|
# Remove if two lines
|
||||||
@@ -75,15 +54,16 @@ sed -i 's/"\.\$updatediv\.\"//g' "$HOME"/BirdNET-Pi/homepage/views.php
|
|||||||
# Correct language labels according to birdnet.conf
|
# Correct language labels according to birdnet.conf
|
||||||
echo "... adapting labels according to birdnet.conf"
|
echo "... adapting labels according to birdnet.conf"
|
||||||
if export "$(grep "^DATABASE_LANG" /config/birdnet.conf)"; then
|
if export "$(grep "^DATABASE_LANG" /config/birdnet.conf)"; then
|
||||||
export "$(grep "^MODEL" /config/birdnet.conf)"
|
|
||||||
bashio::log.info "Setting language to ${DATABASE_LANG:-en}"
|
bashio::log.info "Setting language to ${DATABASE_LANG:-en}"
|
||||||
if [ "$MODEL" == "BirdNET_GLOBAL_6K_V2.4_Model_FP16" ]; then
|
python3 - <<'PY'
|
||||||
BASEDIR=labels_nm
|
import os
|
||||||
else
|
from scripts.utils.maintainer import create_language
|
||||||
BASEDIR=labels_l18n
|
|
||||||
fi
|
database_lang = os.environ.get("DATABASE_LANG", "en")
|
||||||
label_file_name="labels_${DATABASE_LANG}.txt"
|
|
||||||
ln -sf "$HOME/BirdNET-Pi/model/${BASEDIR}/${label_file_name}" "$HOME/BirdNET-Pi/model/labels.txt" || bashio::log.warning "Failed to update language labels"
|
print(f"Creating translations for {database_lang}")
|
||||||
|
create_language(database_lang)
|
||||||
|
PY
|
||||||
else
|
else
|
||||||
bashio::log.warning "DATABASE_LANG not found in configuration. Using default labels."
|
bashio::log.warning "DATABASE_LANG not found in configuration. Using default labels."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user