Added settings file back for shellfm; fixed config load

This commit is contained in:
2023-09-29 23:15:14 -05:00
parent 43f56b283c
commit 457bf09b52
3 changed files with 50 additions and 4 deletions

View File

@@ -174,14 +174,15 @@ class Icon(DesktopIconMixin, VideoIconMixin, MeshsIconMixin):
return path_exists, img_hash, hash_img_path
def fast_hash(self, filename, hash_factory=hashlib.md5, chunk_num_blocks=128, i=1):
def fast_hash(self, filename: str, hash_factory: callable = hashlib.md5, chunk_num_blocks: int = 128, i: int = 1) -> str:
h = hash_factory()
with open(filename,'rb') as f:
# NOTE: Jump to middle of file
f.seek(0, 2)
mid = int(f.tell() / 2)
f.seek(mid, 0)
while chunk := f.read(chunk_num_blocks*h.block_size):
while chunk := f.read(chunk_num_blocks * h.block_size):
h.update(chunk)
if (i == 12):
break