Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flixpy/flix/lib/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ class Shot(TypedDict, total=False):
transitive: bool
related_panel_revisions: list[ShotPanelRevision]
metadata: list[MetadataField]
origin: str


class SequenceRevisionShot(TypedDict, total=False):
Expand Down
13 changes: 12 additions & 1 deletion flixpy/flix/lib/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,20 +940,26 @@ def new_panel(
)

def new_shot(
self, panels: list[ShotPanelRevision] | None = None, *, transitive: bool = True
self,
panels: list[ShotPanelRevision] | None = None,
*,
transitive: bool = True,
origin: str = "Manual Import",
) -> Shot:
"""Construct a new shot.

Args:
panels: The panel revisions to include in the shot, if any.
transitive: Whether the shot should be transitive (implicit).
origin: Origin of the shot, with a maximum of 25 characters.

Returns:
The new shot.
"""
return Shot(
panel_revisions=panels or [],
transitive=transitive,
origin=origin,
_client=self.client,
)

Expand Down Expand Up @@ -2335,6 +2341,7 @@ def __init__(
shot_id: int | None = None,
show_id: int | None = None,
sequence_id: int | None = None,
origin: str = "Manual Import",
_client: client.Client | None,
) -> None:
super().__init__(_client)
Expand All @@ -2348,6 +2355,7 @@ def __init__(
self.shot_id: int | None = shot_id
self.show_id: int | None = show_id
self.sequence_id: int | None = sequence_id
self.origin = origin

@classmethod
def from_dict(
Expand All @@ -2374,6 +2382,7 @@ def from_dict(
into.shot_id = data.get("id")
into.show_id = data.get("show_id")
into.sequence_id = data.get("sequence_id")
into.origin = data.get("origin", "")
into.metadata = Metadata.from_dict(data.get("metadata"), parent=into, _client=_client)
return into

Expand All @@ -2389,6 +2398,8 @@ def to_dict(self) -> models.Shot:
shot["show_id"] = self.show_id
if self.sequence_id:
shot["sequence_id"] = self.sequence_id
if self.origin:
shot["origin"] = self.origin
return shot

def path_prefix(self) -> str:
Expand Down