mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
minor edit...
This commit is contained in:
parent
ff06e8f4f0
commit
5035f55f36
48
index2.py
48
index2.py
@ -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,27 +146,28 @@ 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]
|
||||
if len(raws) > 1:
|
||||
print 'duplicates: %s (%sx)...' % (name, len(raws)),
|
||||
# split the group into c seporate groups...
|
||||
# strategies:
|
||||
# - path proximity (distance)
|
||||
# - metadata
|
||||
##!!!
|
||||
print 'skipping.'
|
||||
## raise TypeError, 'found %s RAW files with identical names (%s).' % (len(raws), name)
|
||||
else:
|
||||
|
||||
for raw in raws:
|
||||
if len(raws) > 1:
|
||||
print 'duplicates: %s (%sx)...' % (name, len(raws)),
|
||||
# split the group into c seporate groups...
|
||||
# strategies:
|
||||
# - path proximity (distance)
|
||||
# - metadata
|
||||
##!!!
|
||||
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': 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])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user