[#36 state:fixed] Don't add pictures to dimensions2pictures if they don't have a cache_id (and moved some code around).

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%4087
This commit is contained in:
hsoft 2009-06-19 10:39:14 +00:00
parent de178a5aba
commit fa66bea92f
1 changed files with 5 additions and 4 deletions

View File

@ -95,14 +95,15 @@ class AsyncMatchFactory(MatchFactory):
cache = self.cached_blocks
id2picture = {}
dimensions2pictures = defaultdict(set)
for picture in pictures[:]:
for picture in pictures:
try:
picture.cache_id = cache.get_id(picture.unicode_path)
id2picture[picture.cache_id] = picture
if not self.match_scaled:
dimensions2pictures[picture.dimensions].add(picture)
except ValueError:
pictures.remove(picture)
if not self.match_scaled:
dimensions2pictures[picture.dimensions].add(picture)
pass
pictures = [p for p in pictures if hasattr(p, 'cache_id')]
pool = multiprocessing.Pool()
async_results = []
pictures_copy = set(pictures)