From ebd2865fed9f5172c95d3535ff2a0f6b2cdf8564 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 3 Nov 2011 01:11:10 +0300 Subject: [PATCH] started work on indexing... Signed-off-by: Alex A. Naanou --- TODO.otl | 49 +++++++++++++++++++++++++++++++++++--- index.py | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 3 deletions(-) create mode 100755 index.py diff --git a/TODO.otl b/TODO.otl index fb2e6c43..86f28454 100755 --- a/TODO.otl +++ b/TODO.otl @@ -1,4 +1,46 @@ -[_] 14% general tasks +[_] 5% roadmap + [_] 12% pre-production: staging and test + [_] 50% test input + [X] clean - RAW + [X] rated (old) - RAW, XMP + [X] rated (new) - RAW, XMP, preview (RAW) + [_] processed (old) - RAW, XMP, PSD, preview + [_] processed (new) - RAW, XMP, PSD, preview, preview (RAW) + [_] missing previews... + [_] 0% setup archive + [_] 0% setup backup + [_] 0% setup testing + [_] stage + [_] create / build + [_] backup + [_] test consistency + [_] 11% stage I: basic workflow + [_] 33% import + [_] list files + [X] generate previews + [_] load metadata + [_] 0% generate tags + [_] data + [_] workflow + [X] populate preview metadata + [_] match files + | match and group coresponding RAW, PSD, preview and preview (RAW) + [_] 0% search / select + [_] 0% output: + [_] list of paths + [_] list of IDs + [_] 0% update (tags) + [_] 0% stage II: advanced workflow + [_] sync + | write data to previews and originals + [_] export + | copy a list of previews to a given location and maintain consistency + [_] 0% stage III: GUI + + + + +[_] 13% general tasks [_] 0% actions: [_] import [_] export/build @@ -13,7 +55,7 @@ [_] 0% sync [_] 0% UI [_] HTML/HTML5 - [_] QT (???) + [_] QT/PySide [_] command-line [_] ig | root script... name not final yet... @@ -47,11 +89,12 @@ | this can happen when adding a new object to a tag via an .update(...) method, in-place. | | need to use immutable data only. - [_] 33% compleate the new tags module + [_] 20% compleate the new tags module [X] .relatedtags(...) [_] see if we need strict and non-strict .relatedtags(...) [_] concatinative mode or abbility to build new tagsets from selections [_] tag chains support... + [_] build a new tagset from list of objects or tags... [_] import test images and ratings [_] importer based on xmpgen [X] need unique image id diff --git a/index.py b/index.py new file mode 100755 index 00000000..0b8c7f3e --- /dev/null +++ b/index.py @@ -0,0 +1,71 @@ +#======================================================================= + +__version__ = '''0.0.01''' +__sub_version__ = '''20111103010916''' +__copyright__ = '''(c) Alex A. Naanou 2011''' + + +#----------------------------------------------------------------------- + +import os +import json + +from pli.logictypes import OR + + +#----------------------------------------------------------------------- + +CONFIG_NAME = 'config.json' + +config = json.load(open(CONFIG_NAME)) + +ITEM_EXTENSIONS = ( + # RAW formats... + 'NEF', 'nef', + # JPEGs... + 'JPG', 'JPEG', 'jpg', 'jpeg', + # Editid images... + 'PSD', 'psd', + 'TIFF', 'tiff', 'TIF', 'tif', + # metadata sidecar files... + 'XMP', 'xmp', +) + +SUBTREE_CLASSES = { + 'preview': 'preview', + 'preview (RAW)': 'RAW preview', +} + + +#----------------------------------------------------------------------- + +def list_files(root, sub_trees=SUBTREE_CLASSES, ext=OR(*ITEM_EXTENSIONS)): + ''' + ''' + for path, dirs, files in os.walk(root): + # clasify by subtree... + p = os.path.split(path) + subtree_type = None + for t in sub_trees: + if t in p: + subtree_type = sub_trees[t] + break + # process files... + for f in files: + # filter by ext... + if f.split('.')[-1] == ext: + yield subtree_type, path, f + + + +#----------------------------------------------------------------------- +if __name__ == '__main__': + lst = list(list_files(config['ARCHIVE_ROOT'])) + + print len(lst) + + + + +#======================================================================= +# vim:set ts=4 sw=4 nowrap :