예제 #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
예제 #2
0
    def getTags(self):
        """

        :return: an iterable of (tag_name, tag_size)
        """
        numfiles = self.getNumBlobs()
        if not numfiles:
            return

        for blob_id in self.getBlobs():
            blob_tag = FPTag(blob_id)
            tag_name = blob_tag.getTagName()
            blob_size = blob_tag.getBlobSize()
            blob_tag.close()
            yield tag_name, blob_size
예제 #3
0
    def getTags(self):
        """

        :return: an iterable of (tag_name, tag_size)
        """
        numfiles = self.getNumBlobs()
        if not numfiles:
            return

        for blob_id in self.getBlobs():
            blob_tag = FPTag(blob_id)
            tag_name = blob_tag.getTagName()
            blob_size = blob_tag.getBlobSize()
            blob_tag.close()
            yield tag_name, blob_size