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):
|
def extractor(dt_file, start, end):
|
||||||
catalog = {}
|
catalog = {}
|
||||||
|
unknow_files = 0
|
||||||
conn = sqlite3.connect(dt_file)
|
conn = sqlite3.connect(dt_file)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
req = "SELECT id, model, lens, exposure, aperture, iso, focal_length, datetime_taken, width, height FROM images;"
|
req = "SELECT id, model, lens, exposure, aperture, iso, focal_length, datetime_taken, width, height FROM images;"
|
||||||
cursor.execute(req)
|
cursor.execute(req)
|
||||||
res = cursor.fetchall()
|
res = cursor.fetchall()
|
||||||
for data in res:
|
for data in res:
|
||||||
|
if not data[7]:
|
||||||
|
unknow_files += 1
|
||||||
|
else:
|
||||||
img_date = datetime.strptime(data[7], "%Y:%m:%d %H:%M:%S")
|
img_date = datetime.strptime(data[7], "%Y:%m:%d %H:%M:%S")
|
||||||
if start <= img_date <= end:
|
if start <= img_date <= end:
|
||||||
catalog.update({
|
catalog.update({
|
||||||
@ -76,6 +80,7 @@ def extractor(dt_file, start, end):
|
|||||||
dates.update({date: dates_list.count(date)})
|
dates.update({date: dates_list.count(date)})
|
||||||
return {
|
return {
|
||||||
"total": len(catalog.keys()),
|
"total": len(catalog.keys()),
|
||||||
|
"unknows": unknow_files,
|
||||||
"date": dates,
|
"date": dates,
|
||||||
"cameras": cameras,
|
"cameras": cameras,
|
||||||
"lenses": lenses,
|
"lenses": lenses,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user