From a419d706d7e4d1277b65d941979466f6a57392b1 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 10 Nov 2011 19:17:38 +0400 Subject: [PATCH] fixed a bug. and discovered that we effectively lost the actual extension of a file in the indexing process... Signed-off-by: Alex A. Naanou --- index.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/index.py b/index.py index 7c265e6c..9a4be33b 100755 --- a/index.py +++ b/index.py @@ -1,7 +1,7 @@ #======================================================================= __version__ = '''0.0.01''' -__sub_version__ = '''20111110190116''' +__sub_version__ = '''20111110191552''' __copyright__ = '''(c) Alex A. Naanou 2011''' @@ -15,6 +15,8 @@ from itertools import izip, izip_longest from pli.logictypes import ANY, OR +from pprint import pprint + #----------------------------------------------------------------------- @@ -187,21 +189,26 @@ def split_images(index): # prepare the return structure... res = [] +## pprint(raw) for path in raw: ##!!! res += [{ 'gid': uuid.uuid4(), 'name': name, -## 'raw': [path], + 'raw': [path], }] # start splitting the data... for ext, paths in data.items(): # skip non-type fields... if ext not in TYPES: continue + if ext == 'raw': + continue + # start the work... for path in paths: matches = [] for i, c in enumerate(common): + # use matching path head to match targets... if path[:len(c)] == c: matches += [(len(c), i)] # multiple matches... @@ -220,13 +227,17 @@ def split_images(index): res[i][ext] = [] res[i][ext] += [path] else: - # XXX ungrouped... + ##!!! XXX ungrouped files... print '!!!!', path, name, ext raise Exception, 'still got ungrouped files...' +## print len(res) +## pprint(res) +## raise SystemExit + # yield the results... for e in res: - yield e['gid'], res + yield e['gid'], e else: yield uuid.uuid4(), data