def _integrity_check_db(self): db_file_checksum = tools.md5_hash(self._database_layout) with GlobalLock(self.__class__.__name__, self._threading_lock, True, db_file_checksum) as lock: if lock.runned_once(): return if g.read_all_text("{}.md5".format( self._db_file)) == db_file_checksum: return g.log("Integrity checked failed - {} - {} - rebuilding db".format( self._db_file, db_file_checksum)) self.rebuild_database() g.write_all_text("{}.md5".format(self._db_file), db_file_checksum)
def _integrity_check_db(self): db_file_checksum = tools.md5_hash(self._database_layout) try: with GlobalLock(self.__class__.__name__, True, db_file_checksum): if xbmcvfs.exists(self._db_file) and g.read_all_text( "{}.md5".format(self._db_file)) == db_file_checksum: return g.log("Integrity checked failed - {} - {} - rebuilding db". format(self._db_file, db_file_checksum)) self.rebuild_database() g.write_all_text("{}.md5".format(self._db_file), db_file_checksum) except RanOnceAlready: return