Skip to content

Commit

Permalink
refactors - kamangir/bolt#1234
Browse files Browse the repository at this point in the history
  • Loading branch information
kamangir committed Feb 25, 2024
1 parent 2080f1f commit 7ee7a11
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions coords.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
{ "type": "Feature", "properties": { "datetime": "2022:06:08 20:07:57", "picture": "https://kamangir-public.s3.ca-central-1.amazonaws.com/ferfereh-images-v2/20220608_200757.jpg" }, "geometry": { "type": "Point", "coordinates": [ -79.4087336, 43.650852999722218 ] } },
{ "type": "Feature", "properties": { "datetime": "2023:10:15 10:26:28", "picture": "https://kamangir-public.s3.ca-central-1.amazonaws.com/ferfereh-images-v2/20231015_102628.jpg" }, "geometry": { "type": "Point", "coordinates": [ 52.5412672, 29.629404799722224 ] } },
{ "type": "Feature", "properties": { "datetime": "2022:05:12 18:40:17", "picture": "https://kamangir-public.s3.ca-central-1.amazonaws.com/ferfereh-images-v2/20220512_184017.jpg" }, "geometry": { "type": "Point", "coordinates": [ -79.4153545, 43.626639099722226 ] } },
{ "type": "Feature", "properties": { "datetime": "unknown", "picture": "https://kamangir-public.s3.ca-central-1.amazonaws.com/ferfereh-images-v2/IMG_3528.jpg" }, "geometry": { "type": "Point", "coordinates": [ 153.025, -27.461 ] } },
{ "type": "Feature", "properties": { "datetime": "2023:07:09 14:16:19", "picture": "https://kamangir-public.s3.ca-central-1.amazonaws.com/ferfereh-images-v2/20230709_141619.jpg" }, "geometry": { "type": "Point", "coordinates": [ -123.1449486, 49.3036827 ] } },
{ "type": "Feature", "properties": { "datetime": "2023:08:13 11:38:56", "picture": "https://kamangir-public.s3.ca-central-1.amazonaws.com/ferfereh-images-v2/PXL_20230813_173856645.jpg" }, "geometry": { "type": "Point", "coordinates": [ -133.037213888888886, 69.455466666666666 ] } },
{ "type": "Feature", "properties": { "datetime": "2023:07:02 15:26:44", "picture": "https://kamangir-public.s3.ca-central-1.amazonaws.com/ferfereh-images-v2/20230702_152644.jpg" }, "geometry": { "type": "Point", "coordinates": [ -123.155910199722229, 49.308539699722218 ] } },
Expand Down
4 changes: 2 additions & 2 deletions ferfereh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = "ferfereh"

VERSION = "1.99.1"
VERSION = "1.102.1"

DESCRIPTION = "3d-printed graffiti"
DESCRIPTION = "🌀 3d-printed graffiti"
4 changes: 1 addition & 3 deletions ferfereh/__main__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import argparse
from ferfereh import NAME, VERSION, DESCRIPTION
from abcli import logging
import logging
from ferfereh.logger import logger

logger = logging.getLogger(__name__)

parser = argparse.ArgumentParser(NAME, description=f"{NAME}-{VERSION}")
parser.add_argument(
Expand Down
20 changes: 11 additions & 9 deletions ferfereh/coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
from tqdm import tqdm
from abcli import file
from abcli.modules import objects
from abcli.logging import crash_report
import abcli.logging
import logging

logger = logging.getLogger()
from ferfereh.logger import logger


# https://medium.com/spatial-data-science/how-to-extract-gps-coordinates-from-images-in-python-e66e542af354
Expand All @@ -25,10 +21,10 @@ def get_image_info(image_path):
with open(image_path, "rb") as src:
img = Image(src)
if not img.has_exif:
logger.info(f"{file.name_and_extension(image_path)}: no EXIF information.")
logger.info(f"{file.name_and_extension(image_path)}: no EXIF.")
return False, {}
except:
crash_report(f"get_image_info({image_path}")
logger.error(f"{file.name_and_extension(image_path)}: bad EXIF.")
return False, {}

try:
Expand All @@ -37,11 +33,17 @@ def get_image_info(image_path):
decimal_coords(img.gps_longitude, img.gps_longitude_ref),
)
except AttributeError:
logger.info(f"{file.name_and_extension(image_path)}: bad EXIF information.")
logger.error(f"{file.name_and_extension(image_path)}: bad EXIF.")
return False, {}

try:
datetime = img.datetime_original
except:
logger.warning(f"{file.name_and_extension(image_path)}: no datetime_original.")
datetime = "unknown"

return True, {
"datetime": img.datetime_original,
"datetime": datetime,
"coords": coords,
}

Expand Down
4 changes: 4 additions & 0 deletions ferfereh/logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from abcli import logging
import logging

logger = logging.getLogger("🌀")

0 comments on commit 7ee7a11

Please sign in to comment.