Exemplo n.º 1
0
    def __init__(self, handle, progressbar):
        ChessFile.__init__(self, handle)
        self.handle = handle
        self.progressbar = progressbar
        self.pgn_is_string = isinstance(handle, StringIO)

        if self.pgn_is_string:
            self.games = [self.load_game_tags(), ]
        else:
            self.skip = 0
            self.limit = 100
            self.order_col = game.c.offset
            self.is_desc = False
            self.reset_last_seen()

            # filter expressions to .sqlite .bin .scout
            self.tag_query = None
            self.fen = None
            self.scout_query = None

            self.init_tag_database()

            self.scoutfish = None
            self.init_scoutfish()

            self.chess_db = None
            self.init_chess_db()

            self.games, self.offs_ply = self.get_records(0)
            log.info("%s contains %s game(s)" % (self.path, self.count), extra={"task": "SQL"})
Exemplo n.º 2
0
    def __init__(self, handle, progressbar=None):
        ChessFile.__init__(self, handle)
        self.handle = handle
        self.progressbar = progressbar
        self.pgn_is_string = isinstance(handle, StringIO)

        if self.pgn_is_string:
            self.games = [
                self.load_game_tags(),
            ]
        else:
            self.skip = 0
            self.limit = 100
            self.order_col = game.c.offset
            self.is_desc = False
            self.reset_last_seen()

            # filter expressions to .sqlite .bin .scout
            self.tag_query = None
            self.fen = None
            self.scout_query = None

            self.scoutfish = None
            self.chess_db = None

            self.sqlite_path = os.path.splitext(self.path)[0] + '.sqlite'
            self.engine = dbmodel.get_engine(self.sqlite_path)
            self.tag_database = TagDatabase(self.engine)

            self.games, self.offs_ply = self.get_records(0)
            log.info("%s contains %s game(s)" % (self.path, self.count),
                     extra={"task": "SQL"})
Exemplo n.º 3
0
    def __init__(self, handle, progressbar):
        ChessFile.__init__(self, handle)
        self.handle = handle
        self.progressbar = progressbar
        self.pgn_is_string = isinstance(handle, StringIO)

        if self.pgn_is_string:
            self.games = [
                self.load_game_tags(),
            ]
        else:
            self.skip = 0
            self.limit = 100
            self.last_seen_offs = [-1]

            # filter expressions to .sqlite .bin .scout
            self.text = ""
            self.fen = ""
            self.query = {}

            self.init_tag_database()

            self.scoutfish = None
            self.init_scoutfish()

            self.chess_db = None
            self.init_chess_db()

            self.games, self.offs_ply = self.get_records(0)
            log.info("%s contains %s game(s)" % (self.path, self.count),
                     extra={"task": "SQL"})
Exemplo n.º 4
0
 def __init__ (self, games):
     ChessFile.__init__(self, games)
     self.tagcache = {}
Exemplo n.º 5
0
 def close(self):
     self.tag_database.close()
     ChessFile.close(self)
Exemplo n.º 6
0
 def close(self):
     self.tag_database.close()
     ChessFile.close(self)
Exemplo n.º 7
0
 def __init__(self, games):
     ChessFile.__init__(self, games)
     self.tagcache = {}
Exemplo n.º 8
0
 def __init__(self, handle, games):
     ChessFile.__init__(self, handle, games)
     self.handle = handle
     self.filtered_games = games
     self.offset = 0