INNER CODE UNIT · Python
_does_processed_image_exist_for_raw
yurijmikhalevich/rclip · rclip/main.py:219
def _does_processed_image_exist_for_raw(self, raw_path: str) -> bool:
"""Check if there is a processed image alongside the raw one; doesn't support mixed-case extensions,
e.g. it won't detect the .JpG image, but will detect .jpg or .JPG"""
image_path = os.path.splitext(raw_path)[0]
for ext in IMAGE_EXT:
if os.path.isfile(image_path + "." + ext):
return True
if os.path.isfile(image_path + "." + ext.upper()):
return True
return False
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