refactor: Comment out play_sound event handler and related logic for future use

This commit is contained in:
JSC
2025-07-13 17:39:17 +02:00
parent b17e0db2b0
commit 7226d87a77

View File

@@ -155,45 +155,45 @@ def handle_authenticate(data):
disconnect()
@socketio.on("play_sound")
@require_credits(1)
def handle_play_sound(data):
"""Handle play_sound event from client."""
try:
user = SocketIOService.get_user_from_socketio()
# @socketio.on("play_sound")
# @require_credits(1)
# def handle_play_sound(data):
# """Handle play_sound event from client."""
# try:
# user = SocketIOService.get_user_from_socketio()
if not user:
logger.warning("SocketIO play_sound failed - no authenticated user")
# emit("error", {"message": "Authentication required"})
return
# if not user:
# logger.warning("SocketIO play_sound failed - no authenticated user")
# # emit("error", {"message": "Authentication required"})
# return
user_id = int(user["id"])
sound_id = data.get("soundId")
if not sound_id:
logger.warning("SocketIO play_sound failed - no soundId provided")
SocketIOService.emit_to_user(
user_id, "error", {"message": "Sound ID required"}
)
return
# user_id = int(user["id"])
# sound_id = data.get("soundId")
# if not sound_id:
# logger.warning("SocketIO play_sound failed - no soundId provided")
# SocketIOService.emit_to_user(
# user_id, "error", {"message": "Sound ID required"}
# )
# return
# Import and use the VLC service to play the sound
from app.services.vlc_service import vlc_service
# # Import and use the VLC service to play the sound
# from app.services.vlc_service import vlc_service
logger.info(f"User {user_id} playing sound {sound_id} via SocketIO")
# logger.info(f"User {user_id} playing sound {sound_id} via SocketIO")
# Play the sound using the VLC service
success = vlc_service.play_sound(sound_id, user_id)
# # Play the sound using the VLC service
# success = vlc_service.play_sound(sound_id, user_id)
if not success:
SocketIOService.emit_to_user(
user_id,
"error",
{"message": f"Failed to play sound {sound_id}"},
)
# if not success:
# SocketIOService.emit_to_user(
# user_id,
# "error",
# {"message": f"Failed to play sound {sound_id}"},
# )
except Exception as e:
logger.exception(f"Error handling play_sound event: {e}")
# emit("error", {"message": "Failed to play sound"})
# except Exception as e:
# logger.exception(f"Error handling play_sound event: {e}")
# # emit("error", {"message": "Failed to play sound"})
@socketio.on("disconnect")