This commit is contained in:
nick 2024-04-30 12:55:04 -07:00
parent c7841deea2
commit a5a73e4209

View File

@ -1,4 +1,4 @@
# credit goes to VHS
# credit goes to https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite and is meant to work with
import os
import itertools
import numpy as np
@ -454,8 +454,7 @@ class ComfyUIDeployExternalVideo:
leave=True
):
out_file.write(chunk)
print("Video downloaded to: ", video_path)
print("video path: ", video_path)
return load_video_cv(video=video_path, force_rate=force_rate, force_size=force_size,
@ -468,63 +467,5 @@ class ComfyUIDeployExternalVideo:
image_path = folder_paths.get_annotated_filepath(video)
return calculate_file_hash(image_path)
# class ComfyUIDeployExternalVideo:
# @classmethod
# def INPUT_TYPES(s):
# files = input_video_files()
# return {
# "required": {
# "input_id": (
# "STRING",
# {"multiline": False, "default": "input_video"},
# ),
# },
# "optional": {
# "default_value": (sorted(files),),
# }
# }
# RETURN_TYPES = (sorted(input_video_files()),)
# RETURN_NAMES = ("video_path",)
# FUNCTION = "run"
# CATEGORY = "deploy"
# def run(self, input_id, default_value=None):
# print("starting here?")
# input_dir = folder_paths.get_input_directory()
# if input_id.startswith('http'):
# import requests
# print("Fetching video from URL: ", input_id)
# response = requests.get(input_id, stream=True)
# file_size = int(response.headers.get('Content-Length', 0))
# file_extension = input_id.split('.')[-1].split('?')[0] # Extract extension and handle URLs with parameters
# if file_extension not in video_extensions:
# file_extension = ".mp4"
# unique_filename = str(uuid.uuid4()) + "." + file_extension
# video_path = os.path.join(input_dir, unique_filename)
# chunk_size = 1024 # 1 Kibibyte
# num_bars = int(file_size / chunk_size)
# with open(video_path, 'wb') as out_file:
# for chunk in tqdm(
# response.iter_content(chunk_size=chunk_size),
# total=num_bars,
# unit='KB',
# desc="Downloading",
# leave=True
# ):
# out_file.write(chunk)
# print("returning unique_filename: ", unique_filename)
# return (unique_filename,)
# print("returning default_value: ", default_value)
# return (default_value,)
NODE_CLASS_MAPPINGS = {"ComfyUIDeployExternalVideo": ComfyUIDeployExternalVideo}
NODE_DISPLAY_NAME_MAPPINGS = {"ComfyUIDeployExternalVideo": "External Video (ComfyUI Deploy)"}