Ejemplo n.º 1
0
	def quit(self, key):
		self.empty_trash(key)
		if self.changes:
			print "saving changes..."
			self.message('Saving image/blog data to XML...')
			index.save()
		root.quit()
Ejemplo n.º 2
0
def save_post(sample, seen):
    media_url, = sample['media_urls']

    try:
        staged = index.stage_audio(media_url, sample['language'])
    except index.DownloadError:
        print('      SKIPPING: got 404 when downloading')
        return False

    sample['checksum'] = staged.checksum
    if staged.checksum in seen:
        print('      SKIPPING: checksum already in index')
        return False

    if staged.orig_checksum:
        sample['origin_checksum'] = staged.orig_checksum
        if staged.orig_checksum in seen:
            print('      SKIPPING: checksum already in index')
            return False

    index.save(sample)
    index.mark_as_seen(sample, seen)
    return True
Ejemplo n.º 3
0
def save_post(sample, seen):
    media_url, = sample['media_urls']

    try:
        staged = index.stage_audio(media_url, sample['language'])
    except index.DownloadError:
        print('      SKIPPING: got 404 when downloading')
        return False

    sample['checksum'] = staged.checksum
    if staged.checksum in seen:
        print('      SKIPPING: checksum already in index')
        return False

    if staged.orig_checksum:
        sample['origin_checksum'] = staged.orig_checksum
        if staged.orig_checksum in seen:
            print('      SKIPPING: checksum already in index')
            return False

    index.save(sample)
    index.mark_as_seen(sample, seen)
    return True
Ejemplo n.º 4
0
#!/usr/bin/python

import index
import weave.picture as picture
import weave.tumblr as tumblr
import util.cluster as clustering

index.load()

index.simpairs()
index.save()

pics = picture.pictures()
pics = sorted(pics, key=lambda p: len(p.relates))
index.stumblr(pics[-1], "walk.html")


clusters = clustering.linkage(pics, len(pics) / 10, mode=clustering.LINK_NORM)
groups = [c.members for c in clusters]
index.savegroups(groups, "cluster.html")