Skip to content

Commit

Permalink
render video urls
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoestq committed Oct 29, 2024
1 parent b0906ba commit 5a01552
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libs/libcommon/src/libcommon/url_preparator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from dataclasses import dataclass
from typing import Any, Callable, Literal, Optional, Union

from datasets import Audio, Features, Image
from datasets import Audio, Features, Image, Video
from datasets.features.features import FeatureType, Sequence

from libcommon.cloudfront import CloudFrontSigner
Expand All @@ -23,7 +23,7 @@ class InvalidFirstRowsError(ValueError):

@dataclass
class AssetUrlPath:
feature_type: Literal["Audio", "Image"]
feature_type: Literal["Audio", "Image", "Video"]
path: VisitPath

def enter(self) -> "AssetUrlPath":
Expand Down Expand Up @@ -70,7 +70,10 @@ def classify(feature: FeatureType, visit_path: VisitPath) -> None:
if isinstance(feature, Image):
asset_url_paths.append(AssetUrlPath(feature_type="Image", path=visit_path))
elif isinstance(feature, Audio):
# for audio we give a list in case there are multiple formats available
asset_url_paths.append(AssetUrlPath(feature_type="Audio", path=visit_path + [0]))
elif isinstance(feature, Video):
asset_url_paths.append(AssetUrlPath(feature_type="Video", path=visit_path))

_visit(feature, classify, [column])
return asset_url_paths
Expand Down

0 comments on commit 5a01552

Please sign in to comment.