Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
flickowoa committed Jan 15, 2024
1 parent 07e3f79 commit 7ca2684
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions update_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import json
import requests
import re
import PIL

from PIL import Image

with open("./themes.json") as f:
themes = json.load(f)["themes"]
Expand Down Expand Up @@ -71,13 +72,14 @@ def find_urls(rdme):
for url in [*md,*html]:
im = requests.get(url)
if im.status_code == 200:
im = PIL.Image.open(im.raw)
images[url] = im.size
im = Image.open(im.raw)
images[url] = sum(im.size)
else:
print("error fetching image")

# sort images
images = sorted(images.items(), key=lambda x: x[1][0] + x[1][1], reverse=True)
images = sorted(images.items(), key=lambda x: x[1], reverse=True)
print(images)
return [x[0] for x in images]


Expand Down

0 comments on commit 7ca2684

Please sign in to comment.