Skip to content

Commit

Permalink
Fix incorrect types or objects already being a Path
Browse files Browse the repository at this point in the history
  • Loading branch information
153957 committed Aug 12, 2023
1 parent a46a1ba commit 4fec192
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions time_lapse/check_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'),
)

Expand Down
2 changes: 1 addition & 1 deletion time_lapse/detect_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 4fec192

Please sign in to comment.