Skip to content

Commit 7a88384

Browse files
authored
api-nodes: fixed dynamic pricing format; import comfy_io directly (#10336)
1 parent 8486706 commit 7a88384

19 files changed

+1331
-1322
lines changed

comfy_api/latest/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ class Types:
114114
ComfyAPISync: Type[comfy_api.latest.generated.ComfyAPISyncStub.ComfyAPISyncStub]
115115
ComfyAPISync = create_sync_class(ComfyAPI_latest)
116116

117-
comfy_io = io # create the new alias for io
117+
# create new aliases for io and ui
118+
IO = io
119+
UI = ui
118120

119121
__all__ = [
120122
"ComfyAPI",
@@ -124,6 +126,7 @@ class Types:
124126
"Types",
125127
"ComfyExtension",
126128
"io",
127-
"comfy_io",
129+
"IO",
128130
"ui",
131+
"UI",
129132
]

comfy_api_nodes/apinode_utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import io
44
import logging
55
import mimetypes
6+
import os
67
from typing import Optional, Union
78
from comfy.utils import common_upscale
89
from comfy_api.input_impl import VideoFromFile
@@ -702,3 +703,16 @@ def image_tensor_pair_to_batch(
702703
"center",
703704
).movedim(1, -1)
704705
return torch.cat((image1, image2), dim=0)
706+
707+
708+
def get_size(path_or_object: Union[str, io.BytesIO]) -> int:
709+
if isinstance(path_or_object, str):
710+
return os.path.getsize(path_or_object)
711+
return len(path_or_object.getvalue())
712+
713+
714+
def validate_container_format_is_mp4(video: VideoInput) -> None:
715+
"""Validates video container format is MP4."""
716+
container_format = video.get_container_format()
717+
if container_format not in ["mp4", "mov,mp4,m4a,3gp,3g2,mj2"]:
718+
raise ValueError(f"Only MP4 container format supported. Got: {container_format}")

comfy_api_nodes/apis/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ def _display_text_on_node(self, text: str):
845845
if not self.node_id:
846846
return
847847
if self.extracted_price is not None:
848-
text = f"Price: {self.extracted_price}$\n{text}"
848+
text = f"Price: ${self.extracted_price}\n{text}"
849849
PromptServer.instance.send_progress_text(text, self.node_id)
850850

851851
def _display_time_progress_on_node(self, time_completed: int | float):

0 commit comments

Comments
 (0)