Skip to content

Commit

Permalink
Replace glob.glob by pathlib.Path.glob
Browse files Browse the repository at this point in the history
  • Loading branch information
153957 committed Aug 12, 2023
1 parent 74e9b8b commit a46a1ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions time_lapse/check_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pathlib

from dataclasses import dataclass
from glob import glob
from operator import attrgetter

import exifreader
Expand Down Expand Up @@ -32,7 +31,7 @@ class ImageInfo:

def find_sequences(pattern: str, shots_per_interval: int, group: bool) -> None:
skip = shots_per_interval
files = sorted(glob(pattern))
files = sorted(pathlib.Path().glob(pattern))

if not files:
print(f'Found no matching files the pattern "{pattern}"')
Expand Down
5 changes: 2 additions & 3 deletions time_lapse/detect_audio.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import glob

from collections.abc import Iterator
from pathlib import Path

import ffmpeg


def files_with_audio(pattern: str = '*.mp4') -> Iterator[str]:
for filename in glob.glob(pattern):
for filename in Path().glob(pattern):
for stream in ffmpeg.probe(filename)['streams']:
if stream['codec_type'] == 'audio':
yield filename

0 comments on commit a46a1ba

Please sign in to comment.