camera-client 0.2.6__tar.gz → 0.2.7__tar.gz
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.
- {camera_client-0.2.6/camera_client.egg-info → camera_client-0.2.7}/PKG-INFO +1 -1
- {camera_client-0.2.6 → camera_client-0.2.7}/camera_client/__main__.py +42 -11
- {camera_client-0.2.6 → camera_client-0.2.7/camera_client.egg-info}/PKG-INFO +1 -1
- {camera_client-0.2.6 → camera_client-0.2.7}/pyproject.toml +1 -1
- {camera_client-0.2.6 → camera_client-0.2.7}/LICENSE +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/MANIFEST.in +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/README.md +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/camera_client/__init__.py +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/camera_client/client.py +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/camera_client/loading.py +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/camera_client/script.py +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/camera_client.egg-info/SOURCES.txt +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/camera_client.egg-info/dependency_links.txt +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/camera_client.egg-info/entry_points.txt +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/camera_client.egg-info/requires.txt +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/camera_client.egg-info/top_level.txt +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/requirements.txt +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/setup.cfg +0 -0
- {camera_client-0.2.6 → camera_client-0.2.7}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: camera-client
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Python SDK for camera calibration and projection transformations - handle lens distortion, coordinate transformations, and 3D ray casting with symbolic expressions.
|
|
5
5
|
Author-email: Alexander Abramov <extremal.ru@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Command-line interface for camera-client package."""
|
|
2
2
|
|
|
3
3
|
import argparse
|
|
4
|
+
import json
|
|
4
5
|
import os
|
|
5
6
|
import sys
|
|
6
7
|
from pathlib import Path
|
|
@@ -84,24 +85,45 @@ def download_archive(url: str, output_dir: str = ".", silent: bool = False) -> b
|
|
|
84
85
|
return False
|
|
85
86
|
|
|
86
87
|
|
|
87
|
-
def download_from_file(file_path: str, output_dir: str = ".") -> None:
|
|
88
|
+
def download_from_file(file_path: str, output_dir: str = ".", camera_id: int = None) -> None:
|
|
88
89
|
"""
|
|
89
|
-
Download
|
|
90
|
+
Download camera calibration archives from a .txt file with URLs or a .json config.
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
For .txt files: one URL per line, non-URL lines are ignored.
|
|
93
|
+
For .json files: expects a list of objects with "archive_url" key.
|
|
94
|
+
Optionally filter by camera_id.
|
|
92
95
|
|
|
93
96
|
Args:
|
|
94
|
-
file_path: Path to
|
|
97
|
+
file_path: Path to .txt or .json file
|
|
95
98
|
output_dir: Directory to save the downloaded files (default: current directory)
|
|
99
|
+
camera_id: If provided, only download archives for this camera_id (JSON only)
|
|
96
100
|
"""
|
|
97
101
|
try:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
if file_path.endswith('.json'):
|
|
103
|
+
with open(file_path, 'r') as f:
|
|
104
|
+
configs = json.load(f)
|
|
101
105
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
if not isinstance(configs, list):
|
|
107
|
+
configs = [configs]
|
|
108
|
+
|
|
109
|
+
if camera_id is not None:
|
|
110
|
+
configs = [c for c in configs if c.get('camera_id') == camera_id]
|
|
111
|
+
|
|
112
|
+
urls = [c['archive_url'] for c in configs if 'archive_url' in c]
|
|
113
|
+
|
|
114
|
+
if not urls:
|
|
115
|
+
msg = f"No matching entries found in {file_path}"
|
|
116
|
+
if camera_id is not None:
|
|
117
|
+
msg += f" for camera_id={camera_id}"
|
|
118
|
+
print(msg, file=sys.stderr)
|
|
119
|
+
sys.exit(1)
|
|
120
|
+
else:
|
|
121
|
+
with open(file_path, 'r') as f:
|
|
122
|
+
urls = [line.strip() for line in f if is_url(line)]
|
|
123
|
+
|
|
124
|
+
if not urls:
|
|
125
|
+
print(f"No URLs found in {file_path}", file=sys.stderr)
|
|
126
|
+
sys.exit(1)
|
|
105
127
|
|
|
106
128
|
print(f"Found {len(urls)} URL(s) in {file_path}")
|
|
107
129
|
print(f"Downloading to: {output_dir}\n")
|
|
@@ -127,6 +149,9 @@ def download_from_file(file_path: str, output_dir: str = ".") -> None:
|
|
|
127
149
|
except FileNotFoundError:
|
|
128
150
|
print(f"Error: File not found: {file_path}", file=sys.stderr)
|
|
129
151
|
sys.exit(1)
|
|
152
|
+
except (json.JSONDecodeError, KeyError) as e:
|
|
153
|
+
print(f"Error parsing JSON file {file_path}: {e}", file=sys.stderr)
|
|
154
|
+
sys.exit(1)
|
|
130
155
|
except Exception as e:
|
|
131
156
|
print(f"Error reading file {file_path}: {e}", file=sys.stderr)
|
|
132
157
|
sys.exit(1)
|
|
@@ -160,6 +185,12 @@ def main():
|
|
|
160
185
|
default='.',
|
|
161
186
|
help='Output directory (default: current directory)'
|
|
162
187
|
)
|
|
188
|
+
download_parser.add_argument(
|
|
189
|
+
'--camera_id',
|
|
190
|
+
type=int,
|
|
191
|
+
default=None,
|
|
192
|
+
help='Filter by camera_id (only used with JSON config files)'
|
|
193
|
+
)
|
|
163
194
|
|
|
164
195
|
args = parser.parse_args()
|
|
165
196
|
|
|
@@ -175,7 +206,7 @@ def main():
|
|
|
175
206
|
|
|
176
207
|
# Process based on input type
|
|
177
208
|
if args.file:
|
|
178
|
-
download_from_file(args.file, args.output_dir)
|
|
209
|
+
download_from_file(args.file, args.output_dir, camera_id=args.camera_id)
|
|
179
210
|
else:
|
|
180
211
|
success = download_archive(args.url, args.output_dir)
|
|
181
212
|
sys.exit(0 if success else 1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: camera-client
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Python SDK for camera calibration and projection transformations - handle lens distortion, coordinate transformations, and 3D ray casting with symbolic expressions.
|
|
5
5
|
Author-email: Alexander Abramov <extremal.ru@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "camera-client"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.7"
|
|
8
8
|
description = "Python SDK for camera calibration and projection transformations - handle lens distortion, coordinate transformations, and 3D ray casting with symbolic expressions."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.7"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|