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