LIRC libraries: list-remotes.py

| LIRC libraries LinuxInfraredRemoteControl

list-remotes.py
1 '''
2
3 Get list of available remotes from lircd server. Run using
4 LIRC_SOCKET_PATH=... python3 list-remotes.py
5
6 '''
7
8 import sys
9
10 import lirc
11
12 if len(sys.argv) >= 2:
13 sys.stderr.write("Usage: list-remotes.py [socket path]")
14 sys.exit(1)
15 path = sys.argv[1] if len(sys.argv) == 2 else None
16
17 with lirc.client.CommandConnection(path) as conn:
18 reply = lirc.client.ListRemotesCommand(conn).run()
19 print(reply.data[0])
20
21 # conn.send(command.cmd_string)
22 # while not command.parser.is_completed():
23 # line = conn.readline(0.1)
24 # command.parser.feed(line)
25 # if not command.parser.result == lirc.client.Result.OK:
26 # print("Cannot get version string")
27 # else:
28 # print(command.parser.data[0])