UPPER_DIR, is_parent=True)
self.gallery.dir_entries += [parent_dir]
to_set_metadata_on = []
- for fn in list(listdir(dir_path)):
+ dir_entries = list(listdir(dir_path))
+ dirs_to_enter = []
+ for i, fn in enumerate(dir_entries):
+ msg = f'loading {dir_path}: entry {i+1}/{len(dir_entries)}'
+ print(msg, end='\r')
full_path = path_join(dir_path, fn)
if isdir(full_path):
if self.gallery.show_dirs:
self.gallery.dir_entries += [DirItem(dir_path, fn)]
- if self.recurse_dirs:
- read_directory_into_gallery_items(full_path)
+ dirs_to_enter += [full_path]
continue
_, ext = splitext(fn)
if ext not in {'.png', '.PNG'}:
if '' == item.model:
to_set_metadata_on += [item]
self.gallery.dir_entries += [item]
- for item in to_set_metadata_on:
- item.set_metadata(cache)
+ print('')
+ if len(to_set_metadata_on):
+ for i, item in enumerate(to_set_metadata_on):
+ msg = f'setting metadata: {i+1}/{len(to_set_metadata_on)}'
+ print(msg, end='\r')
+ item.set_metadata(cache)
+ print('')
+ else:
+ print('no metadata to set')
+ if dirs_to_enter and self.recurse_dirs:
+ prefix = f'entering directories below {dir_path}: directory '
+ for i, path in enumerate(dirs_to_enter):
+ print(f'{prefix}{i+1}/{len(dirs_to_enter)}')
+ read_directory_into_gallery_items(path)
old_selection = self.gallery.selected_item
self.gallery.dir_entries = []