pyliblo icon indicating copy to clipboard operation
pyliblo copied to clipboard

Glob pattern matching not working on handler

Open daylanKifky opened this issue 6 years ago • 1 comments

I'm trying to add a method to a simple glob handler like:

"/message/raw/*"

I know C liblo supports this kind of pattern matching. But I'm getting wrong results with pyliblo. When running this:

from __future__ import print_function
import sys
import liblo
import threading

osc_receive_address = '' , 50419

try:
	server = liblo.Server(osc_receive_address[1])
except liblo.ServerError as err:
	print(err)
	sys.exit()


def wildcard(path, args, types, src):
	print("**** Got Wildcard message '%s' '%s' ***" % (path, args))

def fallback(path, args, types, src):
	print("got unknown message '%s' '%s'" % (path, args))
	

server.add_method("/message/raw/*", None, wildcard)
server.add_method(None, None, fallback)


def serve():
	while True:
		server.recv(100)
	
	server.free()


st = threading.Thread( target = serve )
st.start()

I would expect the first message to be handled by the wildcard method. But it is the fallback one to be used on both cases.

(messages)

oscsend localhost 50419 /message/raw/foo T
oscsend localhost 50419 /message/raw T

(server printed)

got unknown message '/message/raw/foo' [True]
got unknown message '/message/raw' [True]

daylanKifky avatar Jun 24 '19 14:06 daylanKifky

Hello, this was not supported in liblo in fact. I have just added it: https://github.com/radarsat1/liblo/commit/efea904078f1fde89c93d1d880c2d2180098c221

radarsat1 avatar Aug 30 '20 18:08 radarsat1