tripleS-Dev commited on
Commit
c785888
1 Parent(s): 6ea9422
Files changed (1) hide show
  1. search.py +6 -10
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
- search_words = search_word_lower.split()
28
-
29
- for file in os.listdir(file_path):
30
- metadata = read_metadata(file_path)
31
- for key, value in metadata.items():
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)