Exemplo n.º 1
0
    def __init__(self):
        tokenizer = Tokenizer()
        
        if os.path.exists('manga.dat'): 
            file = open('manga.dat', 'r')
            data = pickle.load(file)
            file.close()
        else:
            data = Miner().mine()
            file = open('manga.dat', 'wb')
            pickle.dump(data, file)
            file.close()

        if os.path.exists('manga.idx'):
            file = open('manga.idx', 'r')
            index = pickle.load(file)
            file.close()
        else:
            indexer = Indexer(tokenizer)
            index = indexer.buildIndex(data)
            file = open('manga.idx', 'wb')
            pickle.dump(index, file)
            file.close()
        
        self.searchEngine = SearchEngine(data, index, tokenizer)
        self.irc_client = IRCClient()
        
        thread.start_new_thread(self.irc_client.start, ())
        thread.start_new_thread(self.refreshList, ())
Exemplo n.º 2
0
 def refreshList(self):
     data= Miner().mine()
     
     tokenizer = Tokenizer()
     indexer = Indexer(tokenizer)
     index = indexer.buildIndex(data)
     
     # save data and index
     file = open('manga.dat', 'wb')
     pickle.dump(data, file)
     file.close()
     
     file = open('manga.idx', 'wb')
     pickle.dump(index, file)
     file.close()
     
     self.searchEngine.setDataAndIndex(data, index)