diff --git a/mapillary_tools/geotag/factory.py b/mapillary_tools/geotag/factory.py index 0a226b03..44647c10 100644 --- a/mapillary_tools/geotag/factory.py +++ b/mapillary_tools/geotag/factory.py @@ -121,6 +121,7 @@ def _is_reprocessable(metadata: types.MetadataOrError) -> bool: exceptions.MapillaryGeoTaggingError, exceptions.MapillaryVideoGPSNotFoundError, exceptions.MapillaryExiftoolNotFoundError, + exceptions.MapillaryExifToolXMLNotFoundError, ), ): return True diff --git a/mapillary_tools/geotag/utils.py b/mapillary_tools/geotag/utils.py index 8c855914..4dde140f 100644 --- a/mapillary_tools/geotag/utils.py +++ b/mapillary_tools/geotag/utils.py @@ -45,7 +45,7 @@ def index_rdf_description_by_path( for xml_path in utils.find_xml_files(xml_paths): try: etree = ET.parse(xml_path) - except ET.ParseError as ex: + except Exception as ex: verbose = LOG.isEnabledFor(logging.DEBUG) if verbose: LOG.warning("Failed to parse %s", xml_path, exc_info=True) diff --git a/tests/integration/test_process.py b/tests/integration/test_process.py index 8bc6e99a..d0fb4904 100644 --- a/tests/integration/test_process.py +++ b/tests/integration/test_process.py @@ -814,3 +814,51 @@ def test_process_geotag_with_exiftool_xml_pattern(setup_data: py.path.local): ) assert_descs_exact_equal(exiftool_descs, native_descs) + + +def test_process_geotag_with_exiftool_xml_pattern_missing_file( + setup_data: py.path.local, +): + video_path = setup_data.join("videos").join("sample-5s.mp4") + descs = run_process_for_descs( + [ + *[ + "--geotag_source", + json.dumps( + { + "source": "exiftool_xml", + "pattern": str(setup_data.join("gpx").join("%g.xml")), + } + ), + ], + str(video_path), + ] + ) + + assert len(descs) == 1 + assert descs[0]["error"]["type"] == "MapillaryExifToolXMLNotFoundError" + + +def test_process_geotag_with_exiftool_xml_pattern_fallback( + setup_data: py.path.local, +): + video_path = setup_data.join("videos").join("sample-5s.mp4") + descs = run_process_for_descs( + [ + *[ + "--geotag_source", + json.dumps( + { + "source": "exiftool_xml", + "pattern": str(setup_data.join("gpx").join("%g.xml")), + } + ), + ], + *["--geotag_source", "gpx"], + *["--geotag_source", "native"], + str(video_path), + ] + ) + + assert len(descs) == 1 + assert descs[0]["error"]["type"] == "MapillaryVideoGPSNotFoundError"