aboutsummaryrefslogtreecommitdiff
path: root/modules/extra_networks.py
diff options
context:
space:
mode:
authorw-e-w <40751091+w-e-w@users.noreply.github.com>2023-08-08 11:39:34 +0900
committerGitHub <noreply@github.com>2023-08-08 11:39:34 +0900
commitf17c8c2eff63210f5e96e1e2b049b46ba9cfa389 (patch)
tree701056aec9ae11bc45df9b39b176a54fa4d34e19 /modules/extra_networks.py
parentc75bda867be5345bf959daf23bdc19eadc90841a (diff)
parent01997f45ba089af24b03a5f614147bb0f9d8d824 (diff)
Merge branch 'dev' into auro-autolaunch
Diffstat (limited to 'modules/extra_networks.py')
-rw-r--r--modules/extra_networks.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/extra_networks.py b/modules/extra_networks.py
index 6ae07e91..fa28ac75 100644
--- a/modules/extra_networks.py
+++ b/modules/extra_networks.py
@@ -1,3 +1,5 @@
+import json
+import os
import re
from collections import defaultdict
@@ -177,3 +179,20 @@ def parse_prompts(prompts):
return res, extra_data
+
+def get_user_metadata(filename):
+ if filename is None:
+ return {}
+
+ basename, ext = os.path.splitext(filename)
+ metadata_filename = basename + '.json'
+
+ metadata = {}
+ try:
+ if os.path.isfile(metadata_filename):
+ with open(metadata_filename, "r", encoding="utf8") as file:
+ metadata = json.load(file)
+ except Exception as e:
+ errors.display(e, f"reading extra network user metadata from {metadata_filename}")
+
+ return metadata