Initial import to Tizen
[profile/ivi/python-twisted.git] / doc / core / examples / shoutcast.py
1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 """
5 Example Shoutcast client. Run with:
6
7 python shoutcast.py localhost 8080
8 """
9
10 import sys
11
12 from twisted.internet import protocol, reactor
13 from twisted.protocols.shoutcast import ShoutcastClient
14
15 class Test(ShoutcastClient):
16     def gotMetaData(self, data):
17         print "meta:", data
18
19     def gotMP3Data(self, data):
20         pass
21
22 host = sys.argv[1]
23 port = int(sys.argv[2])
24
25 protocol.ClientCreator(reactor, Test).connectTCP(host, port)
26 reactor.run()