feat: Implement playlist management routes and integrate with music player service

This commit is contained in:
JSC
2025-07-12 15:17:45 +02:00
parent 93897921fb
commit 842e1dff13
5 changed files with 413 additions and 55 deletions

View File

@@ -538,6 +538,7 @@ class StreamProcessingService:
"""Add a sound to the main playlist."""
try:
from app.models.playlist import Playlist
from app.services.music_player_service import music_player_service
# Find the main playlist
main_playlist = Playlist.find_main_playlist()
@@ -546,6 +547,9 @@ class StreamProcessingService:
# Add sound to the main playlist
main_playlist.add_sound(sound.id, commit=True)
logger.info(f"Added sound {sound.id} to main playlist")
# Reload the playlist in music player if it's the current one
music_player_service.reload_current_playlist_if_modified(main_playlist.id)
else:
logger.warning("Main playlist not found - sound not added to any playlist")