mapillary-downloader 0.4.1__py3-none-any.whl → 0.4.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,9 +56,21 @@ def main():
56
56
  action="store_true",
57
57
  help="Don't check if collection exists on Internet Archive before downloading",
58
58
  )
59
+ parser.add_argument(
60
+ "--debug",
61
+ action="store_true",
62
+ help="Enable debug logging (EXIF data, API responses, etc.)",
63
+ )
59
64
 
60
65
  args = parser.parse_args()
61
66
 
67
+ # Set debug logging level if requested
68
+ if args.debug:
69
+ import logging
70
+
71
+ logging.getLogger("mapillary_downloader").setLevel(logging.DEBUG)
72
+ logger.debug("Debug logging enabled")
73
+
62
74
  # Check for token
63
75
  if not args.token:
64
76
  logger.error("Error: Mapillary API token required. Use --token or set MAPILLARY_TOKEN environment variable")
@@ -92,8 +92,10 @@ class MapillaryClient:
92
92
  images = data.get("data", [])
93
93
  total_fetched += len(images)
94
94
  logger.info(f"Fetched metadata for {total_fetched:,} images...")
95
+ logger.debug(f"API response paging: {data.get('paging', {})}")
95
96
 
96
97
  for image in images:
98
+ logger.debug(f"Image metadata: {image}")
97
99
  yield image
98
100
 
99
101
  # Get next page URL
@@ -1,8 +1,11 @@
1
1
  """EXIF metadata writer for Mapillary images."""
2
2
 
3
+ import logging
3
4
  import piexif
4
5
  from datetime import datetime
5
6
 
7
+ logger = logging.getLogger("mapillary_downloader")
8
+
6
9
 
7
10
  def decimal_to_dms(decimal):
8
11
  """Convert decimal degrees to degrees, minutes, seconds format for EXIF.
@@ -47,6 +50,9 @@ def write_exif_to_image(image_path, metadata):
47
50
  True if successful, False otherwise
48
51
  """
49
52
  try:
53
+ logger.debug(f"Writing EXIF to {image_path}")
54
+ logger.debug(f"Metadata: {metadata}")
55
+
50
56
  # Load existing EXIF data if any
51
57
  try:
52
58
  exif_dict = piexif.load(str(image_path))
@@ -99,13 +105,17 @@ def write_exif_to_image(image_path, metadata):
99
105
  # GPS Altitude - prefer computed_altitude over altitude
100
106
  altitude = metadata.get("computed_altitude") or metadata.get("altitude")
101
107
  if altitude is not None:
102
- exif_dict["GPS"][piexif.GPSIFD.GPSAltitude] = (int(abs(altitude) * 100), 100)
108
+ altitude_val = int(abs(altitude) * 100)
109
+ logger.debug(f"Raw altitude value: {altitude}, calculated: {altitude_val}")
110
+ exif_dict["GPS"][piexif.GPSIFD.GPSAltitude] = (altitude_val, 100)
103
111
  exif_dict["GPS"][piexif.GPSIFD.GPSAltitudeRef] = 1 if altitude < 0 else 0
104
112
 
105
113
  # GPS Compass direction
106
114
  compass = metadata.get("computed_compass_angle") or metadata.get("compass_angle")
107
115
  if compass is not None:
108
- exif_dict["GPS"][piexif.GPSIFD.GPSImgDirection] = (int(compass * 100), 100)
116
+ # Normalize compass to 0-360 range
117
+ compass_val = int((compass % 360) * 100)
118
+ exif_dict["GPS"][piexif.GPSIFD.GPSImgDirection] = (compass_val, 100)
109
119
  exif_dict["GPS"][piexif.GPSIFD.GPSImgDirectionRef] = b"T" # True north
110
120
 
111
121
  # GPS Version
@@ -115,8 +125,10 @@ def write_exif_to_image(image_path, metadata):
115
125
  exif_bytes = piexif.dump(exif_dict)
116
126
  piexif.insert(exif_bytes, str(image_path))
117
127
 
128
+ logger.debug(f"Successfully wrote EXIF to {image_path}")
118
129
  return True
119
130
 
120
131
  except Exception as e:
121
- print(f"Warning: Failed to write EXIF data to {image_path}: {e}")
132
+ logger.warning(f"Failed to write EXIF data to {image_path}: {e}")
133
+ logger.debug(f"Full metadata: {metadata}")
122
134
  return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapillary_downloader
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Download your Mapillary data before it's gone
5
5
  Author-email: Gareth Davidson <gaz@bitplane.net>
6
6
  Requires-Python: >=3.10
@@ -1,8 +1,8 @@
1
1
  mapillary_downloader/__init__.py,sha256=KEjiBRghXDeA7E15RJeLBfQm-yNJkowZarL59QOh_1w,120
2
- mapillary_downloader/__main__.py,sha256=avh546grDz379HbA4JOOH2ovSH64Z69okGZO8LKciJ8,3964
3
- mapillary_downloader/client.py,sha256=O7JgshaM3QKUv0xXuBbe_uPqsTr4lgyuVUHYndvXTfA,4611
2
+ mapillary_downloader/__main__.py,sha256=Kjfx2woMyCvAxYAdqvtXtYJknCMviV_K2PSo0cDc8Hg,4320
3
+ mapillary_downloader/client.py,sha256=a5n43FLHP45EHodEjl0ieziBK-b6Ey-rZJwYB6EFhNI,4743
4
4
  mapillary_downloader/downloader.py,sha256=cVV24uIc3nQ_YXzqpwdVSr-L4fkME3sXq3pCfFS-0Ls,12476
5
- mapillary_downloader/exif_writer.py,sha256=Bn1u3QULfHtae86FnUGcqN450NccJwtwW9wVaSRyx9E,4615
5
+ mapillary_downloader/exif_writer.py,sha256=K_441EG1siWyNMmFGZSfnORUCjBThkeg4JFtbg9AOsA,5120
6
6
  mapillary_downloader/ia_check.py,sha256=L2MEbG_KmlAd5NLmo2HQkO8HWvRN0brE5wXXoyNMbq8,1100
7
7
  mapillary_downloader/ia_meta.py,sha256=78rcybHIPnQDsF02KGj6RYmDXzYzrU8sdVx4Q9Y0sfI,6266
8
8
  mapillary_downloader/logging_config.py,sha256=Z-wNq34nt7aIhJWdeKc1feTY46P9-Or7HtiX7eUFjEI,2324
@@ -10,8 +10,8 @@ mapillary_downloader/tar_sequences.py,sha256=mqs5p3N7osV_bxTkw6i34GVmxCBBEbIiKKx
10
10
  mapillary_downloader/utils.py,sha256=yzVgS1mwsklDAqrimaFafgTTXtRYQUbKP98Xgh9d2KA,1174
11
11
  mapillary_downloader/webp_converter.py,sha256=vYLLQxDmdnqRz0nm7wXwRUd4x9mQZNah-DrncpA8sNs,1901
12
12
  mapillary_downloader/worker.py,sha256=eqaBhP5NE_VoJSTZfFb4OAqGyVX65xyoVUp2vosYBM8,3722
13
- mapillary_downloader-0.4.1.dist-info/entry_points.txt,sha256=PdYtxOXHMJrUhmiPO4G-F98VuhUI4MN9D_T4KPrVZ5w,75
14
- mapillary_downloader-0.4.1.dist-info/licenses/LICENSE.md,sha256=7_BIuQ-veOrsF-WarH8kTkm0-xrCLvJ1PFE1C4Ebs64,146
15
- mapillary_downloader-0.4.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
16
- mapillary_downloader-0.4.1.dist-info/METADATA,sha256=wgVRFgLesT4OFb-dsyQ-14KvXQTagnx7WjqHkAt2aFQ,4982
17
- mapillary_downloader-0.4.1.dist-info/RECORD,,
13
+ mapillary_downloader-0.4.2.dist-info/entry_points.txt,sha256=PdYtxOXHMJrUhmiPO4G-F98VuhUI4MN9D_T4KPrVZ5w,75
14
+ mapillary_downloader-0.4.2.dist-info/licenses/LICENSE.md,sha256=7_BIuQ-veOrsF-WarH8kTkm0-xrCLvJ1PFE1C4Ebs64,146
15
+ mapillary_downloader-0.4.2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
16
+ mapillary_downloader-0.4.2.dist-info/METADATA,sha256=hPFWZByequcnTqySES4YavjWUAvMbTj1u0-Xd3AZ51U,4982
17
+ mapillary_downloader-0.4.2.dist-info/RECORD,,