mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-09 15:38:30 +01:00
image: Use os.scandir to find images.
This commit is contained in:
parent
bb81f1a43d
commit
b5c27de8b5
@ -22,8 +22,8 @@ def random_img(img_dir):
|
||||
|
||||
# Add all images to a list excluding the current wallpaper.
|
||||
file_types = (".png", ".jpg", ".jpeg", ".jpe", ".gif")
|
||||
images = [img for img in os.listdir(img_dir)
|
||||
if img.endswith(file_types) and img != current_wall]
|
||||
images = [img for img in os.scandir(img_dir)
|
||||
if img.name.endswith(file_types) and img.name != current_wall]
|
||||
|
||||
return pathlib.Path(img_dir / random.choice(images))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user