def processPages(pages, collection): abbyyParsed = None scanId = None for page in pages: if abbyyParsed is None: abbyyParsed = abbyy.parseABBYY(page['scan_id']) processPage(page, abbyyParsed) saveId = collection.save(page) scanId = page['scan_id'] helper.log.debug('Save id: %s' % (saveId)) helper.removeIAImages(scanId);
processPage(page, abbyyParsed, pageShift) saveId = collection.save(page) scanId = page['scan_id'] helper.log.debug('Save id: %s' % (saveId)) # Now that all pages are processed, clear the lock collection.update({'scan_id': page['scan_id']}, {'$set': {'processing_lock': False, 'processing_lock_end': time()}}, multi=True) except Exception, e: helper.log.debug('Error processing pages:' + str(e)) page['processing_error'] = True saveId = collection.save(page) try: helper.removeIAImages(scanId) except Exception, e: helper.log.debug('Can\'t remove images' + str(e)) def processPage(page, abbyyParsed, pageShift): if page is None: helper.log.debug('No pages for processing') return else: startTime = time() helper.log.debug('Starting Processing for scan_id: %s' % (page['scan_id'])) if (page['abbyy_complete'] is False): if page['scandata_index'] <= len(abbyyParsed): result = abbyyParsed[page['scandata_index']] if (result is not False):
# Now that all pages are processed, clear the lock collection.update({'scan_id': page['scan_id']}, { '$set': { 'processing_lock': False, 'processing_lock_end': time() } }, multi=True) except Exception, e: helper.log.debug('Error processing pages:' + str(e)) page['processing_error'] = True saveId = collection.save(page) try: helper.removeIAImages(scanId) except Exception, e: helper.log.debug('Can\'t remove images' + str(e)) def processPage(page, abbyyParsed, pageShift): if page is None: helper.log.debug('No pages for processing') return else: startTime = time() helper.log.debug('Starting Processing for scan_id: %s' % (page['scan_id'])) if (page['abbyy_complete'] is False): if page['scandata_index'] <= len(abbyyParsed): result = abbyyParsed[page['scandata_index']]