aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ui_extra_networks_user_metadata.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-13 13:46:32 +0000
committerGitHub <noreply@github.com>2023-08-13 13:46:32 +0000
commit1c6ca09992fc2c4f7a250670246762a184abace3 (patch)
tree4d61ec966a5924fd92b435c4750ee93720ed3539 /modules/ui_extra_networks_user_metadata.py
parentd73db17ee330ceb256defeab00a6097b943f923b (diff)
parent7fa5ee54b15904bef6598800df76ba1291d44ec6 (diff)
downloadstable-diffusion-webui-gfx803-1c6ca09992fc2c4f7a250670246762a184abace3.tar.gz
stable-diffusion-webui-gfx803-1c6ca09992fc2c4f7a250670246762a184abace3.tar.bz2
stable-diffusion-webui-gfx803-1c6ca09992fc2c4f7a250670246762a184abace3.zip
Merge pull request #12510 from catboxanon/feat/extnet/hashes
Support search and display of hashes for all extra network items
Diffstat (limited to 'modules/ui_extra_networks_user_metadata.py')
-rw-r--r--modules/ui_extra_networks_user_metadata.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/ui_extra_networks_user_metadata.py b/modules/ui_extra_networks_user_metadata.py
index cda471e4..b11622a1 100644
--- a/modules/ui_extra_networks_user_metadata.py
+++ b/modules/ui_extra_networks_user_metadata.py
@@ -93,11 +93,13 @@ class UserMetadataEditor:
item = self.page.items.get(name, {})
try:
filename = item["filename"]
+ shorthash = item.get("shorthash", None)
stats = os.stat(filename)
params = [
('Filename: ', os.path.basename(filename)),
('File size: ', sysinfo.pretty_bytes(stats.st_size)),
+ ('Hash: ', shorthash),
('Modified: ', datetime.datetime.fromtimestamp(stats.st_mtime).strftime('%Y-%m-%d %H:%M')),
]
@@ -115,7 +117,7 @@ class UserMetadataEditor:
errors.display(e, f"reading metadata info for {name}")
params = []
- table = '<table class="file-metadata">' + "".join(f"<tr><th>{name}</th><td>{value}</td></tr>" for name, value in params) + '</table>'
+ table = '<table class="file-metadata">' + "".join(f"<tr><th>{name}</th><td>{value}</td></tr>" for name, value in params if value is not None) + '</table>'
return html.escape(name), user_metadata.get('description', ''), table, self.get_card_html(name), user_metadata.get('notes', '')