Fix the Qt4 bindings and link to libshairport dynamically
[deb_shairplay.git] / src / test / test.py
1 import time
2 from struct import *
3 from Shairplay import *
4
5 hwaddr = pack('BBBBBB', 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB)
6 class SampleCallbacks(RaopCallbacks):
7 def audio_init(self, bits, channels, samplerate):
8 print "Initializing", bits, channels, samplerate
9 def audio_process(self, session, buffer):
10 print "Processing", + len(buffer), "bytes of audio"
11 def audio_destroy(self, session):
12 print "Destroying"
13 def audio_set_volume(self, session, volume):
14 print "Set volume to", volume
15 def audio_set_metadata(self, session, metadata):
16 print "Got", len(metadata), "bytes of metadata"
17 def audio_set_coverart(self, session, coverart):
18 print "Got", len(coverart), "bytes of coverart"
19
20 shairplay = LoadShairplay(".")
21 callbacks = SampleCallbacks()
22
23 raop = RaopService(shairplay, 10, callbacks)
24 port = raop.start(5000, hwaddr)
25
26 dnssd = DnssdService(shairplay)
27 dnssd.register_raop("RAOP test", port, hwaddr)
28
29 time.sleep(50)
30
31 dnssd.unregister_raop()
32 raop.stop()
33
34 del dnssd
35 del raop
36