Google Flix Engine Linux Reference Manual User Manual

Page 511

Advertising
background image

7.15 CGI

505

<body>

<hr>

"""

print "<p>process_sample.py version 1.8<br>\n"

print "Flix Engine client library v%s" % flixengine2.Flix2_Version()

print "<br>"

str = flixengine2.Flix2_Copyright()

str = string.replace(str,"\n","<br>")

print "%s</p>" % str

if ( os.environ[’REQUEST_METHOD’] == ’GET’ ) :

if

os.environ[’QUERY_STRING’] :

# This will always yield a non-empty FieldStorage object.

# That is, form.keys() will never be [].

form = cgi.FieldStorage()

else :

# The query string is empty.

# Calling cgi.FieldStorage() here would enter an infinite loop.

form = None

elif ( os.environ[’REQUEST_METHOD’] == ’POST’ ) :

# This will yield a non-empty FieldStorage object whose keys()

# may or may not be [].

form = cgi.FieldStorage()

# If the form is blank, it’s probably easiest to make this the equivalent

# of there being no form at all.

if not form.keys() :

form = None

##verify outdir’s presence and accessibility

if (rpchost == ’localhost’ and\

not (os.path.isdir(outdir) and os.access(outdir,os.W_OK))):

(i,tt)=("<i>’"+outdir+"’</i>",’<tt>outdir</tt>’)

print "<p>****************************************<br>\n"\

"<b>WARNING</b>: %s MUST exist and be writeable by <i>flixd</i>.\n"\

"<br>Please make %s accessible or modify the %s"\

" value defined in ’%s’.<br>\n" % (i,i,tt,sys.argv[0])

g=os.popen("grep -m 1 -H -n ’^outdir’ "+sys.argv[0]).read()

if g:

print "The definition of %s can be found here:<br>\n%s<br>\n" % (tt,g);

print "****************************************</p>\n"

print "<table border=’1’ cellpadding=’5’>"

print "<caption>Flix Function Calls</caption>\n"

print "<tr><th>Function Name</th><th>Return Value</th></tr>\n"

print "<tr><td>Flix2_CreateEx()</td>"

flixptr = flixengine2.new_flix2handlep()

sc = flixengine2.Flix2_CreateEx(flixptr, "localhost", 0)

#extract the handle value returned from _Create. flix will be used in

#every Flix API call that follows

flix = flixengine2.flix2handlep_value(flixptr)

process_sc(’Flix2_CreateEx’,sc)

codecptr = codec = 0

filterptr = filter = 0

muxerptr = muxer = 0

if (form) :

for key in form:

values = form[key]

if not isinstance(values, list):

value = [values.value]

Generated on Tue Jul 20 17:39:03 2010 for Flix Engine Linux by Doxygen

Advertising