Compare commits

...

2 Commits

Author SHA1 Message Date
c936756f7d update README.md 2025-02-11 17:33:12 -08:00
f0d0d1479c update app/photo_routes/scripts/get_exif_data.py to account
for new exif data type of IFDRational, instead of tuple for
some exif attributes
2025-02-10 16:27:51 -08:00
2 changed files with 36 additions and 16 deletions

View File

@@ -85,3 +85,6 @@ For 2fa, you can use an authenticator application such as
2. install certbot and get certs for each of the two subdomains 2. install certbot and get certs for each of the two subdomains
2. install service file in `/etc/systemd/system` 2. install service file in `/etc/systemd/system`
2. enable and start systemd service 2. enable and start systemd service
## Debian 12 Upgrade
2. wtforms.validators now requires `python3-wtforms-components` for the email validator

View File

@@ -41,15 +41,19 @@ def get_exif(img_raw, exif_data):
date_format, date_format,
) )
if v == "FNumber": if v == "FNumber":
exif_data['fnumber'] = round( if type(exifdata[k]) == tuple:
exifdata[k][0] / exifdata[k][1], x, y = exifdata[k][0], exifdata[k][1]
1, else:
) x = exifdata[k].numerator
y = exifdata[k].denominator
exif_data['fnumber'] = round(x / y, 1)
if v == "DigitalZoomRatio": if v == "DigitalZoomRatio":
exif_data['DigitalZoomRatio'] = round( if type(exifdata[k]) == tuple:
exifdata[k][0] / exifdata[k][1], x, y = exifdata[k][0], exifdata[k][1]
2, else:
) x = exifdata[k].numerator
y = exifdata[k].denominator
exif_data['DigitalZoomRatio'] = round(x / y, 2)
if v == "TimeZoneOffset": if v == "TimeZoneOffset":
exif_data['TimeZoneOffset'] = exifdata[k] exif_data['TimeZoneOffset'] = exifdata[k]
if v == "GPSInfo": if v == "GPSInfo":
@@ -62,10 +66,13 @@ def get_exif(img_raw, exif_data):
"big", "big",
) )
if i == 'GPSAltitude': if i == 'GPSAltitude':
gpsinfo['GPSAltitude'] = round( if type(exifdata[k][h]) == tuple:
exifdata[k][h][0] / exifdata[k][h][1], x = exifdata[k][h][0]
3, y = exifdata[k][h][1]
) else:
x = exifdata[k][h].numerator
y = exifdata[k][h].denominator
gpsinfo['GPSAltitude'] = round(x / y, 3)
if i == 'GPSLatitudeRef': if i == 'GPSLatitudeRef':
gpsinfo['GPSLatitudeRef'] = exifdata[k][h] gpsinfo['GPSLatitudeRef'] = exifdata[k][h]
if i == 'GPSLatitude': if i == 'GPSLatitude':
@@ -100,10 +107,20 @@ def update_gpsinfo(gpsinfo, exif_data):
def calc_coordinate(x): def calc_coordinate(x):
if type(x[0]) == tuple:
degrees = x[0][0] / x[0][1] degrees = x[0][0] / x[0][1]
else:
degrees = x[0].numerator / x[0].denominator
if type(x[1]) == tuple:
minutes = x[1][0] / x[1][1] minutes = x[1][0] / x[1][1]
else:
minutes = x[1].numerator / x[1].denominator
if type(x[2]) == tuple:
seconds = x[2][0] / x[2][1] seconds = x[2][0] / x[2][1]
return round(degrees + minutes / 60 + seconds / 3600, 5) else:
seconds = x[2].numerator / x[2].denominator
result = round(degrees + minutes / 60 + seconds / 3600, 5)
return result
def get_dimensions_and_format(photo, exif_data): def get_dimensions_and_format(photo, exif_data):