def insert_thumbs(self, rssid): self.db[self.COLLECTION].remove({'rssid': rssid}, safe=True) Site.objects(rssid=rssid).delete() domain = get_domain(rssid, connection=self.connection) site = Site(rssid=rssid, domain=domain) thumbs = self.get_thumbs(rssid, domain) try: colorific.color_mt(thumbs.items(), rssid, n=8) except Exception, e: raise e
def update_thumbs(self, rssid): domain = get_domain(rssid, connection=self.connection) site, created = Site.objects.get_or_create(rssid=rssid, defaults={'domain': domain}) if created: last_updated = None else: last_updated = site.last_updated thumbs = self.get_thumbs(rssid, domain, last_updated=last_updated) try: colorific.color_mt(thumbs.items(), rssid, n=8) except Exception, e: raise e