From c945238c249eccd3124303eefa9154973de0be0d Mon Sep 17 00:00:00 2001 From: Alexander Gee Date: Tue, 16 Jul 2024 13:41:20 -0500 Subject: [PATCH 1/2] Create longest and shortest path criteria --- core/prioritize.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/prioritize.py b/core/prioritize.py index fc5de01d..4a5cf0cb 100644 --- a/core/prioritize.py +++ b/core/prioritize.py @@ -96,6 +96,8 @@ class FilenameCategory(CriterionCategory): DOESNT_END_WITH_NUMBER = 1 LONGEST = 2 SHORTEST = 3 + LONGEST_PATH = 4 + SHORTEST_PATH = 5 def format_criterion_value(self, value): return { @@ -103,6 +105,8 @@ class FilenameCategory(CriterionCategory): self.DOESNT_END_WITH_NUMBER: tr("Doesn't end with number"), self.LONGEST: tr("Longest"), self.SHORTEST: tr("Shortest"), + self.SHORTEST_PATH: tr("Longest Path"), + self.SHORTEST_PATH: tr("Shortest Path"), }[value] def extract_value(self, dupe): @@ -116,6 +120,10 @@ class FilenameCategory(CriterionCategory): return 0 if ends_with_digit else 1 else: return 1 if ends_with_digit else 0 + elif crit_value == self.LONGEST_PATH: + return len(str(dupe.folder_path)) * -1 + elif crit_value == self.SHORTEST_PATH: + return len(str(dupe.folder_path)) else: value = len(value) if crit_value == self.LONGEST: @@ -130,6 +138,8 @@ class FilenameCategory(CriterionCategory): self.DOESNT_END_WITH_NUMBER, self.LONGEST, self.SHORTEST, + self.LONGEST_PATH, + self.SHORTEST_PATH, ] ] From 23c6996051cbf0007474f7c0ef38897a6cbc29f4 Mon Sep 17 00:00:00 2001 From: Alexander Gee Date: Tue, 16 Jul 2024 19:23:59 -0500 Subject: [PATCH 2/2] Whoops didn't commit that --- core/prioritize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/prioritize.py b/core/prioritize.py index 4a5cf0cb..065969a6 100644 --- a/core/prioritize.py +++ b/core/prioritize.py @@ -105,7 +105,7 @@ class FilenameCategory(CriterionCategory): self.DOESNT_END_WITH_NUMBER: tr("Doesn't end with number"), self.LONGEST: tr("Longest"), self.SHORTEST: tr("Shortest"), - self.SHORTEST_PATH: tr("Longest Path"), + self.LONGEST_PATH: tr("Longest Path"), self.SHORTEST_PATH: tr("Shortest Path"), }[value]