adding imagelist descriptor skeleton

This commit is contained in:
ville rantanen
2014-08-04 14:47:49 +03:00
parent b5d52a173b
commit 459bbfacde

View File

@@ -9,6 +9,7 @@ import hashlib
from argparse import ArgumentParser from argparse import ArgumentParser
SQLFILE='list_of_images.sqlite' SQLFILE='list_of_images.sqlite'
DESCFILE='descriptions.csv'
IMGMATCH=re.compile('.*\.jpg$|.*\.jpeg$|.*\.png$|.*\.gif$',re.I) IMGMATCH=re.compile('.*\.jpg$|.*\.jpeg$|.*\.png$|.*\.gif$',re.I)
BADDIRS=['_tn','_med'] BADDIRS=['_tn','_med']
MINSIZE=0 MINSIZE=0
@@ -73,6 +74,9 @@ def createdb(sqlfile):
width INTEGER,height INTEGER,size INTEGER,\ width INTEGER,height INTEGER,size INTEGER,\
fingerprint TEXT,sharpness NUMERIC,\ fingerprint TEXT,sharpness NUMERIC,\
R REAL,G REAL, B REAL, BR REAL, BG REAL, BB REAL)') 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() conn.commit()
return return
@@ -692,6 +696,23 @@ def humanize_size(size,precision=1):
defPrecision=precision defPrecision=precision
return "%.*f%s"%(defPrecision,size,suffixes[suffixIndex]) 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(): def main():
options=setup_options(); options=setup_options();
if not os.path.exists(options.sqlfile): if not os.path.exists(options.sqlfile):