Ejemplo n.º 1
0
    def reload_gallery(self, request, **kwargs):
        reindex_gallery()
        galleryGalPath = get_gallery_file()
        galGallery = br.br_make_gallery(galleryGalPath)
        galTemplateList = br.br_load_from_gallery(galGallery)

        # compare and collect scores
        ntargets = br.br_num_templates(galTemplateList)
        logger.debug(str(ntargets) + " templates found in the gallery at " + galleryGalPath)
        res = str(ntargets) + " templates found in the gallery at " + galleryGalPath
        for r in range(ntargets):
            tmpl = br.br_get_template(galTemplateList, r)
            logger.debug("Filename = " + br.br_get_filename(tmpl))
        response = self.create_response(request, res)
        br.br_free_template_list(galTemplateList)
        br.br_close_gallery(galGallery)
        return response
Ejemplo n.º 2
0
    def reload_gallery(self, request, **kwargs):
        reindex_gallery()
        galleryGalPath = get_gallery_file()
        galGallery = br.br_make_gallery(galleryGalPath)
        galTemplateList = br.br_load_from_gallery(galGallery)

        # compare and collect scores
        ntargets = br.br_num_templates(galTemplateList)
        logger.debug(str(ntargets) + " templates found in the gallery at " + galleryGalPath)
        res = str(ntargets) + " templates found in the gallery at " + galleryGalPath
        for r in range(ntargets):
            tmpl = br.br_get_template(galTemplateList, r)
            logger.debug("Filename = " + br.br_get_filename(tmpl))
        response = self.create_response(request, res)
        br.br_free_template_list(galTemplateList)
        br.br_close_gallery(galGallery)
        return response
Ejemplo n.º 3
0
    def test_getfilename(self, request, **kwargs):
        self.method_check(request, allowed=["post"])
        res = []

        # create a new File
        filename_name = u"/tmp/testimage1.jpg"
        file_data = open(filename_name, "rb").read()

        facetmpl = br.br_load_img(file_data, len(file_data))
        print "Setting file name on template to " + os.path.basename(filename_name)
        logger.debug("Setting file name on template to " + os.path.basename(filename_name))
        br.br_set_filename(facetmpl, os.path.basename(filename_name))
        print "Retrieving file name from template"
        logger.debug("Retriving file name from template")
        filename = br.br_get_filename(facetmpl)
        logger.debug("Filename=" + filename)
        print filename
        response = self.create_response(request, res)
        return response
Ejemplo n.º 4
0
    def test_getfilename(self, request, **kwargs):
        self.method_check(request, allowed=['post'])
        res = []

        # create a new File
        filename_name = u'/tmp/testimage1.jpg'
        file_data = open(filename_name, 'rb').read()

        facetmpl = br.br_load_img(file_data, len(file_data))
        print "Setting file name on template to " + os.path.basename(filename_name)
        logger.debug("Setting file name on template to " + os.path.basename(filename_name))
        br.br_set_filename(facetmpl, os.path.basename(filename_name))
        print "Retrieving file name from template"
        logger.debug("Retriving file name from template")
        filename = br.br_get_filename(facetmpl)
        logger.debug("Filename=" + filename)
        print filename
        response = self.create_response(request, res)
        return response