Skip to content

Commit 1d7df1e

Browse files
authored
chore: add all GoPro related to gpmf module (#724)
* move gpmf files to mapillary_tools/gpmf * updates * fix utcfromtimestamp * fix * remove unused functions * update constants * fix * add mapillary_tools/gpmf/__init__.py * update setup.py * update * update * format * upgrade types in geo.py * move get_max_distance_from_start as video_utils * move around * fix geo.py * types * add some AI-generated tests * update * Revert "add mapillary_tools/gpmf/__init__.py" This reverts commit ba821ac. * update
1 parent 973ec55 commit 1d7df1e

29 files changed

+700
-193
lines changed

mapillary_tools/commands/process.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
from ..process_sequence_properties import process_sequence_properties
1414

1515

16+
def bold_text(text: str) -> str:
17+
ANSI_BOLD = "\033[1m"
18+
ANSI_RESET_ALL = "\033[0m"
19+
return f"{ANSI_BOLD}{text}{ANSI_RESET_ALL}"
20+
21+
1622
class Command:
1723
name = "process"
1824
help = "process images and videos"
@@ -52,9 +58,7 @@ def add_basic_arguments(self, parser: argparse.ArgumentParser):
5258
default=",".join(sorted(t.value for t in FileType)),
5359
required=False,
5460
)
55-
group = parser.add_argument_group(
56-
f"{constants.ANSI_BOLD}PROCESS EXIF OPTIONS{constants.ANSI_RESET_ALL}"
57-
)
61+
group = parser.add_argument_group(bold_text("PROCESS EXIF OPTIONS"))
5862
group.add_argument(
5963
"--overwrite_all_EXIF_tags",
6064
help="Overwrite all of the relevant EXIF tags with the values obtained in process. It is equivalent to supplying all the --overwrite_EXIF_*_tag flags.",
@@ -92,7 +96,7 @@ def add_basic_arguments(self, parser: argparse.ArgumentParser):
9296
)
9397

9498
group_metadata = parser.add_argument_group(
95-
f"{constants.ANSI_BOLD}PROCESS METADATA OPTIONS{constants.ANSI_RESET_ALL}"
99+
bold_text("PROCESS METADATA OPTIONS")
96100
)
97101
group_metadata.add_argument(
98102
"--device_make",
@@ -108,7 +112,7 @@ def add_basic_arguments(self, parser: argparse.ArgumentParser):
108112
)
109113

110114
group_geotagging = parser.add_argument_group(
111-
f"{constants.ANSI_BOLD}PROCESS GEOTAGGING OPTIONS{constants.ANSI_RESET_ALL}"
115+
bold_text("PROCESS GEOTAGGING OPTIONS")
112116
)
113117
group_geotagging.add_argument(
114118
"--desc_path",
@@ -174,7 +178,7 @@ def add_basic_arguments(self, parser: argparse.ArgumentParser):
174178
)
175179

176180
group_sequence = parser.add_argument_group(
177-
f"{constants.ANSI_BOLD}PROCESS SEQUENCE OPTIONS{constants.ANSI_RESET_ALL}"
181+
bold_text("PROCESS SEQUENCE OPTIONS")
178182
)
179183
group_sequence.add_argument(
180184
"--cutoff_distance",

mapillary_tools/commands/sample_video.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44

55
from .. import constants
66
from ..sample_video import sample_video
7+
from .process import bold_text
78

89

910
class Command:
1011
name = "sample_video"
1112
help = "sample video into images"
1213

1314
def add_basic_arguments(self, parser: argparse.ArgumentParser):
14-
group = parser.add_argument_group(
15-
f"{constants.ANSI_BOLD}VIDEO PROCESS OPTIONS{constants.ANSI_RESET_ALL}"
16-
)
15+
group = parser.add_argument_group(bold_text("VIDEO PROCESS OPTIONS"))
1716
group.add_argument(
1817
"--video_sample_distance",
1918
help="The minimal distance interval, in meters, for sampling video frames. [default: %(default)s]",

mapillary_tools/commands/upload.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from .. import constants
44
from ..upload import upload
5+
from .process import bold_text
56

67

78
class Command:
@@ -30,9 +31,7 @@ def add_common_upload_options(group):
3031
)
3132

3233
def add_basic_arguments(self, parser):
33-
group = parser.add_argument_group(
34-
f"{constants.ANSI_BOLD}UPLOAD OPTIONS{constants.ANSI_RESET_ALL}"
35-
)
34+
group = parser.add_argument_group(bold_text("UPLOAD OPTIONS"))
3635
group.add_argument(
3736
"--desc_path",
3837
help=f'Path to the description file generated by the process command. The hyphen "-" indicates STDIN. [default: {{IMPORT_PATH}}/{constants.IMAGE_DESCRIPTION_FILENAME}]',

mapillary_tools/constants.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
_ENV_PREFIX = "MAPILLARY_TOOLS_"
77

8-
ANSI_BOLD = "\033[1m"
9-
ANSI_RESET_ALL = "\033[0m"
108
# In meters
119
CUTOFF_DISTANCE = float(os.getenv(_ENV_PREFIX + "CUTOFF_DISTANCE", 600))
1210
# In seconds

0 commit comments

Comments
 (0)