image: Cleanup

This commit is contained in:
Dylan Araps 2018-01-02 11:51:00 +11:00
parent e09872be69
commit 55a66f73e9

View File

@ -15,11 +15,10 @@ def get_random_image(img_dir):
current_wall = wallpaper.get() current_wall = wallpaper.get()
current_wall = os.path.basename(current_wall) current_wall = os.path.basename(current_wall)
file_types = (".png", ".jpg", ".jpeg", ".jpe", ".gif", file_types = (".png", ".jpg", ".jpeg", ".jpe", ".gif")
".PNG", ".JPG", ".JPEG", ".JPE", ".GIF")
images = [img for img in os.scandir(img_dir) images = [img for img in os.scandir(img_dir)
if img.name.endswith(file_types)] if img.name.lower().endswith(file_types)]
if len(images) > 2 and current_wall in images: if len(images) > 2 and current_wall in images:
images.remove(current_wall) images.remove(current_wall)