def run(): global data data = irc.recv(4096) if parse.find(data, 'PING'): irc.send('PONG '+ data.split()[1]+endl) if parse.find(data, 'PRIVMSG'): '''if parse.find(data, 'PRIVMSG '+name): parse.parsePM(data) else:''' # NOT DONE YET... parse.parsePRIVMSG(data) print '['+str(now.hour)+':'+str(now.minute)+':'+str(now.second)+'] '+data
# data = [] data = {} # To store sites that not resonding on time lost = [] # Make a seperate dir everyday now = date.today() directory = 'files/{}-{}-{}'.format(now.strftime('%Y'), now.strftime('%m'), now.strftime('%d')) if not os.path.exists(directory): os.makedirs(directory) # Crawl sites: # for site in sites: # content = Crawl(site) # if content == site: # lost.append(site) # else: # data[site] = content print '##'* 4, '\n Fetching done!' name = 'files/result-{}-{}-{}.txt'.format(now.strftime('%Y'), now.strftime('%m'), now.strftime('%d')) result = open(name, 'w') # Parse through files in archive for filename in os.listdir(directory): name = directory + '/{}'.format(filename) F = open(name, 'r') cont = F.read() find(cont, filename, result) print >> result, 'lost sites: {}'.format(lost)