diff --git a/image_list.py b/image_list.py index c80dffe..2c53e50 100755 --- a/image_list.py +++ b/image_list.py @@ -75,6 +75,19 @@ def delete_nonexisting(sqlfile): print('removing.. '+row[0]) dbdel.execute("DELETE FROM list where file == ?",(row[0],)) conn.commit() + # database may have duplicate files due to crash etc.. + db.execute("SELECT file,date,count(*) FROM list GROUP BY file HAVING count(*) > 1 ") + dupfile=[] + for row in db: + print(row) + #hash=row[0] + #dbh.execute("SELECT file,width,height,date FROM list WHERE hash = ?",(hash,)) + #flist=[] + #for row in dbh: + # flist.append(row) + #flist.sort(key=lambda file: file[3]) + #duphash.append((hash, flist)) + #duphash.sort(key=lambda file: file[1][0]) return def delete_files(files):