def __new__(cls, uri, debugger): vr = re.match(r'vr:(?P<hostname>[^:]*)(:(?P<port>\d+))?', uri) if vr: d = vr.groupdict() return VirtualRemote.listen(d['hostname'], int(d['port'] or 2033), debugger) lirc = re.match(r'lirc:(?P<lircd_socket>[^:]*):(?P<control_name>.*)', uri) if lirc: d = lirc.groupdict() return LircRemote.listen(d['lircd_socket'] or '/var/run/lirc/lircd', d['control_name'], debugger) f = re.match('file://(?P<filename>.+)', uri) if f: return FileRemote.listen(f.group('filename'), debugger) raise ConfigurationError('Invalid remote control recorder URI: "%s"' % uri)
def __new__(cls, uri, debugger): vr = re.match(r'vr:(?P<hostname>[^:]*)(:(?P<port>\d+))?', uri) if vr: d = vr.groupdict() return VirtualRemote.listen(d['hostname'], int(d['port'] or 2033), debugger) lirc = re.match(r'lirc:(?P<lircd_socket>[^:]*):(?P<control_name>.*)', uri) if lirc: d = lirc.groupdict() return LircRemote.listen( d['lircd_socket'] or '/var/run/lirc/lircd', d['control_name'], debugger) f = re.match('file://(?P<filename>.+)', uri) if f: return FileRemote.listen(f.group('filename'), debugger) raise ConfigurationError('Invalid remote control recorder URI: "%s"' % uri)
def listener(): # "* 2" is once for VirtualRemote's __init__ and once for press. for _ in range(len(keys) * 2): for k in VirtualRemote.listen('localhost', 2033, self._debugger): received.append(k)