Ads play once on channel 11, separate from music

- Add dedicated ad playback system (no loop, own channel)
- Ad channel defaults to 11, saved/loaded with audio settings
- Separate play_ad/stop_ad methods and API endpoints
- Frontend stop button now calls /api/ads/stop instead of stopMusic

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 22:35:07 -07:00
parent aa3899b1fc
commit 9452b07c5c
3 changed files with 104 additions and 5 deletions

View File

@@ -1298,16 +1298,22 @@ async def get_ads():
@app.post("/api/ads/play")
async def play_ad(request: MusicRequest):
"""Play an ad on the music channel"""
"""Play an ad once on the ad channel (ch 11)"""
ad_path = settings.ads_dir / request.track
if not ad_path.exists():
raise HTTPException(404, "Ad not found")
audio_service.load_music(str(ad_path))
audio_service.play_music()
audio_service.play_ad(str(ad_path))
return {"status": "playing", "track": request.track}
@app.post("/api/ads/stop")
async def stop_ad():
"""Stop ad playback"""
audio_service.stop_ad()
return {"status": "stopped"}
# --- LLM Settings Endpoints ---
@app.get("/api/settings")