INNER CODE UNIT · Python

_iter_images_to_index

yurijmikhalevich/rclip · rclip/main.py:231

  def _iter_images_to_index(self, directory: str, pbar: tqdm) -> Iterator[Tuple[str, ImageMeta]]:
    """Walks the directory and yields (path, meta) for every image that needs (re)indexing, skipping
    the ones already up to date in the database. Advances the progress bar once per scanned file."""
    images_processed = 0
    for entry in fs.walk(directory, self._exclude_dir_regex, self._image_regex, self._skip_hidden):
      filepath = entry.path

      if self._enable_raw_support:
        file_ext = helpers.get_file_extension(filepath)
        if file_ext in IMAGE_RAW_EXT and self._does_processed_image_exist_for_raw(filepath):
          images_processed += 1
          pbar.update()
          continue

      try:
        meta = get_image_meta(entry)
      except Exception as ex:
        print(f"error getting fs metadata for {filepath}:", ex, file=sys.stderr)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…