-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnodes.py
55 lines (40 loc) · 1.54 KB
/
nodes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# ... (Notifier classes and NotificationManager remain the same) ...
from .notifier.notify import NotificationManager
class GeneralNotifier:
# ... (Other methods remain the same) ...
@classmethod
def INPUT_TYPES(cls):
manager = NotificationManager.get_instance()
notifier_info = manager.get_notifier_info()
input_types = {
"required": {
"file_path": ("STRING",{"default": ""}),
"message": ("STRING", {"default": ""}),
},
"optional": {}
}
for info in notifier_info:
notifier_name = info["name"]
input_types["optional"][notifier_name] = ("BOOLEAN", {"default": True})
return input_types
#TODO - 返回各个渠道的结果url
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("Result URL",)
FUNCTION = "try_notify"
OUTPUT_NODE = True
CATEGORY = "GentlemanHu_Notifier"
def try_notify(self, file_path, message, **kwargs):
enabled_notifiers = [name for name, enabled in kwargs.items() if enabled]
manager = NotificationManager.get_instance()
manager.notify_all(file_path, message, enabled_notifiers)
ret = True # Assuming success
print(f"Triggered notifications for: {file_path}")
#TODO - 返回各个渠道的结果url
return ("",)
# ... (Rest of the code remains the same) ...
NODE_CLASS_MAPPINGS = {
"GentlemanHu_Notifier": GeneralNotifier
}
NODE_DISPLAY_NAME_MAPPINGS = {
"GentlemanHu_Notifier": "GeneralNotifier"
}