20 lines
501 B
Bash
Executable File
20 lines
501 B
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
# Create config if it doesn't exist
|
|
if [ ! -f /app/config.json ]; then
|
|
echo '{"libraryPath":"/data/music","port":4000}' > /app/config.json
|
|
fi
|
|
|
|
# Run database initialization
|
|
node -e "import('./src/database/db.js').then(m => m.initDatabase())"
|
|
|
|
# Check if we need to scan the library
|
|
if [ ! -f /app/audio_server.db ] || [ "$SCAN_ON_START" = "true" ]; then
|
|
echo "Scanning music library..."
|
|
node src/scripts/scanLibrary.js /data/music || true
|
|
fi
|
|
|
|
# Start the server
|
|
exec npm start
|