clearer variable names

This commit is contained in:
likho 2023-09-30 01:45:42 -07:00
parent db14ea6b3d
commit 9b2e9ed74d

View File

@ -448,11 +448,11 @@ if __name__ == "__main__":
def get_avatars(profiles, save_path, img_src):
import hashlib
imgs, info = fetch([p["avatar"] for p in profiles])
l = len(imgs)
if l != len(profiles) or l == 0:
length = len(imgs)
if length != len(profiles) or length == 0:
print("error in retrieving images", file=sys.stderr)
return
for i in range(0,l):
for i in range(0,length):
content_type = info[i].split('/')
ext = content_type.pop()
if content_type.pop() != "image":
@ -461,10 +461,10 @@ if __name__ == "__main__":
data = imgs[i].getvalue()
h = hashlib.sha1(data).hexdigest()
filename = "%s.%s" % (h, ext)
path = "%s/%s" % (save_path, filename)
profiles[i]["avatar"] = "%s/%s" % (img_src, filename)
asdf = "%s/%s" % (save_path, filename)
if not os.path.isfile(asdf):
with open(asdf, "wb") as f:
if not os.path.isfile(path):
with open(path, "wb") as f:
f.write(data)
j, m = fetch(f_cfg["list"])