mapillary-downloader 0.7.5__py3-none-any.whl → 0.7.7__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.
@@ -105,6 +105,7 @@ class MapillaryDownloader:
105
105
  self.metadata_file = self.output_dir / "metadata.jsonl"
106
106
  self.progress_file = self.output_dir / "progress.json"
107
107
  self.downloaded = self._load_progress()
108
+ self._last_save_time = time.time()
108
109
 
109
110
  def _load_progress(self):
110
111
  """Load previously downloaded image IDs for this quality."""
@@ -248,8 +249,11 @@ class MapillaryDownloader:
248
249
  logger.info(f"Downloaded: {downloaded_count:,} ({format_size(total_bytes)})")
249
250
 
250
251
  if downloaded_count % 100 == 0:
251
- self._save_progress()
252
252
  pool.check_throughput(downloaded_count)
253
+ # Save progress every 5 minutes
254
+ if time.time() - self._last_save_time >= 300:
255
+ self._save_progress()
256
+ self._last_save_time = time.time()
253
257
  else:
254
258
  failed_count += 1
255
259
  logger.warning(f"Failed to download {image_id}: {error_msg}")
@@ -394,8 +398,11 @@ class MapillaryDownloader:
394
398
 
395
399
  if downloaded_count % 100 == 0:
396
400
  logger.info(f"Downloaded: {downloaded_count:,} ({format_size(total_bytes)})")
397
- self._save_progress()
398
401
  pool.check_throughput(downloaded_count)
402
+ # Save progress every 5 minutes
403
+ if time.time() - self._last_save_time >= 300:
404
+ self._save_progress()
405
+ self._last_save_time = time.time()
399
406
  else:
400
407
  failed_count += 1
401
408
  logger.warning(f"Failed to download {image_id}: {error_msg}")
@@ -77,7 +77,7 @@ def safe_json_save(file_path, data):
77
77
  temp_file.replace(file_path)
78
78
 
79
79
 
80
- def http_get_with_retry(url, params=None, max_retries=5, base_delay=1.0, timeout=60):
80
+ def http_get_with_retry(url, params=None, max_retries=5, base_delay=1.0, timeout=60, session=None):
81
81
  """HTTP GET with exponential backoff retry.
82
82
 
83
83
  Args:
@@ -86,6 +86,7 @@ def http_get_with_retry(url, params=None, max_retries=5, base_delay=1.0, timeout
86
86
  max_retries: Maximum retry attempts (default: 5)
87
87
  base_delay: Initial delay in seconds (default: 1.0)
88
88
  timeout: Request timeout in seconds (default: 60)
89
+ session: Optional requests.Session for connection pooling
89
90
 
90
91
  Returns:
91
92
  requests.Response object
@@ -93,9 +94,10 @@ def http_get_with_retry(url, params=None, max_retries=5, base_delay=1.0, timeout
93
94
  Raises:
94
95
  requests.RequestException: If all retries exhausted
95
96
  """
97
+ getter = session or requests
96
98
  for attempt in range(max_retries):
97
99
  try:
98
- response = requests.get(url, params=params, timeout=timeout)
100
+ response = getter.get(url, params=params, timeout=timeout)
99
101
  response.raise_for_status()
100
102
  return response
101
103
  except RequestException as e:
@@ -105,7 +105,7 @@ def download_and_convert_image(image_data, output_dir, quality, convert_webp, se
105
105
 
106
106
  try:
107
107
  # Use retry logic with 3 attempts for image downloads
108
- response = http_get_with_retry(image_url, max_retries=3, base_delay=1.0, timeout=60)
108
+ response = http_get_with_retry(image_url, max_retries=3, base_delay=1.0, timeout=60, session=session)
109
109
 
110
110
  with open(jpg_path, "wb") as f:
111
111
  for chunk in response.iter_content(chunk_size=8192):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapillary_downloader
3
- Version: 0.7.5
3
+ Version: 0.7.7
4
4
  Summary: Archive user data from Mapillary
5
5
  Author-email: Gareth Davidson <gaz@bitplane.net>
6
6
  Requires-Python: >=3.10
@@ -1,7 +1,7 @@
1
1
  mapillary_downloader/__init__.py,sha256=KEjiBRghXDeA7E15RJeLBfQm-yNJkowZarL59QOh_1w,120
2
2
  mapillary_downloader/__main__.py,sha256=iuDGZoFVu8q_dTvJuExSpj4Jx1x9xASSjUITRGwd0RA,4864
3
3
  mapillary_downloader/client.py,sha256=a5n43FLHP45EHodEjl0ieziBK-b6Ey-rZJwYB6EFhNI,4743
4
- mapillary_downloader/downloader.py,sha256=TWk3CiPbuEWgFZoyA146xdvH-heZnmBWFJKKaBbwa40,18456
4
+ mapillary_downloader/downloader.py,sha256=l6MT3dFOB-lZfoLEVVGIkioKSXcDu30Q9xc2MZ17iGI,18897
5
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=DTmFwIKN03aNgBaerQWF5x_hveDpjvrMBTdRAgHoFRk,6365
@@ -9,12 +9,12 @@ mapillary_downloader/ia_stats.py,sha256=kjbNUVXtZziWxTx1yi2TLTZt_F0BWjrv1WWyy6Ze
9
9
  mapillary_downloader/logging_config.py,sha256=Z-wNq34nt7aIhJWdeKc1feTY46P9-Or7HtiX7eUFjEI,2324
10
10
  mapillary_downloader/metadata_reader.py,sha256=Re-HN0Vfc7Hs1eOut7uOoW7jWJ2PIbKoNzC7Ak3ah5o,4933
11
11
  mapillary_downloader/tar_sequences.py,sha256=hh77hfj0DFSPrPRfbGrOhvnZMctKESgO0gSpJXUxCCs,4886
12
- mapillary_downloader/utils.py,sha256=VgcwbC8yb2XlTGerTNwHBU42K2IN14VU7P-I52Vb01c,2947
12
+ mapillary_downloader/utils.py,sha256=qQ_ewhN0b0r4KLfBtf9tjwewF9PHVF1swLt71t8x9F0,3058
13
13
  mapillary_downloader/webp_converter.py,sha256=vYLLQxDmdnqRz0nm7wXwRUd4x9mQZNah-DrncpA8sNs,1901
14
- mapillary_downloader/worker.py,sha256=K2DkQgFzALKs20TsG1KibNUdFiWN_v8MtVnBX_0xVyc,5162
14
+ mapillary_downloader/worker.py,sha256=HOfbOtJG4fgYp6wvBjZnAKZDf59tWbWF0ivcD2z4SYk,5179
15
15
  mapillary_downloader/worker_pool.py,sha256=QnqYcPCi3GNu2e8GNG_qQ8v680PWzCZcGE5KeskqZxU,7868
16
- mapillary_downloader-0.7.5.dist-info/entry_points.txt,sha256=PdYtxOXHMJrUhmiPO4G-F98VuhUI4MN9D_T4KPrVZ5w,75
17
- mapillary_downloader-0.7.5.dist-info/licenses/LICENSE.md,sha256=7_BIuQ-veOrsF-WarH8kTkm0-xrCLvJ1PFE1C4Ebs64,146
18
- mapillary_downloader-0.7.5.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
19
- mapillary_downloader-0.7.5.dist-info/METADATA,sha256=UMqlEfuzAOLO30QSQdqCveUoIrhiq4WE_cgZvuWkxnw,5540
20
- mapillary_downloader-0.7.5.dist-info/RECORD,,
16
+ mapillary_downloader-0.7.7.dist-info/entry_points.txt,sha256=PdYtxOXHMJrUhmiPO4G-F98VuhUI4MN9D_T4KPrVZ5w,75
17
+ mapillary_downloader-0.7.7.dist-info/licenses/LICENSE.md,sha256=7_BIuQ-veOrsF-WarH8kTkm0-xrCLvJ1PFE1C4Ebs64,146
18
+ mapillary_downloader-0.7.7.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
19
+ mapillary_downloader-0.7.7.dist-info/METADATA,sha256=vLcis_SSkhfsgixLzPAiQMay3Ug0bHcG7iPdCRzXeAI,5540
20
+ mapillary_downloader-0.7.7.dist-info/RECORD,,