from pythonosc.dispatcher import Dispatcher
from pythonosc.osc_server import BlockingOSCUDPServer
from datetime import datetime

HOST = "127.0.0.1"
PORT = 9001

def on_any(address, *args):
    now = datetime.now().strftime("%H:%M:%S")
    print(f"[INFO] {now} address={address} args={args}", flush=True)

dispatcher = Dispatcher()
dispatcher.set_default_handler(on_any)

print("[CHECK] OSC受信開始")
print(f"[INFO] host={HOST}")
print(f"[INFO] port={PORT}")
print("[ACTION] VRChatでメニューを押してください")

server = BlockingOSCUDPServer((HOST, PORT), dispatcher)
server.serve_forever()
