Beispiel #1
0
    def test_files(self):
        #    outfilename = "test_files"
        try:
            clip = FPClip(self.pool)
            clip.open(clipid, FPLibrary.FP_OPEN_ASTREE)

            numfiles = clip.getNumBlobs()
            assert numfiles, "Missing blobs"
            for i in range(numfiles + 1):
                blob_id = clip.fetchNext()
                if not blob_id:
                    break

                blob_tag = FPTag(blob_id)
                print(("tag: %r" % blob_tag))
                if blob_tag.getBlobSize() < 1:
                    print(("Empty blob %s" % i))
                    blob_tag.close()
                    continue

                outfilename = blob_tag.getTagName()
                print(("tag name : %s" % outfilename))
                fh = FPFileOutputStream(
                    "outfile.{name}.{i}".format(name=outfilename, i=i))
                print("reading file from centera...")
                blob_tag.blobRead(fh.stream, 0)
                print("ok")
                fh.close()
                blob_tag.close()

        finally:
            print("closing clip")
            clip.close()

        assert outfilename, "Missing tag: %r" % outfilename
Beispiel #2
0
    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)
        print("reading file from centera...")
        blob_tag.blobRead(file.stream, 0)
        print("ok")
Beispiel #3
0
    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)
        print("reading file from centera...")
        blob_tag.blobRead(file.stream, 0)
        print("ok")
Beispiel #4
0
  pool.setGlobalOption( FPLibrary.FP_OPTION_EMBEDDED_DATA_THRESHOLD,
    100 * 1024 )

  pool.getPoolInfo()

  pool.registerApplication( "python wrapper read example", "1.0" )

  clip = FPClip( pool )

  clipid = raw_input( "Clip id: " )

  clip.open( clipid, FPLibrary.FP_OPEN_ASTREE )

  top = clip.getTopTag()

  blob_tag = FPTag( clip.fetchNext() )

  filename = raw_input( "Filename: " )
  
  file = FPFileOutputStream( filename )

  blob_tag.blobRead( file.stream, 0 )

  file.close()
  blob_tag.close()
  clip.close()
  pool.close()

  
except FPClientException, c:
  print c