Skip to content

Commit

Permalink
[main][592391](UserStory) [SDK] Update Python SDK and editorial tests…
Browse files Browse the repository at this point in the history
… to work with the new shots API (#101)

* update linter and dev dependencies

* update models to handle shots

* add shot helper methods

* [main][592391](UserStory) bump sdk version

* [main][592391](UserStory) add constructor methods for shots
  • Loading branch information
arvidfm authored Jan 16, 2025
1 parent a9df1d0 commit 1bc8eba
Show file tree
Hide file tree
Showing 11 changed files with 579 additions and 235 deletions.
2 changes: 1 addition & 1 deletion flixpy/examples/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ ignore = [
"T201", # allow print()
"ERA001", # allow commented-out code
"PLR2004", # allow magic values in comparisons
"ASYNC101", # allow blocking calls in async functions for demonstration purposes
"ASYNC230", # allow blocking calls in async functions for demonstration purposes
]
5 changes: 2 additions & 3 deletions flixpy/flix/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ async def _handler(event: webhooks.WebhookEvent) -> None:
await site.start()

click.echo(f"Listening for events on {address}:{port} (press CTRL+C to abort)...", err=True)
while True:
await asyncio.sleep(3600)
await asyncio.Event().wait()


@flix_cli.group(help="Manage contact sheet templates.")
Expand Down Expand Up @@ -344,7 +343,7 @@ async def contactsheet_edit_loop(
pdf_response = await flix_client.request(
"GET", "/contactsheet/preview", params={"data": b64, "format": "pdf"}
)
with pathlib.Path(preview_file).open("wb") as f: # noqa: ASYNC101
with pathlib.Path(preview_file).open("wb") as f: # noqa: ASYNC230
f.write(await pdf_response.read())
elif action == "save":
return data
Expand Down
36 changes: 18 additions & 18 deletions flixpy/flix/extension/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,32 @@
)

__all__ = [
"SourceFile",
"SourceFileType",
"SourceFilePreviewMode",
"ProjectDetails",
"Event",
"ClientEvent",
"OpenEvent",
"ClientPingEvent",
"ActionEvent",
"ConnectionEvent",
"OpenPanelData",
"ProjectEvent",
"ProjectIds",
"ClientEventType",
"ActionState",
"ActionType",
"ActionsInProgress",
"AssetType",
"VersionEvent",
"OpenSourceFileEvent",
"ClientEvent",
"ClientEventType",
"ClientPingEvent",
"ConnectionEvent",
"DownloadResponse",
"ActionsInProgress",
"Event",
"OpenEvent",
"OpenPanelData",
"OpenSourceFileEvent",
"PanelBrowserStatus",
"StatusEvent",
"PanelRequestResponse",
"ProjectDetails",
"ProjectEvent",
"ProjectIds",
"RevisionStatus",
"SourceFile",
"SourceFilePreviewMode",
"SourceFileType",
"Status",
"PanelRequestResponse",
"StatusEvent",
"VersionEvent",
]


Expand Down
2 changes: 1 addition & 1 deletion flixpy/flix/lib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
if TYPE_CHECKING:
from types import TracebackType

__all__ = ["Client", "AccessKey"]
__all__ = ["AccessKey", "Client"]

logger = logging.getLogger(__name__)

Expand Down
12 changes: 6 additions & 6 deletions flixpy/flix/lib/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
import asyncclick as click

__all__ = [
"Form",
"Field",
"StringField",
"IntField",
"FloatField",
"BoolField",
"Choice",
"EnumField",
"Field",
"FloatField",
"Form",
"IntField",
"MultichoiceField",
"Choice",
"StringField",
"prompt_enum",
]

Expand Down
26 changes: 21 additions & 5 deletions flixpy/flix/lib/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import Any, TypedDict

from typing_extensions import NotRequired
from typing_extensions import NotRequired, Required


class MetadataField(TypedDict, total=False):
Expand Down Expand Up @@ -117,7 +117,7 @@ class SequenceRevision(TypedDict, total=False):
owner: User
created_date: str
metadata: list[MetadataField]
revisioned_panels: list[SequencePanel]
related_shots: list[SequenceRevisionShot]
comment: str
published: bool
imported: bool
Expand All @@ -126,7 +126,6 @@ class SequenceRevision(TypedDict, total=False):
autosave: bool
sequence_id: int
show_id: int
episode_id: int
task_id: str
source_files: list[Asset]

Expand Down Expand Up @@ -247,15 +246,32 @@ class PanelRevision(TypedDict, total=False):
panel: Panel


class SequencePanel(PanelRevision):
sequence_revision: NotRequired[int]
class ShotPanelRevision(TypedDict, total=False):
panel_revision: PanelRevision
duration: int
trim_in_frame: int
trim_out_frame: int
hidden: bool
dialogue: NotRequired[Dialogue]


class Shot(TypedDict, total=False):
id: int
show_id: int
sequence_id: int
owner: User
created_date: str
transitive: bool
related_panel_revisions: list[ShotPanelRevision]
metadata: list[MetadataField]


class SequenceRevisionShot(TypedDict, total=False):
sequence_revision: int
shot: Required[Shot]
name: str


class PageSize(TypedDict):
width: int
height: int
Expand Down
Loading

0 comments on commit 1bc8eba

Please sign in to comment.