#======================================================================= __version__ = '''0.0.01''' __sub_version__ = '''20120302022717''' __copyright__ = '''(c) Alex A. Naanou 2011''' #----------------------------------------------------------------------- # The first index.py might be a little too complicated. try and resolve # this as so: # - list all relevant files (RAW, XMP, JPG, PSD, ...) # - group by path (closeness) # - deepest common path to contain all files with common name. # this will fail if we have different files with same names. # #----------------------------------------------------------------------- import os import json import zipfile import uuid import time import pyexiv2 as metadata from itertools import izip, izip_longest from pli.logictypes import ANY, OR from pprint import pprint #----------------------------------------------------------------------- CONFIG_NAME = 'test_config.json' ##CONFIG_NAME = 'tmp_config.json' config = json.load(open(CONFIG_NAME)) RAW = OR( 'NEF', 'nef', 'CRW', 'crw', 'CR2', 'cr2', 'X3F', 'x3f' ) JPEG = OR( 'JPG', 'jpg', 'JPEG', 'jpeg' ) PSD = OR( 'PSD', 'psd' ) TIFF = OR( 'TIFF', 'tiff', 'TIF', 'tif' ) XMP = OR( 'XMP', 'xmp' ) ITEM = OR(RAW, JPEG, PSD, TIFF, XMP) TYPES = { 'raw': RAW, 'jpeg': JPEG, 'psd': PSD, 'tiff': TIFF, 'xmp': XMP, } SUBTREE_CLASSES = { 'preview': 'preview', 'preview (RAW)': 'RAW preview', } #----------------------------------------------------------------------- # XXX need a strategy to check if two files that have the same GID are # identical, and if so, need to destinguish them in the GID... # might be a good idea to add a file hash def image_gid(path): ''' Calgulate image GID. Format: -