[AG-TECH] Venue Client Entry simulator for AGTK 2.3

Andrew Rowley Andrew.Rowley at manchester.ac.uk
Wed Feb 2 03:33:28 CST 2005


Hi,

I have written a short script (see below) that simulates the entry,
heartbeats and exit of a client from an AGTk 2.3 venue server.  I thought it
might be useful to someone out there, such as people who want to use a
dynamic venue without needing an AGTk 2.3 user to be in the venue.  This
script enters the venue with a given URL, and holds the venue open until the
user presses ctrl-c to quit.

I am not sure if this is a good way of doing this but it seems to work...

Andrew :)

Script is below my signature and attached to the e-mail...

============================================
Access Grid Support Centre,
RSS Group,
Manchester Computing,
Kilburn Building,
University of Manchester,
Oxford Road,
Manchester, 
M13 9PL, 
UK
Tel: +44(0)161-275 0685
Email: Andrew.Rowley at manchester.ac.uk 

VenueEntry.py:

#!/usr/bin/python2

import os, sys
import time
from optparse import Option

from AccessGrid.Venue import VenueIW
from AccessGrid.Toolkit import CmdlineApplication
from AccessGrid.ClientProfile import ClientProfile
from AccessGrid.Types import Capability
from AccessGrid.Descriptions import StreamDescription
from AccessGrid.Events import UpdateDataEvent

doc ="""
This program gets the stream information from the venue.
"""
# Initialize
app = CmdlineApplication()

urlOption = Option("-u", "--url", dest="url", default=None,
                   help="Specify a venue url on the command line.")

app.AddCmdLineOption(urlOption)

args = app.Initialize()

venueUrl = app.GetOption("url")

print "URL: ", venueUrl

if venueUrl is None:
    print "Exiting, no url specified."
    sys.exit(0)

venueClient = VenueIW(venueUrl)

client = ClientProfile()
client.name = 'InSORS Node'
client.email = ''
client.phoneNumber = ''
client.location = ''
capabilityAudioProducer = Capability(Capability.PRODUCER, Capability.AUDIO)
capabilityVideoProducer = Capability(Capability.PRODUCER, Capability.VIDEO)
capabilityAudioConsumer = Capability(Capability.CONSUMER, Capability.AUDIO)
capabilityVideoConsumer = Capability(Capability.CONSUMER, Capability.VIDEO)
client.capabilities = [capabilityAudioProducer, capabilityVideoProducer,
capabilityAudioConsumer, capabilityVideoConsumer]
privateId = None;

try:
    print "Entering Venue"
    (state, privateId, streamDescriptions) = venueClient.Enter(client)
    print "PrivateID: " + privateId
    print "PublicID: " + client.publicId
    streams = venueClient.GetStreams()
    for s in streams:
        print "Stream: ", s.AsINIBlock()

    while 0==0:
        venueClient.UpdateClientProfile(client)
        time.sleep(10)
except:
    try:
        print "Exiting Venue"
        venueClient.Exit(privateId)
    except:
        print "Error"
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: VenueEntry.py
URL: <http://lists.mcs.anl.gov/pipermail/ag-tech/attachments/20050202/90c3595e/attachment.diff>


More information about the ag-tech mailing list