From cfbd5353cffb1ff5ba0de4545abd8a12f0dad919 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 18 Oct 2018 08:06:57 +1100 Subject: Revert "Hash file for cache filename" --- pywal/colors.py | 5 +++-- pywal/util.py | 12 ------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/pywal/colors.py b/pywal/colors.py index 246318c..a87ee4c 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -4,6 +4,7 @@ Generate a palette using various backends. import logging import os import random +import re import sys from . import theme @@ -85,9 +86,9 @@ def saturate_colors(colors, amount): def cache_fname(img, backend, light, cache_dir, sat=""): """Create the cache file name.""" color_type = "light" if light else "dark" - file_hash = util.hashf(img) + file_name = re.sub("[/|\\|.]", "_", img) - file_parts = [file_hash, color_type, backend, sat, __cache_version__] + file_parts = [file_name, color_type, backend, sat, __cache_version__] return [cache_dir, "schemes", "%s_%s_%s_%s_%s.json" % (*file_parts,)] diff --git a/pywal/util.py b/pywal/util.py index 10fb42c..0557cc4 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -2,7 +2,6 @@ Misc helper functions. """ import colorsys -import hashlib import json import logging import os @@ -179,14 +178,3 @@ def get_pid(name): return False return True - - -def hashf(fpath): - """Get the md5 hash of a file.""" - return hashlib.md5(file_bytes(open(fpath, 'rb'))).hexdigest() - - -def file_bytes(fpath): - """Helper function to read file.""" - with fpath: - return fpath.read() -- cgit v1.2.3