From 59060c044073636130da24df0ad38057d4d4a709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Bussi=C3=A8re?= Date: Tue, 30 Jul 2024 16:39:37 +0200 Subject: [PATCH] fix(LAB-2828): use proper json_metadata and expect float instead of int for delayDueToMinPts --- src/kili/services/asset_import/video.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/kili/services/asset_import/video.py b/src/kili/services/asset_import/video.py index d57415bf9..5579b5362 100644 --- a/src/kili/services/asset_import/video.py +++ b/src/kili/services/asset_import/video.py @@ -169,8 +169,14 @@ def are_native_videos(assets) -> bool: should_use_native_video_array = [] for asset in assets: # json_metadata stringification is done later on the call - json_metadata_ = asset.get("json_metadata", {}) - processing_parameters = json_metadata_.get("processingParameters", {}) + json_metadata_ = asset.get("json_metadata") + if not json_metadata_: + return False + + processing_parameters = json_metadata_.get("processingParameters") + if not processing_parameters: + return False + should_use_native_video_array.append( processing_parameters.get("shouldUseNativeVideo", True) ) @@ -190,11 +196,12 @@ def are_native_videos(assets) -> bool: def has_complete_processing_parameters(asset) -> bool: """Determine if assets should be imported asynchronously and cut into frames.""" try: - json_metadata = asset.get("jsonMetadata") + # json_metadata stringification is done later on the call + json_metadata = asset.get("json_metadata") if not json_metadata: return False - processing_parameters = loads(json_metadata).get("processingParameters") + processing_parameters = json_metadata.get("processingParameters") if not processing_parameters: return False @@ -205,7 +212,7 @@ def has_complete_processing_parameters(asset) -> bool: "numberOfFrames", "startTime", ] - required_types = [str, int, float, int, float] + required_types = [str, float, float, int, float] for key, required_type in zip(required_keys, required_types): value = processing_parameters.get(key)