Skip to content

Commit

Permalink
fix(LAB-2828): use proper json_metadata and expect float instead of i…
Browse files Browse the repository at this point in the history
…nt for delayDueToMinPts
  • Loading branch information
BlueGrizzliBear committed Jul 30, 2024
1 parent 804d08a commit a281055
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/kili/services/asset_import/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from concurrent.futures import ThreadPoolExecutor
from enum import Enum
from itertools import repeat
from json import JSONDecodeError, loads
from json import JSONDecodeError
from typing import List

from kili.core.helpers import get_mime_type, is_url
Expand Down Expand Up @@ -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)
)
Expand All @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit a281055

Please sign in to comment.