diff --git a/time_lapse/check_interval.py b/time_lapse/check_interval.py index 656bbae..ebc86a5 100644 --- a/time_lapse/check_interval.py +++ b/time_lapse/check_interval.py @@ -12,9 +12,9 @@ MIN_IMAGES_SEQUENCE = 20 -def get_image_date(image_path: str) -> datetime.datetime: +def get_image_date(image_path: pathlib.Path) -> datetime.datetime: """Get EXIF image date from an image as a datetime""" - with pathlib.Path(image_path).open('rb') as _file: + with image_path.open('rb') as _file: tags = exifreader.process_file(_file, details=False) date_time = tags['EXIF DateTimeOriginal'].values subsec = tags['EXIF SubSecTimeOriginal'].values @@ -38,7 +38,7 @@ def find_sequences(pattern: str, shots_per_interval: int, group: bool) -> None: return image_dates = sorted( - (ImageInfo(path=pathlib.Path(path), date=get_image_date(path)) for path in files[::skip]), + (ImageInfo(path=path, date=get_image_date(path)) for path in files[::skip]), key=attrgetter('date'), ) diff --git a/time_lapse/detect_audio.py b/time_lapse/detect_audio.py index 58ee09f..5c46ed4 100644 --- a/time_lapse/detect_audio.py +++ b/time_lapse/detect_audio.py @@ -8,4 +8,4 @@ def files_with_audio(pattern: str = '*.mp4') -> Iterator[str]: for filename in Path().glob(pattern): for stream in ffmpeg.probe(filename)['streams']: if stream['codec_type'] == 'audio': - yield filename + yield str(filename)