mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-02-18 03:01:03 +01:00
General: move cache call
This commit is contained in:
parent
3dd1fc9039
commit
38afea4f2e
@ -24,7 +24,7 @@ def get_random_image(img_dir, cache_dir):
|
|||||||
print("image: No new images found (nothing to do), exiting...")
|
print("image: No new images found (nothing to do), exiting...")
|
||||||
quit(1)
|
quit(1)
|
||||||
|
|
||||||
return img_dir / random.choice(images).name
|
return str(img_dir / random.choice(images).name)
|
||||||
|
|
||||||
|
|
||||||
def get_image(img, cache_dir):
|
def get_image(img, cache_dir):
|
||||||
@ -32,7 +32,7 @@ def get_image(img, cache_dir):
|
|||||||
image = pathlib.Path(img)
|
image = pathlib.Path(img)
|
||||||
|
|
||||||
if image.is_file():
|
if image.is_file():
|
||||||
wal_img = image
|
wal_img = str(image)
|
||||||
|
|
||||||
elif image.is_dir():
|
elif image.is_dir():
|
||||||
wal_img = get_random_image(image, cache_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.")
|
print("error: No valid image file found.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
# Cache the image file path.
|
||||||
|
util.save_file(wal_img, cache_dir / "wal")
|
||||||
|
|
||||||
print("image: Using image", wal_img)
|
print("image: Using image", wal_img)
|
||||||
return str(wal_img)
|
return wal_img
|
||||||
|
@ -49,8 +49,6 @@ def gen_colors(img, color_count):
|
|||||||
|
|
||||||
def get_colors(img, cache_dir, color_count, quiet):
|
def get_colors(img, cache_dir, color_count, quiet):
|
||||||
"""Get the colorscheme."""
|
"""Get the colorscheme."""
|
||||||
util.save_file(img, cache_dir / "wal")
|
|
||||||
|
|
||||||
# _home_dylan_img_jpg.json
|
# _home_dylan_img_jpg.json
|
||||||
cache_file = cache_dir / "schemes" / \
|
cache_file = cache_dir / "schemes" / \
|
||||||
img.replace("/", "_").replace(".", "_")
|
img.replace("/", "_").replace(".", "_")
|
||||||
|
Loading…
Reference in New Issue
Block a user