diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-05-08 08:33:45 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-05-08 08:33:45 +0000 |
commit | 083dc3c76ab7dbc7b2b04f3396d4f5280b002906 (patch) | |
tree | 2cc1ea2ab9cf9cb59655fae23a661868adfce871 /modules/shared.py | |
parent | 855f83f92c7f951683d3c664c58f4b37017b8d32 (diff) | |
download | stable-diffusion-webui-gfx803-083dc3c76ab7dbc7b2b04f3396d4f5280b002906.tar.gz stable-diffusion-webui-gfx803-083dc3c76ab7dbc7b2b04f3396d4f5280b002906.tar.bz2 stable-diffusion-webui-gfx803-083dc3c76ab7dbc7b2b04f3396d4f5280b002906.zip |
directory hiding for extra networks: dirs starting with . will hide their cards on extra network tabs unless specifically searched for
create HTML for extra network pages only on demand
allow directories starting with . to still list their models for lora, checkpoints, etc
keep "search" filter for extra networks when user refreshes the page
Diffstat (limited to 'modules/shared.py')
-rw-r--r-- | modules/shared.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/shared.py b/modules/shared.py index 91aac1a3..dd374713 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -726,3 +726,20 @@ def html(filename): return file.read()
return ""
+
+
+def walk_files(path, allowed_extensions=None):
+ if not os.path.exists(path):
+ return
+
+ if allowed_extensions is not None:
+ allowed_extensions = set(allowed_extensions)
+
+ for root, dirs, files in os.walk(path):
+ for filename in files:
+ if allowed_extensions is not None:
+ _, ext = os.path.splitext(filename)
+ if ext not in allowed_extensions:
+ continue
+
+ yield os.path.join(root, filename)
|