dtlib.py : ne crash pas si une image n'a pas de donnée exif
This commit is contained in:
parent
557719baf6
commit
00270fdc18
5
dtlib.py
5
dtlib.py
@ -6,12 +6,16 @@ from datetime import datetime
|
||||
|
||||
def extractor(dt_file, start, end):
|
||||
catalog = {}
|
||||
unknow_files = 0
|
||||
conn = sqlite3.connect(dt_file)
|
||||
cursor = conn.cursor()
|
||||
req = "SELECT id, model, lens, exposure, aperture, iso, focal_length, datetime_taken, width, height FROM images;"
|
||||
cursor.execute(req)
|
||||
res = cursor.fetchall()
|
||||
for data in res:
|
||||
if not data[7]:
|
||||
unknow_files += 1
|
||||
else:
|
||||
img_date = datetime.strptime(data[7], "%Y:%m:%d %H:%M:%S")
|
||||
if start <= img_date <= end:
|
||||
catalog.update({
|
||||
@ -76,6 +80,7 @@ def extractor(dt_file, start, end):
|
||||
dates.update({date: dates_list.count(date)})
|
||||
return {
|
||||
"total": len(catalog.keys()),
|
||||
"unknows": unknow_files,
|
||||
"date": dates,
|
||||
"cameras": cameras,
|
||||
"lenses": lenses,
|
||||
|
Loading…
x
Reference in New Issue
Block a user