Coverage for src/photo_filter_utils.py: 100%
10 statements
« prev ^ index » next coverage.py v7.10.7, created at 2025-10-16 04:41 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2025-10-16 04:41 +0000
1"""Photo filtering utilities module.
3This module contains utilities for photo filtering and validation
4during photo synchronization.
5"""
7___author___ = "Mandar Patil <mandarons@pm.me>"
10from src import get_logger
12LOGGER = get_logger()
15def is_photo_wanted(photo, extensions: list[str] | None) -> bool:
16 """Check if photo is wanted based on extension filters.
18 Args:
19 photo: Photo object from iCloudPy
20 extensions: List of allowed file extensions, None means all extensions allowed
22 Returns:
23 True if photo should be synced, False otherwise
24 """
25 if not extensions or len(extensions) == 0:
26 return True
28 for extension in extensions:
29 if photo.filename.lower().endswith(str(extension).lower()):
30 return True
31 return False