mapillary-downloader 0.3.0__py3-none-any.whl → 0.3.1__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.
@@ -38,7 +38,7 @@ def main():
38
38
  "--workers",
39
39
  type=int,
40
40
  default=None,
41
- help="Number of parallel workers (default: number of CPU cores)",
41
+ help="Number of parallel workers (default: half of CPU cores)",
42
42
  )
43
43
  parser.add_argument(
44
44
  "--no-tar",
@@ -25,14 +25,14 @@ class MapillaryDownloader:
25
25
  output_dir: Base directory to save downloads
26
26
  username: Mapillary username (for collection directory)
27
27
  quality: Image quality (for collection directory)
28
- workers: Number of parallel workers (default: cpu_count)
28
+ workers: Number of parallel workers (default: half of cpu_count)
29
29
  tar_sequences: Whether to tar sequence directories after download (default: True)
30
30
  """
31
31
  self.client = client
32
32
  self.base_output_dir = Path(output_dir)
33
33
  self.username = username
34
34
  self.quality = quality
35
- self.workers = workers if workers is not None else os.cpu_count()
35
+ self.workers = workers if workers is not None else max(1, os.cpu_count() // 2)
36
36
  self.tar_sequences = tar_sequences
37
37
 
38
38
  # If username and quality provided, create collection directory
@@ -4,7 +4,6 @@ import tempfile
4
4
  from pathlib import Path
5
5
  import requests
6
6
  from requests.exceptions import RequestException
7
- import time
8
7
  from mapillary_downloader.exif_writer import write_exif_to_image
9
8
  from mapillary_downloader.webp_converter import convert_to_webp
10
9
 
@@ -54,29 +53,23 @@ def download_and_convert_image(image_data, output_dir, quality, convert_webp, ac
54
53
  final_path = jpg_path
55
54
 
56
55
  # Download image
56
+ # No retries for CDN images - they're cheap, just skip failures and move on
57
57
  session = requests.Session()
58
58
  session.headers.update({"Authorization": f"OAuth {access_token}"})
59
59
 
60
- max_retries = 10
61
- base_delay = 1.0
62
60
  bytes_downloaded = 0
63
61
 
64
- for attempt in range(max_retries):
65
- try:
66
- response = session.get(image_url, stream=True, timeout=60)
67
- response.raise_for_status()
68
-
69
- with open(jpg_path, "wb") as f:
70
- for chunk in response.iter_content(chunk_size=8192):
71
- f.write(chunk)
72
- bytes_downloaded += len(chunk)
73
- break
74
- except RequestException as e:
75
- if attempt == max_retries - 1:
76
- return (image_id, 0, False, f"Download failed: {e}")
77
-
78
- delay = base_delay * (2**attempt)
79
- time.sleep(delay)
62
+ try:
63
+ # 60 second timeout for entire download (connection + read)
64
+ response = session.get(image_url, stream=True, timeout=60)
65
+ response.raise_for_status()
66
+
67
+ with open(jpg_path, "wb") as f:
68
+ for chunk in response.iter_content(chunk_size=8192):
69
+ f.write(chunk)
70
+ bytes_downloaded += len(chunk)
71
+ except RequestException as e:
72
+ return (image_id, 0, False, f"Download failed: {e}")
80
73
 
81
74
  # Write EXIF metadata
82
75
  write_exif_to_image(jpg_path, image_data)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapillary_downloader
3
- Version: 0.3.0
3
+ Version: 0.3.1
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
@@ -63,7 +63,7 @@ mapillary-downloader --token YOUR_TOKEN --username SOME_USERNAME --output ./down
63
63
  | `--quality` | 256, 1024, 2048 or original | `original` |
64
64
  | `--bbox` | `west,south,east,north` | `None` |
65
65
  | `--webp` | Convert to WebP (saves ~70% space) | `False` |
66
- | `--workers` | Number of parallel download workers | CPU count |
66
+ | `--workers` | Number of parallel download workers | Half of CPU count |
67
67
  | `--no-tar` | Don't tar sequence directories | `False` |
68
68
 
69
69
  The downloader will:
@@ -1,16 +1,16 @@
1
1
  mapillary_downloader/__init__.py,sha256=KEjiBRghXDeA7E15RJeLBfQm-yNJkowZarL59QOh_1w,120
2
- mapillary_downloader/__main__.py,sha256=TaJIsUQkM4vkAAujmInJu6Nqjrf9-yI9u5teh6d5U-E,3009
2
+ mapillary_downloader/__main__.py,sha256=SEbILB0aQsDY52r1HNgDPX_XaH_EiJCarDwgNQRw1hM,3007
3
3
  mapillary_downloader/client.py,sha256=O7JgshaM3QKUv0xXuBbe_uPqsTr4lgyuVUHYndvXTfA,4611
4
- mapillary_downloader/downloader.py,sha256=U3a5oM1QC22DqfUFyBUFEbfZ5E2wqVTkHdlWMVsUlXA,8212
4
+ mapillary_downloader/downloader.py,sha256=tvVfrn4MHeLZT-a-ihPykGgR3yUuG3adhwzzToxA1pQ,8233
5
5
  mapillary_downloader/exif_writer.py,sha256=Bn1u3QULfHtae86FnUGcqN450NccJwtwW9wVaSRyx9E,4615
6
6
  mapillary_downloader/ia_meta.py,sha256=QX1jGCdKvUMFsr6xBZYwS78a0qd0eQI8ynJhIfLIJ5w,5616
7
7
  mapillary_downloader/logging_config.py,sha256=WgjXthS2Lpl0RPO5sb-Aj60W2maog1bbzJzhblMLs1c,1715
8
8
  mapillary_downloader/tar_sequences.py,sha256=X5Vru0vp4pm_unmFjdEIZ7SBIk0gwi49NwOLPhUKeYk,3809
9
9
  mapillary_downloader/utils.py,sha256=yzVgS1mwsklDAqrimaFafgTTXtRYQUbKP98Xgh9d2KA,1174
10
10
  mapillary_downloader/webp_converter.py,sha256=vYLLQxDmdnqRz0nm7wXwRUd4x9mQZNah-DrncpA8sNs,1901
11
- mapillary_downloader/worker.py,sha256=2_U4EaCWjq9WxtsvOYiu41KsTWTHxKb1m43-Qa-HC9M,3577
12
- mapillary_downloader-0.3.0.dist-info/entry_points.txt,sha256=PdYtxOXHMJrUhmiPO4G-F98VuhUI4MN9D_T4KPrVZ5w,75
13
- mapillary_downloader-0.3.0.dist-info/licenses/LICENSE.md,sha256=7_BIuQ-veOrsF-WarH8kTkm0-xrCLvJ1PFE1C4Ebs64,146
14
- mapillary_downloader-0.3.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
15
- mapillary_downloader-0.3.0.dist-info/METADATA,sha256=c6naco_sXoVlWkHwhrFTm2s5Gi4mt4l4JDQKkJXxCTg,4607
16
- mapillary_downloader-0.3.0.dist-info/RECORD,,
11
+ mapillary_downloader/worker.py,sha256=kH9X_KdssM01UlfglNfsdogYnNrYOhd136eQJiEhLaw,3434
12
+ mapillary_downloader-0.3.1.dist-info/entry_points.txt,sha256=PdYtxOXHMJrUhmiPO4G-F98VuhUI4MN9D_T4KPrVZ5w,75
13
+ mapillary_downloader-0.3.1.dist-info/licenses/LICENSE.md,sha256=7_BIuQ-veOrsF-WarH8kTkm0-xrCLvJ1PFE1C4Ebs64,146
14
+ mapillary_downloader-0.3.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
15
+ mapillary_downloader-0.3.1.dist-info/METADATA,sha256=pBf6R7bqD9090YYzI2x5aQ-INcJUFhCbqV4avbzqOWM,4607
16
+ mapillary_downloader-0.3.1.dist-info/RECORD,,