feat: Implement Music Player Service with VLC integration

- Added MusicPlayerService for managing VLC music playback with playlist support.
- Implemented methods for loading playlists, controlling playback (play, pause, stop, next, previous), and managing volume and play modes.
- Integrated real-time synchronization with VLC state using a background thread.
- Added SocketIO event emissions for player state updates.
- Enhanced logging for better debugging and tracking of player state changes.

fix: Improve SocketIO service logging and event handling

- Added detailed logging for SocketIO events and user authentication.
- Implemented a test event handler to verify SocketIO functionality.
- Enhanced error handling and logging for better traceability.

chore: Update dependencies and logging configuration

- Added python-vlc dependency for VLC integration.
- Configured logging to show INFO and DEBUG messages for better visibility during development.
- Updated main application entry point to allow unsafe Werkzeug for debugging purposes.
This commit is contained in:
JSC
2025-07-07 20:51:53 +02:00
parent c44b055f83
commit e7d958eb39
8 changed files with 1050 additions and 14 deletions

16
main.py
View File

@@ -1,3 +1,4 @@
import logging
from dotenv import load_dotenv
from app import create_app, socketio
@@ -5,11 +6,24 @@ from app import create_app, socketio
# Load environment variables from .env file
load_dotenv()
# Configure logging to show all INFO and DEBUG messages
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
datefmt='%H:%M:%S'
)
# Set specific loggers to DEBUG for detailed SocketIO and music player logs
logging.getLogger('app.services.socketio_service').setLevel(logging.DEBUG)
logging.getLogger('app.services.music_player_service').setLevel(logging.INFO)
def main() -> None:
"""Run the Flask application with SocketIO."""
app = create_app()
socketio.run(app, debug=True, host="0.0.0.0", port=5000)
socketio.run(
app, debug=True, host="0.0.0.0", port=5000, allow_unsafe_werkzeug=True
)
if __name__ == "__main__":