예제 #1
0
 def execute(self):
     self.tasks = []
     filename = os.path.join(settings.path_to_project, settings.analyser, settings.data, 'catalog.zip')
     zip_file = ZipFile(filename)
     catalog_file = zip_file.open('catalog.txt')
     for i in xrange(self.start_line):
         catalog_file.readline()
     N_IDS = 20 #number of reading ID's
     for n in range(N_IDS):
         description_line = catalog_file.readline()
         if description_line == '':
             break #end of file
         description = Retriever.read_description(description_line)
         self.tasks.append( GetBookInfoTask('http://flibusta.net/b/%s' % description['ID'], description)  )
     if catalog_file.readline() != '':
         self.tasks.append( GetNewId(self.start_line+N_IDS))
     return True