def run(): if Google().accessible: process_similars() process_releases() SimilarResult.remove({'created': { '$lt': datetime.utcnow() - DELTA_SIMILAR_MAX, }}, safe=True)
def _process_result(self, doc): doc['category'] = self.category if SimilarResult.find_one(doc): return if doc['category'] == 'tv': doc['mode'] = 'inc' doc['season'] = 1 doc['episode'] = 1 doc['src'] = {'similar': self.name} doc['langs'] = self.get('langs') if add_search(**doc): doc['created'] = datetime.utcnow() SimilarResult.insert(doc, safe=True) return True