From 736235c303aecc5cfc6dab658f2913bf2aac0324 Mon Sep 17 00:00:00 2001 From: James Crosby Date: Tue, 10 Sep 2024 19:15:53 +0100 Subject: [PATCH] Expose "raw":"1" from the API in MediaList (#586) * Expose raw flag on media list, so a separate metadata request is not required. * Add test for raw flag from media list. --- .../open_gopro/models/media_list.py | 1 + .../sdk_wireless_camera_control/tests/unit/test_models.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/demos/python/sdk_wireless_camera_control/open_gopro/models/media_list.py b/demos/python/sdk_wireless_camera_control/open_gopro/models/media_list.py index 04bd2f02..f6bbbe6e 100644 --- a/demos/python/sdk_wireless_camera_control/open_gopro/models/media_list.py +++ b/demos/python/sdk_wireless_camera_control/open_gopro/models/media_list.py @@ -119,6 +119,7 @@ class MediaItem(CustomBaseModel): low_res_video_size: Optional[str] = Field(alias="glrv", default=None) #: Low resolution video size lrv_file_size: Optional[str] = Field(alias="ls", default=None) #: Low resolution file size session_id: Optional[str] = Field(alias="id", default=None) # Media list session identifier + raw: Optional[str] = Field(default=None) #: 1 if photo has raw version, 0 (or omitted) otherwise class GroupedMediaItem(MediaItem): diff --git a/demos/python/sdk_wireless_camera_control/tests/unit/test_models.py b/demos/python/sdk_wireless_camera_control/tests/unit/test_models.py index 4dd2867d..fd0fb1b4 100644 --- a/demos/python/sdk_wireless_camera_control/tests/unit/test_models.py +++ b/demos/python/sdk_wireless_camera_control/tests/unit/test_models.py @@ -116,6 +116,7 @@ "ls": "-1", "s": "25086075", }, + {"n": "GOPR0039.JPG", "cre": "1724339068", "mod": "1724339068", "raw": "1", "s": "783927"}, ], } ], @@ -134,9 +135,10 @@ def test_media_list(): media_list = MediaList(**MEDIA_LIST) assert media_list items = media_list.files - assert len(items) == 12 + assert len(items) == 13 assert len([item for item in items if isinstance(item, GroupedMediaItem)]) == 2 assert media_list.files[0].filename == "100GOPRO/GX010001.MP4" + assert media_list.files[-1].raw == "1" VIDEO_METADATA: Final = {