pool = FPPool( ip ) pool.setGlobalOption( FPLibrary.FP_OPTION_EMBEDDED_DATA_THRESHOLD, 100 * 1024 ) pool.getPoolInfo() pool.registerApplication( "python wrapper store example", "1.0" ) clip = FPClip( pool, "python store example" ) retention = raw_input( "Retention (in seconds): " ) clip.setRetentionPeriod( long(retention) ) top_handle = clip.getTopTag() blob_tag = FPTag( top_handle, "file" ) filename = raw_input( "Filename: " ) file = FPFileInputStream( filename, 16*1024 ) blob_tag.blobWrite( file.stream, 0 ) file.close() blob_tag.close() clipid = clip.write() print clipid
clipid = clipid or config['test']['read_clipid'] pool = FPPool(ip) pool.setGlobalOption(FPLibrary.FP_OPTION_EMBEDDED_DATA_THRESHOLD, 100 * 1024) pool.getPoolInfo() # the application will be attached to the clip id pool.registerApplication("python wrapper read example", "1.0") clip = FPClip(pool) # clipid = raw_input( "Clip id: " ) clip.open(clipid, FPLibrary.FP_OPEN_ASTREE) for a in "name retention.period numfiles".split(): clip.getDescriptionAttribute(a) top = clip.getTopTag() print("tag: %r" % top) for i in range(clip.getNumBlobs() + 1): blob_id = clip.fetchNext() if not blob_id: break blob_tag = FPTag(blob_id) if blob_tag.getBlobSize() < 1: blob_tag.close() continue print("tag: %r" % blob_tag) file = FPFileOutputStream(outfilename + ".%s" % i)
pool = FPPool(ip) pool.setGlobalOption(FPLibrary.FP_OPTION_EMBEDDED_DATA_THRESHOLD, 100 * 1024) pool.getPoolInfo() pool.registerApplication("python wrapper store example", "1.0") clip = FPClip(pool, "python store example") retention = raw_input("Retention (in seconds): ") clip.setRetentionPeriod(long(retention)) top_handle = clip.getTopTag() blob_tag = FPTag(top_handle, "file") filename = raw_input("Filename: ") file = FPFileInputStream(filename, 16 * 1024) blob_tag.blobWrite(file.stream, 0) file.close() blob_tag.close() clipid = clip.write() print clipid
clipid = clipid or config['test']['read_clipid'] pool = FPPool(ip) pool.setGlobalOption(FPLibrary.FP_OPTION_EMBEDDED_DATA_THRESHOLD, 100 * 1024) pool.getPoolInfo() # the application will be attached to the clip id pool.registerApplication("python wrapper read example", "1.0") clip = FPClip(pool) # clipid = raw_input( "Clip id: " ) clip.open(clipid, FPLibrary.FP_OPEN_ASTREE) for a in "name retention.period numfiles".split(): clip.getDescriptionAttribute(a) top = clip.getTopTag() print("tag: %r" % top) for i in range(clip.getNumBlobs() + 1): blob_id = clip.fetchNext() if not blob_id: break blob_tag = FPTag(blob_id) if blob_tag.getBlobSize() < 1: blob_tag.close() continue print("tag: %r" % blob_tag) file = FPFileOutputStream(outfilename + ".%s" % i)