#!/usr/bin/env python

'''short.py - a really brief demonstration of using the ao and ogg modules'''

import ogg.vorbis
import ao
import urllib

#url='http://10.0.0.4:8000/bootcast.ogg'
url='http://127.0.0.1/t1.ogg'
device = 'esd'
SIZE = 4096

usock = urllib.urlopen(url)

#create a VorbisFile object and an Ao object
vf = ogg.vorbis.VorbisFile(usock)
id = ao.driver_id(device)
ao = ao.AudioDevice(id)

# Read from the VorbisFile and write to the Ao object until 
# you read zero bytes.
while 1:
     (buff, bytes, bit) = vf.read(SIZE)
     if bytes == 0: break
     ao.play(buff, bytes)


