Just save the png data as-is (maybe fix later)

This commit is contained in:
simon.kagstrom 2010-02-22 11:43:32 +00:00
parent 6fc380d2c8
commit 1bc324c982

View File

@ -444,12 +444,14 @@ class Peer:
entry = pkt.get_entry() entry = pkt.get_entry()
self.srv.data_store.add_entry(self, entry.get_key() + self.data_key, entry) self.srv.data_store.add_entry(self, entry.get_key() + self.data_key, entry)
if entry.get_key() == self.screenshot_key - self.data_key: print entry.get_key(), self.screenshot_key, self.data_key
if entry.get_key() == self.screenshot_key:
print "Save it all"
try: try:
which = random.randrange(0,12) which = random.randrange(0,12)
img = image.image_from_data(entry.get_data()) f = open("%s%d.png" % (self.srv.image_dir, which), "w")
if img.interestingness > 0.4 or random.randrange(0, 10) < 2: f.write(entry.get_data())
img.save("%s%d.png" % (self.srv.image_dir, which)) f.close()
except Exception, e: except Exception, e:
log_info("Could not convert image data" + str(e)) log_info("Could not convert image data" + str(e))