Compare commits

...

4 Commits

5 changed files with 39 additions and 10 deletions

View File

@@ -1,5 +1,3 @@
version: '3.8'
services:
carplay-audio:
build: .
@@ -10,13 +8,13 @@ services:
volumes:
# Mount your music library (change the left path to your music folder)
- /Volumes/Data/Music:/data/music:ro
# Persistent data (database, artwork, config)
- ./data/artwork:/app/artwork
- ./data/database:/app
- ./config.json:/app/config.json
# Persistent data (database and artwork stored in data directory)
- ./data:/app/data
environment:
- NODE_ENV=production
- PORT=4000
- DB_PATH=/app/data/audio_server.db
- LIBRARY_PATH=/data/music
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:4000/health"]
interval: 30s

View File

@@ -1,7 +1,8 @@
import sqlite3 from 'sqlite3';
import { promisify } from 'util';
const db = new sqlite3.Database('./audio_server.db');
const dbPath = process.env.DB_PATH || './audio_server.db';
const db = new sqlite3.Database(dbPath);
const run = promisify(db.run.bind(db));
const get = promisify(db.get.bind(db));

View File

@@ -10,7 +10,8 @@ await initDatabase();
// Load config to get library path
const config = await loadConfig();
const libraryPath = process.argv[2] || config.libraryPath;
// Override with environment variable if set
const libraryPath = process.argv[2] || process.env.LIBRARY_PATH || config.libraryPath;
// Resolve path
const resolvedPath = path.isAbsolute(libraryPath)

View File

@@ -18,6 +18,10 @@ const app = express();
// Load config
const config = await loadConfig();
// Override with environment variables if set
if (process.env.LIBRARY_PATH) {
config.libraryPath = process.env.LIBRARY_PATH;
}
const PORT = process.env.PORT || config.port || 3000;
// Middleware
@@ -51,7 +55,12 @@ const libraryPath = path.isAbsolute(config.libraryPath)
? config.libraryPath
: path.join(process.cwd(), config.libraryPath);
app.use('/audio', express.static(libraryPath));
app.use('/artwork', express.static(path.join(process.cwd(), 'artwork')));
// Artwork can be in data directory (Docker) or root (local)
const artworkPath = process.env.NODE_ENV === 'production'
? path.join(process.cwd(), 'data', 'artwork')
: path.join(process.cwd(), 'artwork');
app.use('/artwork', express.static(artworkPath));
// Health check
app.get('/health', (req, res) => {

View File

@@ -37,12 +37,32 @@
- [x] User management
- [x] Now playing
- [x] Full Amperfy compatibility
- [x] Docker deployment with docker-compose
- [x] Persistent data volumes
- [x] Environment variable configuration
- [x] Library scanning in Docker
- [x] Pushed to Gitea repository
- [x] Production-ready deployment
## Todo
## Project Complete! ✅
**CarPlay Audio Streaming Server is fully operational:**
- 🎵 Streaming music to Amperfy and CarPlay
- 🐳 Docker containerized for easy deployment
- 🔄 Git repository on Gitea for version control
- 🌐 Accessible via HTTPS through Cloudflare Tunnel
- 📊 Web admin panel for management
- 🎨 Album artwork support
- 📁 Folder/artist/album browsing
- 🔍 Full search functionality
- 📋 Playlist management
## Future Enhancements (Optional)
- [ ] Implement favorites/starred tracking in database
- [ ] Add play count tracking
- [ ] Optimize cover art caching
- [ ] Add transcoding support
- [ ] Multi-user support with authentication
- [ ] Enhanced user authentication
- [ ] Multiple user support
- [ ] Advanced filtering