Static db path

https://github.com/alexbelgium/hassio-addons/issues/1730
This commit is contained in:
Alexandre
2025-01-19 18:30:22 +01:00
committed by GitHub
parent 9f6e7bcdff
commit e20e81a9a7

View File

@@ -108,11 +108,11 @@ if [ -f /config/birdnet.db ]; then
CHECK_QUERY="SELECT COUNT(*) FROM notes WHERE clip_name LIKE '%//%';"
UPDATE_QUERY="UPDATE notes SET clip_name = REPLACE(clip_name, '//', '/') WHERE clip_name LIKE '%//%';"
# Check for occurrences of '//' in clip_name
COUNT=$(sqlite3 "$DB_FILE" "$CHECK_QUERY")
COUNT=$(sqlite3 /config/birdnet.db "$CHECK_QUERY")
if [ "$COUNT" -gt 0 ]; then
echo "Found $COUNT rows with '//' in clip_name. Running the update query..."
sqlite3 "$DB_FILE" "$UPDATE_QUERY"
sqlite3 /config/birdnet.db "$UPDATE_QUERY"
echo "Update completed"
fi
fi