minor edit...

This commit is contained in:
Alex A. Naanou 2012-03-01 18:07:11 +04:00
parent ff06e8f4f0
commit 5035f55f36

View File

@ -1,7 +1,7 @@
#======================================================================= #=======================================================================
__version__ = '''0.0.01''' __version__ = '''0.0.01'''
__sub_version__ = '''20120229170952''' __sub_version__ = '''20120301172257'''
__copyright__ = '''(c) Alex A. Naanou 2011''' __copyright__ = '''(c) Alex A. Naanou 2011'''
@ -80,6 +80,7 @@ SUBTREE_CLASSES = {
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
##!!! we will need to normalize the paths to one single scheme (either relative or absolute)... ##!!! we will need to normalize the paths to one single scheme (either relative or absolute)...
# XXX might need to fetch file data too...
def list_files(root, sub_trees=SUBTREE_CLASSES, type=ITEM, include_root_path=False): def list_files(root, sub_trees=SUBTREE_CLASSES, type=ITEM, include_root_path=False):
''' '''
yields: yields:
@ -145,27 +146,28 @@ if __name__ == '__main__':
GID_index = {} GID_index = {}
for name, l in index.items(): for name, l in index.items():
##!!! gid construction should be a customizable function in itself...
# main gid criteria:
# - unique
# - calculable from the item (preferably any sub-item)
## GID = '%s-%s' % (uuid.uuid4().hex, name)
##!!! get RAW file creation date from EXIF...
GID = '%s-%s' % (hex(long(time.time()*1000))[2:-1], name)
l.sort() l.sort()
raws = [e for e in l if e[-1] == RAW] raws = [e for e in l if e[-1] == RAW]
if len(raws) > 1:
print 'duplicates: %s (%sx)...' % (name, len(raws)), for raw in raws:
# split the group into c seporate groups... if len(raws) > 1:
# strategies: print 'duplicates: %s (%sx)...' % (name, len(raws)),
# - path proximity (distance) # split the group into c seporate groups...
# - metadata # strategies:
##!!! # - path proximity (distance)
print 'skipping.' # - metadata
## raise TypeError, 'found %s RAW files with identical names (%s).' % (len(raws), name) ##!!!
else: print 'skipping.'
break
##!!! gid construction should be a customizable function in itself...
# main gid criteria:
# - unique
# - calculable from the item (preferably any sub-item)
## GID = '%s-%s' % (uuid.uuid4().hex, name)
##!!! get RAW file creation date from EXIF...
GID = '%s-%s' % (hex(long(time.time()*1000))[2:-1], name)
GID_index[GID] = { GID_index[GID] = {
'gid': GID, 'gid': GID,
'name': name, 'name': name,
@ -176,6 +178,14 @@ if __name__ == '__main__':
'TIFF': [e for e in l if e[-1] == TIFF], 'TIFF': [e for e in l if e[-1] == TIFF],
'other': [e for e in l if e[-1] != OR(TIFF, PSD, JPEG, XMP, RAW)], 'other': [e for e in l if e[-1] != OR(TIFF, PSD, JPEG, XMP, RAW)],
} }
##!!! TODO: archive descriptions to help index/tag items...
# NOTE: each import from an existing archive will be as follows:
# - full listing
# - find new subtrees
# - find modified items (file date diff)
print GID print GID