beautypg.com

Google Flix Engine Linux Reference Manual User Manual

Page 511

background image

7.15 CGI

505


"""

print "

process_sample.py version 1.8
\n"

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

print "
"

str = flixengine2.Flix2_Copyright()

str = string.replace(str,"\n","
")

print "%s

" % 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)=("’"+outdir+"’",’outdir’)

print "

****************************************
\n"\

"WARNING: %s MUST exist and be writeable by flixd.\n"\

"
Please make %s accessible or modify the %s"\

" value defined in ’%s’.
\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:
\n%s
\n" % (tt,g);

print "****************************************

\n"

print ""

print "

\n"

print "

\n"

print "

"

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

Flix Function Calls
Function NameReturn Value
Flix2_CreateEx()