Files
sdb2-backend/reset.sh
JSC 92571f4de9
Some checks failed
Backend CI / lint (push) Failing after 1m29s
Backend CI / test (push) Failing after 1m36s
Refactor code structure for improved readability and maintainability
2025-09-13 22:38:55 +02:00

55 lines
1.5 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Reset script for SDB2 soundboard application
# This script removes the database and cleans extracted sounds
set -e # Exit on any error
echo "🔄 Resetting SDB2 application..."
# Change to backend directory
cd "$(dirname "$0")"
# Remove database file if it exists
if [ -f "data/soundboard.db" ]; then
echo "🗑️ Removing database: data/soundboard.db"
rm "data/soundboard.db"
else
echo " Database file not found, skipping"
fi
# List of folders to clean (only files will be deleted, preserving .gitignore)
FOLDERS_TO_CLEAN=(
"sounds/originals/extracted"
"sounds/originals/extracted/thumbnails"
"sounds/originals/text_to_speech"
"sounds/normalized/extracted"
"sounds/normalized/soundboard"
"sounds/normalized/text_to_speech"
"sounds/temp"
)
# Function to clean files in a directory
clean_folder() {
local folder="$1"
if [ -d "$folder" ]; then
echo "🧹 Cleaning folder: $folder"
# Find and delete all files except .gitignore (preserving subdirectories)
find "$folder" -maxdepth 1 -type f -not -name '.gitignore' -delete
echo "✅ Folder cleaned: $folder"
else
echo " Folder not found, skipping: $folder"
fi
}
# Clean all specified folders
echo "🧹 Cleaning specified folders..."
for folder in "${FOLDERS_TO_CLEAN[@]}"; do
clean_folder "$folder"
done
echo "✅ Application reset complete!"
echo "💡 Run 'uv run python run.py' to start fresh"