My favorites | Sign in
Logo
             
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python

from Axon.background import background
from Axon.Handle import Handle
from Kamaelia.Codec.Vorbis import VorbisDecode, AOAudioPlaybackAdaptor
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor
from Kamaelia.Internet.TCPClient import TCPClient
import time
import Queue
import ao
background(slowmo=0.001).start()

filename = "./snail.ogg"

playStream = Handle(Pipeline(VorbisDecode(), AOAudioPlaybackAdaptor())).activate()
# set of components for playing the stream back.

host = "bbc.kamaelia.org"
port = 1500

client = Handle(TCPClient(host = host, port = port)).activate()
# component to grab a stream from the internet

filedump = open("streamdump.ogg", "w+b")

def get_item(handle):
while 1:
try:
X = handle.get("outbox")
return X
except Queue.Empty:
time.sleep(0.001)

# Play the ogg data in the background
while True:
data = get_item(client)
filedump.write(data)
# log the stream to disk
playStream.put(data,"inbox")
# and play it.

# this could all be done entirely within kamaelia but using likefile
# makes it easier to hook in external programs.
Show details Hide details

Change log

r4527 by ms_ on Jun 19, 2008   Diff
Rename

Go to: 
Sign in to write a code review

Older revisions

r4520 by ms_ on Jun 19, 2008   Diff
All changed to use "Handle" not
"LikeFile"

r4513 by ms_ on Jun 19, 2008   Diff
Change over to use new likefile

Michael.
r4500 by ms_ on Jun 19, 2008   Diff
Branch for merging the rewritten
LikeFile. (ie as a bugfix...)

Michael.
All revisions of this file

File info

Size: 1207 bytes, 44 lines

File properties

svn:executable
*
Hosted by Google Code