diff --git a/scripts/images_history.py b/scripts/images_history.py
index f7209e8..330fbe7 100644
--- a/scripts/images_history.py
+++ b/scripts/images_history.py
@@ -31,6 +31,7 @@ path_recorder_filename = os.path.join(scripts.basedir(), "path_recorder.txt")
path_recorder_filename_tmp = f"{path_recorder_filename}.tmp"
aes_cache_file = os.path.join(scripts.basedir(), "aes_scores.json")
exif_cache_file = os.path.join(scripts.basedir(), "exif_data.json")
+ranking_file = os.path.join(scripts.basedir(), "ranking.json")
image_ext_list = [".png", ".jpg", ".jpeg", ".bmp", ".gif", ".webp"]
cur_ranking_value="0"
finfo_aes = {}
@@ -156,19 +157,18 @@ def save_image(file_name):
return "
Image not found (may have been already moved)
"
def create_ranked_file(filename, ranking):
- ranking_file = 'ranking.json'
+ if os.path.isfile(filename):
+ if not os.path.isfile(ranking_file):
+ data = {}
+
+ else:
+ with open(ranking_file, 'r') as file:
+ data = json.load(file)
- if not os.path.isfile(ranking_file):
- data = {}
-
- else:
- with open(ranking_file, 'r') as file:
- data = json.load(file)
+ data[filename] = ranking
- data[filename] = ranking
-
- with open(ranking_file, 'w') as file:
- json.dump(data, file)
+ with open(ranking_file, 'w') as file:
+ json.dump(data, file)
def delete_image(delete_num, name, filenames, image_index, visible_num):
if name == "":
@@ -472,17 +472,6 @@ def get_ranking(filename):
return ranking_value
-def get_ranking(filename):
- ranking_file = 'ranking.json'
- ranking_value = "None"
- if os.path.isfile(ranking_file):
- with open(ranking_file, 'r') as file:
- data = json.load(file)
- if filename in data:
- ranking_value = data[filename]
-
- return ranking_value
-
def create_tab(tabname):
custom_dir = False
path_recorder = {}