def librarize(key): s3.add('macros', key, s3.getImg('potentialmacros', key)) s3.delete('potentialmacros', key) pim = PotentialImageMacro.objects.get(key = key) pim.active = False im = ImageMacro.objects.create(key = key, name = name(pim.fullSizeLink)) m = Meme.objects.get(threadLink = pim.threadLink) m.classification = im m.topDist = 0 m.save()
def merge(macro, target): macroimg = s3.getImg('macros', macro.key) backedby = Meme.objects.filter(classification = macro).distinct().count() compute.merge(macroimg, target, backedby) s3.replace('macros', macro.key, macroimg)