示例#1
0
import statistics
from urldownloader import urlToFile
import settings
from imgSeekLib.ImageDB import ImgDB

# Globals
remoteCache = None    # global remote cache (memcached) singleton
pbFactory = None     # perspective factory
daemonStartTime = time.time()
hasShutdown = False
iskVersion = "0.9.5"

# misc daemon inits
rootLog = logging.getLogger('imgdbapi')
rootLog.info('+- Initializing isk-daemon server (version %s) ...' % iskVersion)
imgDB = ImgDB(settings)
imgDB.loadalldbs(os.path.expanduser(settings.core.get('database', 'databasePath')))

rootLog.info('| image database initialized')


############ Common functions for all comm backends
#@memoize.simple_memoized
def queryImgID(dbId, id, numres=12, sketch=0, fast=False):
    """
    Return the most similar images to the supplied one. The supplied image must be already indexed, and is referenced by its ID.

    @type  dbId: number
    @param dbId: Database space id.
    @type  id: number
    @param id: Target image id.
示例#2
0
 def setUp(self):
     self.imgdb = ImgDB(settings)
     self.assertEqual(1, self.imgdb.createdb(1))