| 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 |
|
| 16 |
class Test(ShoutcastClient): |
| 17 |
def gotMetaData(self, data): |
| 18 |
print("meta:", data) |
| 19 |
|
| 20 |
def gotMP3Data(self, data): |
| 21 |
pass |
| 22 |
|
| 23 |
|
| 24 |
host = sys.argv[1] |
| 25 |
port = int(sys.argv[2]) |
| 26 |
|
| 27 |
protocol.ClientCreator(reactor, Test).connectTCP(host, port) |
| 28 |
reactor.run() |