def __start(self): if not os.path.exists(self.__db_path): logging.info("[%s] Initializing local cache DB..." % (self.map_id,)) mkdirSafely(os.path.dirname(self.__db_path)) self.__conn = sqlite3.connect(self.__db_path) self.__initDB() else: self.__conn = sqlite3.connect(self.__db_path) self.__readConfig() logging.info("[%s][Config] db schema: %s" % (self.map_id, self.__db_schema)) logging.info("[%s][Config] suuport tile timestamp: %s" % (self.map_id, self.__has_timestamp))
def __start(self): if not os.path.exists(self.__db_path): logging.info("[%s] Initializing local cache DB..." % (self.map_id, )) mkdirSafely(os.path.dirname(self.__db_path)) self.__conn = sqlite3.connect(self.__db_path) self.__initDB() else: self.__conn = sqlite3.connect(self.__db_path) self.__readConfig() logging.info("[%s][Config] db schema: %s" % (self.map_id, self.__db_schema)) logging.info("[%s][Config] suuport tile timestamp: %s" % (self.map_id, self.__has_timestamp))
def put(self, level, x, y, data): path = self.__genTilePath(level, x, y) mkdirSafely(os.path.dirname(path)) with open(path, 'wb') as file: file.write(data)
def start(self): mkdirSafely(self.__cache_dir)