Skip to content

Commit

Permalink
Update folder_diff.py
Browse files Browse the repository at this point in the history
  • Loading branch information
villares committed Oct 13, 2023
1 parent a742159 commit 9b007c6
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions admin_scripts/folder_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@ def walk_images(i):

def get_img_and_code(path, resize=(900, 900)):
img, code = None, ''
if path.is_file():
img, code = load_image_and_data(path, resize)
elif path.is_dir():
image_path = path / (path.name + '.png')
img, code = load_image_and_data(image_path, resize)
if len(code) == 0:
code_path = path / (path.name + '.py')
code = code_path.read_text()
try:
if path.is_file():
img, code = load_image_and_data(path, resize)
elif path.is_dir():
image_path = path / (path.name + '.png')
img, code = load_image_and_data(image_path, resize)
if len(code) == 0:
code_path = path / (path.name + '.py')
code = code_path.read_text()
except Exception as e:
print(str(e))
return img, code

def load_image_and_data(image_file, resize=None):
Expand Down

0 comments on commit 9b007c6

Please sign in to comment.