Skip to content

Commit

Permalink
Expose "raw":"1" from the API in MediaList (#586)
Browse files Browse the repository at this point in the history
* Expose raw flag on media list, so a separate metadata request is not required.
* Add test for raw flag from media list.
  • Loading branch information
autopulated authored Sep 10, 2024
1 parent b0a0bfc commit 736235c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"ls": "-1",
"s": "25086075",
},
{"n": "GOPR0039.JPG", "cre": "1724339068", "mod": "1724339068", "raw": "1", "s": "783927"},
],
}
],
Expand All @@ -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 = {
Expand Down

0 comments on commit 736235c

Please sign in to comment.