summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoruser@node5.net <user@node5.net>2025-04-21 23:07:43 +0200
committeruser@node5.net <user@node5.net>2025-04-21 23:07:43 +0200
commitd5f5e9af4a382be34592e93d34ee75408f3b2924 (patch)
tree5cede7141a09c747edcd047055d4bf97fc41ba4c /src
parent3fb9ee7fc744fdde3f76e78dfcfc996e71fe172f (diff)
Fix startup checkHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/main.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/main.py b/src/main.py
index a3e6b11..6dae322 100644
--- a/src/main.py
+++ b/src/main.py
@@ -11,10 +11,6 @@ import geopy.distance
app = flask.Flask(__name__)
-pic_root_path = 'src/static/pics/mine'
-
-pics = os.listdir(pic_root_path)
-
def decimal_coords(coords, ref):
decimal_degrees = coords[0] + coords[1] / 60 + coords[2] / 3600
if ref == "S" or ref =='W' :
@@ -89,6 +85,23 @@ def game():
return flask.render_template('game.html')
+
+pic_root_path = 'src/static/pics/mine'
+pics_original = os.listdir(pic_root_path)
+pics = []
+
+# Check if all images have GPS coordinates on application start
+for pic in pics_original:
+ img_path = os.path.join(pic_root_path, pic)
+ try:
+ exif = get_exif(img_path)
+ correct_coordinates = image_coordinates(exif)
+ pics.append(pic)
+ except Exception as ex:
+ print(f'Error loading GPS coordinates for: {img_path}')
+ raise ex
+
+
with closing(sqlite3.connect("guess_where.db")) as connection:
with closing(connection.cursor()) as cursor:
rows = cursor.execute("""
@@ -102,13 +115,3 @@ with closing(sqlite3.connect("guess_where.db")) as connection:
)
""").fetchall()
-
-
-# Check if all images have GPS coordinates on application start
-for pic in pics:
- img_path = os.path.join(pic_root_path, pic)
- try:
- correct_coordinates = image_coordinates(img_path)
- except Exception as ex:
- print(f'Error loading GPS coordinates for: {img_path}')
-