From 38afea4f2ef5a4a04ef44139aa1ed01f3655a797 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 22 Jul 2017 10:51:52 +1000 Subject: [PATCH] General: move cache call --- pywal/image.py | 9 ++++++--- pywal/magic.py | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pywal/image.py b/pywal/image.py index a7a314d..421943e 100644 --- a/pywal/image.py +++ b/pywal/image.py @@ -24,7 +24,7 @@ def get_random_image(img_dir, cache_dir): print("image: No new images found (nothing to do), exiting...") quit(1) - return img_dir / random.choice(images).name + return str(img_dir / random.choice(images).name) def get_image(img, cache_dir): @@ -32,7 +32,7 @@ def get_image(img, cache_dir): image = pathlib.Path(img) if image.is_file(): - wal_img = image + wal_img = str(image) elif image.is_dir(): wal_img = get_random_image(image, cache_dir) @@ -41,5 +41,8 @@ def get_image(img, cache_dir): print("error: No valid image file found.") exit(1) + # Cache the image file path. + util.save_file(wal_img, cache_dir / "wal") + print("image: Using image", wal_img) - return str(wal_img) + return wal_img diff --git a/pywal/magic.py b/pywal/magic.py index 5768c71..b384b97 100644 --- a/pywal/magic.py +++ b/pywal/magic.py @@ -49,8 +49,6 @@ def gen_colors(img, color_count): def get_colors(img, cache_dir, color_count, quiet): """Get the colorscheme.""" - util.save_file(img, cache_dir / "wal") - # _home_dylan_img_jpg.json cache_file = cache_dir / "schemes" / \ img.replace("/", "_").replace(".", "_")