tripleS-Dev
commited on
Commit
•
c785888
1
Parent(s):
6ea9422
start
Browse files
search.py
CHANGED
@@ -23,17 +23,13 @@ def search_in_metadata(folder_path, search_word):
|
|
23 |
|
24 |
for file in png_files:
|
25 |
file_path = os.path.join(folder_path, file)
|
|
|
26 |
search_word_lower = search_word.lower()
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
if isinstance(value, str):
|
33 |
-
value_lower = value.lower()
|
34 |
-
if all(word in value_lower for word in search_words):
|
35 |
-
matching_files.append(file)
|
36 |
-
break
|
37 |
if os.path.exists(sort_folder_path):
|
38 |
shutil.rmtree(sort_folder_path)
|
39 |
os.makedirs(sort_folder_path)
|
|
|
23 |
|
24 |
for file in png_files:
|
25 |
file_path = os.path.join(folder_path, file)
|
26 |
+
metadata = read_metadata(file_path)
|
27 |
search_word_lower = search_word.lower()
|
28 |
+
# Check if the search word is in any of the metadata values
|
29 |
+
for key, value in metadata.items():
|
30 |
+
if isinstance(value, str) and search_word_lower in value.lower():
|
31 |
+
matching_files.append(file)
|
32 |
+
break
|
|
|
|
|
|
|
|
|
|
|
33 |
if os.path.exists(sort_folder_path):
|
34 |
shutil.rmtree(sort_folder_path)
|
35 |
os.makedirs(sort_folder_path)
|