Refactor code structure for improved readability and maintainability
Some checks failed
Backend CI / lint (push) Failing after 1m29s
Backend CI / test (push) Failing after 1m36s

This commit is contained in:
JSC
2025-09-13 22:38:55 +02:00
parent 1388ede1dc
commit 92571f4de9
4 changed files with 269 additions and 121 deletions

55
reset.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/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"