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'''
__sub_version__ = '''20120229170952'''
__sub_version__ = '''20120301172257'''
__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)...
# XXX might need to fetch file data too...
def list_files(root, sub_trees=SUBTREE_CLASSES, type=ITEM, include_root_path=False):
'''
yields:
@ -145,17 +146,11 @@ if __name__ == '__main__':
GID_index = {}
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()
raws = [e for e in l if e[-1] == RAW]
for raw in raws:
if len(raws) > 1:
print 'duplicates: %s (%sx)...' % (name, len(raws)),
# split the group into c seporate groups...
@ -164,8 +159,15 @@ if __name__ == '__main__':
# - metadata
##!!!
print 'skipping.'
## raise TypeError, 'found %s RAW files with identical names (%s).' % (len(raws), name)
else:
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': GID,
'name': name,
@ -178,6 +180,14 @@ if __name__ == '__main__':
}
##!!! 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 len(GID_index), len([ e for e in lst if e[-1] == RAW])