Changeset 49e3d00fb36203be049e055aa6c0f4283d419c14
- Timestamp:
- 11/28/06 00:55:00
(2 years ago)
- Author:
- Jason Michalski <armooo@armooo.net>
- git-committer:
- Jason Michalski <armooo@armooo.net> 1164696900 +0000
- git-parent:
[b9245da7891242ec6b47b1f5257e75e14b49f817]
- git-author:
- Jason Michalski <armooo@armooo.net> 1164696900 +0000
- Message:
pyTivo
- Stop the beacon should exit cleanly now
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rb9245da |
r49e3d00 |
|
| 31 | 31 | self.UDPSock.sendto(self.format_beacon(), ('255.255.255.255', 2190)) |
|---|
| 32 | 32 | |
|---|
| 33 | | def send_beacon_timer(self): |
|---|
| | 33 | def start(self): |
|---|
| 34 | 34 | self.send_beacon() |
|---|
| 35 | | t = Timer(60, self.send_beacon_timer) |
|---|
| 36 | | t.start() |
|---|
| | 35 | self.timer = Timer(60, self.start) |
|---|
| | 36 | self.timer.start() |
|---|
| | 37 | |
|---|
| | 38 | def stop(self): |
|---|
| | 39 | self.timer.cancel() |
|---|
| 37 | 40 | |
|---|
| 38 | 41 | if __name__ == '__main__': |
|---|
| rb9245da |
r49e3d00 |
|
| 15 | 15 | b = beacon.Beacon() |
|---|
| 16 | 16 | b.add_service('TiVoMediaServer:' + str(port) + '/http') |
|---|
| 17 | | b.send_beacon_timer() |
|---|
| | 17 | b.start() |
|---|
| 18 | 18 | |
|---|
| 19 | | httpd.serve_forever() |
|---|
| | 19 | try: |
|---|
| | 20 | httpd.serve_forever() |
|---|
| | 21 | except KeyboardInterrupt: |
|---|
| | 22 | b.stop() |
|---|
| rb9245da |
r49e3d00 |
|
| 37 | 37 | b = beacon.Beacon() |
|---|
| 38 | 38 | b.add_service('TiVoMediaServer:' + str(port) + '/http') |
|---|
| 39 | | b.send_beacon_timer() |
|---|
| | 39 | b.start() |
|---|
| 40 | 40 | |
|---|
| 41 | 41 | while 1: |
|---|
| … | … | |
| 46 | 46 | rc = win32event.WaitForSingleObject(self.stop_event, 5) |
|---|
| 47 | 47 | if rc == win32event.WAIT_OBJECT_0: |
|---|
| | 48 | b.stop() |
|---|
| 48 | 49 | break |
|---|
| 49 | 50 | |
|---|