Add several new nodes:
- DecodeTranscriptNode to parse transcript text - YoutubeUploadNode to upload videos to YouTube - Audio metadata and file list nodes - Image stack blending and stripping alpha channel - Sampler dataset creation node - Utils for deep copying tensors and arrays Also includes: - Testing for new utils module - Git nodes marked with base class - Renamed nodes.py to avoid conflicts - Import refactoring to handle naming Specifics: - descript.py: New transcript parsing node - youtube_nodes.py: New YouTube upload node - audio.py: New audio metadata and file list nodes - utils.py: Deep copy utility functions - image.py: New image stack blending and alpha stripping - tests/test_utils.py: Tests for new utils - git.py: Marked git nodes with base class - __init__.py: Refactored imports and mappings - requirements.txt: Added YouTube dependencies - functional.py: Minor tweaks - modules/youtube.py: Helper for upload node - video.py: Minor cleanup - tests/test_youtube_nodes.py: Test for YouTube upload
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import torch
|
||||
import numpy as np
|
||||
from custom_nodes.EternalKernelLiteGraphNodes.utils import etk_deep_copy
|
||||
|
||||
|
||||
def test_etk_deep_copy():
|
||||
original = {
|
||||
"list": [1, 2, 3, [4, 5, 6], {"inner_list": [7, 8, 9]}],
|
||||
"dict": {"inner_dict": {"key": "value"}}
|
||||
}
|
||||
torch_test = {"torch_tensor": torch.tensor([1, 2, 3])}
|
||||
np_test = {"np_array": np.array([1, 2, 3])}
|
||||
|
||||
test(original)
|
||||
test(torch_test)
|
||||
test(np_test)
|
||||
|
||||
|
||||
def test(original):
|
||||
# Creating a deep copy
|
||||
copy = etk_deep_copy(original)
|
||||
|
||||
# Modifying the original structure
|
||||
if "list" in original:
|
||||
original["list"][0] = 100
|
||||
if isinstance(original["list"][3], list):
|
||||
original["list"][3][0] = 200
|
||||
if "inner_list" in original["list"][4]:
|
||||
original["list"][4]["inner_list"][0] = 300
|
||||
|
||||
if "dict" in original and "inner_dict" in original["dict"]:
|
||||
original["dict"]["inner_dict"]["key"] = "modified"
|
||||
|
||||
if "torch_tensor" in original:
|
||||
original["torch_tensor"][0] = 100
|
||||
|
||||
if "np_array" in original:
|
||||
original["np_array"][0] = 200
|
||||
|
||||
# Returning both the original and the copy for inspection
|
||||
return original, copy
|
||||
@@ -0,0 +1,17 @@
|
||||
import os
|
||||
|
||||
os.environ["UNIT_TEST"] = "True"
|
||||
from custom_nodes.EternalKernelLiteGraphNodes.youtube_nodes import YoutubeUploadNode
|
||||
|
||||
|
||||
def test_upload():
|
||||
node = YoutubeUploadNode()
|
||||
output = node.upload_video(
|
||||
file_path=os.path.join("tests", "example.mp4"),
|
||||
category=22,
|
||||
title="Test Video",
|
||||
description="This is a test video for the Youtube Upload Node",
|
||||
keywords="test, youtube, node",
|
||||
privacy_status="unlisted"
|
||||
)
|
||||
print (output)
|
||||
Reference in New Issue
Block a user