From 9ab77f59a35eda233a18086bd9124c1653bd93d5 Mon Sep 17 00:00:00 2001 From: q Date: Tue, 27 Nov 2012 19:38:28 +0200 Subject: [PATCH 1/2] added verbosity to imagelist --- image_list.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/image_list.py b/image_list.py index 94de238..8a89385 100755 --- a/image_list.py +++ b/image_list.py @@ -88,9 +88,11 @@ def add_recurse(options): conn.text_factory=str db=conn.cursor() for path,dirs,files in os.walk(options.startpath,followlinks=options.symlinks): + print('Checking '+path) dirs=clean_dirs(dirs) if not options.symlinks: files=clean_syms(files) + files.sort() for file in files: if IMGMATCH.match(file): filename=os.path.abspath(os.path.join(path,file)) From 480e4de1f1cf777f946d45b48fb673ca0ea2afe0 Mon Sep 17 00:00:00 2001 From: q Date: Sat, 1 Dec 2012 19:41:35 +0200 Subject: [PATCH 2/2] added feature to limit duplicate search --- image_list.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/image_list.py b/image_list.py index 8a89385..d6ae840 100755 --- a/image_list.py +++ b/image_list.py @@ -233,12 +233,16 @@ def confirm(prompt=None, resp=False): if ans == 'n' or ans == 'N': return False -def find_duplicates(sqlfile): +def find_duplicates(sqlfile,search): + if (search=='.'): + search='%' + else: + search='%'+search+'%' conn=sqlite3.connect(sqlfile) conn.text_factory=str db=conn.cursor() dbh=conn.cursor() - db.execute("SELECT hash,count(*) FROM list group by hash HAVING count(*) > 1 ") + db.execute("SELECT hash,count(*) FROM list WHERE file LIKE ? group by hash HAVING count(*) > 1 ",(search,)) duphash=[] for row in db: hash=row[0] @@ -300,7 +304,7 @@ def main(): print('Random lists...') random_lists(options.sqlfile) if options.duplicate: - files=find_duplicates(options.sqlfile) + files=find_duplicates(options.sqlfile,options.startpath) print_dup_structure(files) if options.searchsmall: files=find_smalls(options.minsize,options.sqlfile)