Update the python bindings to work with current version
[deb_shairplay.git] / src / test / test.py
CommitLineData
8be1424a
JVH
1import time
2from struct import *
3from Shairplay import *
4
5hwaddr = pack('BBBBBB', 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB)
094e4ad1
JVH
6class SampleCallbacks(RaopCallbacks):
7 def audio_init(self, bits, channels, samplerate):
8 print "Initializing " + str(bits) + " " + str(channels) + " " + str(samplerate)
9 def audio_process(self, session, buffer):
10 print "Processing " + str(len(buffer)) + " bytes of audio"
8be1424a
JVH
11
12shairplay = LoadShairplay(".")
094e4ad1 13callbacks = SampleCallbacks()
8be1424a 14
094e4ad1 15raop = RaopService(shairplay, callbacks)
8be1424a
JVH
16port = raop.start(5000, hwaddr)
17
18dnssd = DnssdService(shairplay)
094e4ad1 19dnssd.register_raop("RAOP test", port, hwaddr)
8be1424a
JVH
20
21time.sleep(50)
22
23dnssd.unregister_raop()
24raop.stop()
094e4ad1
JVH
25
26del dnssd
8be1424a
JVH
27del raop
28