Merge pull request #9 from zxve/main

add savevideo
This commit is contained in:
jacklukai
2025-08-08 17:32:25 +08:00
committed by GitHub
4 changed files with 60 additions and 64 deletions
+23 -28
View File
@@ -1,31 +1,26 @@
import json
import re
import time
import aiohttp
import server
from aiohttp import web
from collections import deque
from .install import *
import os
import uuid
import hashlib
import json
import os
import platform
import re
import stat
import urllib.request
import numpy as np
from .wss import thread_run, update_worker_flow
from .public import (
get_port_from_cmdline,
set_token,
get_token,
get_version,
find_project_root,
args,
get_client_id,
)
import threading
import folder_paths
from PIL import Image
import time
import urllib.request
import uuid
from collections import deque
import aiohttp
import folder_paths # type: ignore
import numpy as np # type: ignore
import server # type: ignore
from aiohttp import web
from PIL import Image # type: ignore
from .install import *
from .public import (args, find_project_root, get_client_id,
get_port_from_cmdline, get_token, get_version, set_token)
from .wss import thread_run, update_worker_flow
input_directory = (
args.input_directory if args.input_directory else find_project_root() + "input"
@@ -167,7 +162,7 @@ async def tech_zhulu(request):
content_type="application/octet-stream",
)
except Exception as e:
return web.Response(status=200, text=e)
return web.Response(status=200, text=str(e))
async with session.post(upload_url, data=form_data) as response:
try:
response_result = await response.text()
@@ -252,7 +247,7 @@ class DeployCash:
pass
@classmethod
def INPUT_TYPES(s):
def INPUT_TYPES(cls):
return {
"required": {
"app_title": (
@@ -371,7 +366,7 @@ class DeployCash_textInput:
pass
@classmethod
def INPUT_TYPES(s):
def INPUT_TYPES(cls):
return {
"required": {
"text": (
@@ -398,7 +393,7 @@ class DeployCash_saveImage:
self.compress_level = 4
@classmethod
def INPUT_TYPES(s):
def INPUT_TYPES(cls):
return {
"required": {
"images": ("IMAGE",),
+4 -3
View File
@@ -1,11 +1,12 @@
import hashlib
import os
import json
import os
import re
import sys
import uuid
from io import StringIO
import re
from comfy.cli_args import parser
from comfy.cli_args import parser # type: ignore
args = parser.parse_args()
if args and args.listen:
+2 -2
View File
@@ -182,7 +182,7 @@ function getMsgByEnglish(en_str){
const msgDict = {
'Please wait...': '请稍后...',
'There can only be one "DeployCash" node in a workflow': '工作流中只能有一个"DeployCash"节点',
'Please make sure that there is only one "SaveImgae", "DeployCash_saveImage" or "VHS_VideoCombine" node in the workflow.': '请确保工作流中只有一个"SaveImgae"、"DeployCash_saveImage"或"VHS_VideoCombine"节点。',
'Please make sure that there is only one "SaveImgae", "DeployCash_saveImage" or "VHS_VideoCombine" node in the workflow.': '请确保工作流中只有一个"SaveImgae"、"DeployCash_saveImage"、"VHS_VideoCombine"或"SaveVideo"节点。',
'Instructions for use of works': '作品使用说明',
'"app_img1" can only connect "LoadImage" node': '"app_img1" 只能连接 "LoadImage" 节点',
'"app_img2" can only connect "LoadImage" node': '"app_img2" 只能连接 "LoadImage" 节点',
@@ -265,7 +265,7 @@ function getPostData(prompt) {
console.log(output[key].class_type)
console.log(output[key].class_type)
console.log(output[key].class_type)
if (output[key].class_type == 'SaveImage' || output[key].class_type == 'VHS_VideoCombine' || output[key].class_type == 'DeployCash_saveImage' || output[key].class_type == 'SaveGLB' || output[key].class_type == 'SaveAnimatedWEBP') {
if (output[key].class_type == 'SaveImage' || output[key].class_type == 'VHS_VideoCombine' || output[key].class_type == 'DeployCash_saveImage' || output[key].class_type == 'SaveGLB' || output[key].class_type == 'SaveAnimatedWEBP' || output[key].class_type == 'SaveVideo') {
output[key].res_node = key;
saveImageNodes.push(output[key]);
}
+31 -31
View File
@@ -1,31 +1,25 @@
import asyncio
import collections
import hashlib
import json
import os
import queue
import random
import threading
import time
import traceback
import urllib
import aiohttp
import urllib.request
import urllib.parse
import collections
import urllib.request
from concurrent.futures import ThreadPoolExecutor
from threading import Lock, Condition
from threading import Condition, Lock
import aiohttp
import websockets
import threading
from .public import (
get_output,
write_json_to_file,
get_address,
get_port,
get_port_from_cmdline,
args,
find_project_root,
get_workflow,
get_client_id,
)
from .public import (args, find_project_root, get_address, get_client_id,
get_output, get_port, get_port_from_cmdline, get_workflow,
write_json_to_file)
os.environ["http_proxy"] = ""
os.environ["https_proxy"] = ""
@@ -50,8 +44,10 @@ websocket_conn3 = None
history_data = {"queue_running": [], "queue_pending": []}
history_prompt_ids = []
WEBSOCKETS_VERSION = tuple(map(int, websockets.__version__.split('.')))
import importlib.metadata
WEBSOCKETS_VERSION = tuple(map(int, importlib.metadata.version("websockets").split('.')))
# WEBSOCKETS_VERSION = tuple(map(int, websockets.__version__.split('.')))
def is_websocket_connected(websocket_conn):
if websocket_conn is None:
@@ -68,7 +64,8 @@ class MonitoredThreadPoolExecutor(ThreadPoolExecutor):
self._lock = Lock()
self._condition = Condition(self._lock)
self._active_tasks = 0
self._max_workers = max_workers
if max_workers:
self._max_workers = max_workers
def submit(self, fn, *args, **kwargs):
with self._lock:
@@ -631,14 +628,16 @@ async def run_websocket_task_in_loop():
if is_websocket_connected(websocket_conn3) and is_websocket_connected(websocket_conn1):
websocket_info["data"]["zhu_client_id"] = new_client_w_id
if websocket_info["conn_identifier"] == 1:
await websocket_conn3.send(
json.dumps(websocket_info["data"])
)
if websocket_conn3 is not None:
await websocket_conn3.send(
json.dumps(websocket_info["data"])
)
else:
loop_num = loop_num + 1
if loop_num > 1000:
loop_num = 0
await websocket_conn3.send(json.dumps({
if websocket_conn3 and is_websocket_connected(websocket_conn3):
await websocket_conn3.send(json.dumps({
'time': get_time(),
'type': 'crystools.line',
'data': {
@@ -958,16 +957,17 @@ async def websocket_connect_fu(uri, conn_identifier):
async with websockets.connect(uri) as websocket:
print(f"websocket_connect_fu {conn_identifier} 连接成功")
websocket_conn3 = websocket
await websocket_conn3.send(
json.dumps(
{
"type": "crystools.bind",
"data": {
"client_id": new_client_w_id + "_fu",
},
}
if websocket_conn3 and is_websocket_connected(websocket_conn3):
await websocket_conn3.send(
json.dumps(
{
"type": "crystools.bind",
"data": {
"client_id": new_client_w_id + "_fu",
},
}
)
)
)
reconnect_delay = RECONNECT_DELAY
tasks = [
asyncio.create_task(run_websocket_task_in_loop()),