diff --git a/import_project.json b/import_project.json index 6498d62..2822dbf 100644 --- a/import_project.json +++ b/import_project.json @@ -210,6 +210,17 @@ "cardinality": "0-n" } ] + }, + { + "name": "VideoObject", + "labels": {"en": "Video object"}, + "super": "MovingImageRepresentation", + "cardinalities": [ + { + "propname": ":hasName", + "cardinality": "0-n" + } + ] } ] } diff --git a/import_script.py b/import_script.py index b7f7177..b8be007 100644 --- a/import_script.py +++ b/import_script.py @@ -173,6 +173,28 @@ def main() -> None: ) root.append(link) + + # Video with a Segment + # -------------------- + # Videos and audios are normal resources... + video = excel2xml.make_resource("Publicly available video", ":VideoObject", "video_1") + video.append(excel2xml.make_bitstream_prop("videos/my_video.mp4")) + root.append(video) + + # ... but the segments behave differently: + segment = excel2xml.make_video_segment("The first 5 seconds of my video", "segment_1") + segment.append(excel2xml.make_isSegmentOf_prop("video_1")) + segment.append(excel2xml.make_hasSegmentBounds_prop(segment_start=0, segment_end=5)) + segment.append(excel2xml.make_hasTitle_prop("Intro of my video")) + segment.append(excel2xml.make_hasComment_prop("Video segments can also have comments")) + segment.append(excel2xml.make_hasDescription_prop("This segments spans the first 5 seconds of my video")) + segment.append(excel2xml.make_hasKeyword_prop("publicly available video")) + segment.append(excel2xml.make_relatesTo_prop(object_labels_to_ids["Horohoroto"])) + root.append(segment) + + # audio segments are identical, just replace "video" by "audio" + + # write file # ---------- excel2xml.write_xml(root, "data-processed.xml") diff --git a/test/expected.xml b/test/expected.xml index 9964646..5bbcc67 100644 --- a/test/expected.xml +++ b/test/expected.xml @@ -202,4 +202,16 @@ Horohoroto_5652b411-2c50-4086-896c-23b208ea27a8 + + videos/my_video.mp4 + + + video_1 + + Intro of my video + Video segments can also have comments + This segments spans the first 5 seconds of my video + publicly available video + Horohoroto_42fd3508-f299-4981-9d85-65a48cab14d7 + diff --git a/videos/my_video.mp4 b/videos/my_video.mp4 new file mode 100644 index 0000000..74ccdad Binary files /dev/null and b/videos/my_video.mp4 differ