diff --git a/image_list.py b/image_list.py index 72dc31d..26d84d0 100755 --- a/image_list.py +++ b/image_list.py @@ -9,6 +9,7 @@ import hashlib from argparse import ArgumentParser SQLFILE='list_of_images.sqlite' +DESCFILE='descriptions.csv' IMGMATCH=re.compile('.*\.jpg$|.*\.jpeg$|.*\.png$|.*\.gif$',re.I) BADDIRS=['_tn','_med'] MINSIZE=0 @@ -73,6 +74,9 @@ def createdb(sqlfile): width INTEGER,height INTEGER,size INTEGER,\ fingerprint TEXT,sharpness NUMERIC,\ R REAL,G REAL, B REAL, BR REAL, BG REAL, BB REAL)') + db.execute('CREATE TABLE descriptions (\ + file PRIMARY KEY TEXT,path TEXT, hash TEXT,\ + description TEXT)') conn.commit() return @@ -692,6 +696,23 @@ def humanize_size(size,precision=1): defPrecision=precision return "%.*f%s"%(defPrecision,size,suffixes[suffixIndex]) +def import_descriptions(options): + """ Walk through the path from given [startpath] and read + any DESCFILE, importing the contents in the DB """ + pass + +def export_descriptions(options): + """ Get unique paths from DB, matching [startpath], write + DESCFILE for each file found. Export gets a format argument: + %wx%h %n %d """ + # width, height, basename, description + #%R%G%B %S %F %D + # Red Green Blue Sharpness Fingerprint Date(formatting?) + # %s %H + # filesize Hash + pass + + def main(): options=setup_options(); if not os.path.exists(options.sqlfile):