beautypg.com

Ncast telepresenter reference manual – NCast Telepresenter M4 User Manual

Page 93

background image

NCast Telepresenter Reference Manual

files.append(file)

filelist.close()

if debug:

print "ncfiles: Download list", files

if len(files) == 0:

print "ncfiles: No files to download"
return True

# Download each file

for mp4 in files:

url = "http://" + host + "/backup/download/" + mp4

print "ncfiles: Downloading", url

try:

filein = urllib2.urlopen(url)

except urllib2.URLError, msg:

print "ncfiles: Urllib2 error (%s)" % msg
return False

except socket.error, (errno, strerror):

print "ncfiles: Socket error (%s) for host %s (%s)" % (errno, host, strerror)
return False

fileout = open(mp4, "wb")

while True:

try:

bytes = filein.read(1024000)
fileout.write(bytes)

except IOError, (errno, strerror):

print "ncfiles: I/O error(%s): %s" % (errno, strerror)
sys.exit(2)

if bytes == "":

break

filein.close()
fileout.close()

# Download the detail xml file associated with the mp4 file

url = "http://" + host + "/backup/download/" + mp4[:-4] + ".xml"

if debug:

print "ncfiles: Downloading", url

try:

filein = urllib2.urlopen(url)

except urllib2.URLError, msg:

print "ncfiles: Urllib2 error (%s)" % msg
return False

except socket.error, (errno, strerror):

print "ncfiles: Socket error (%s) for host %s (%s)" % (errno, host, strerror)
return False

fileout = open(mp4[:-4] + ".xml", "w")

bytes = filein.read()
fileout.write(bytes)

NCast Corporation

Revision 2.2

Page 93

This manual is related to the following products: