Finishing up core.

This commit is contained in:
Jason A. Donenfeld
2011-05-06 07:55:47 -04:00
parent 9220ea44b5
commit a80528f9d3
12 changed files with 306 additions and 113 deletions

1
scanner/.gitignore vendored
View File

@ -1,3 +1,4 @@
upload.sh
*.pyc
cache/*
test/*

View File

@ -110,6 +110,7 @@ class Photo(object):
self._metadata(image)
self._thumbnails(image, thumb_path)
def _metadata(self, image):
self._attributes["size"] = image.size
try:
info = image._getexif()
except:
@ -125,8 +126,11 @@ class Photo(object):
try:
value = datetime.strptime(value, '%Y:%m:%d %H:%M:%S')
except:
pass
pass
self._attributes[decoded] = value
if "Orientation" in self._attributes and self._attributes["Orientation"] in range(5, 9):
self._attributes["size"] = (self._attributes["size"][1], self._attributes["size"][0])
def _thumbnail(self, image, thumb_path, size, square=False):
thumb_path = os.path.join(thumb_path, image_cache(self._path, size, square))
print "Thumbing %s" % thumb_path