mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
[#169 state:fixed] Ignore filename extension during filename sorting in results.
This commit is contained in:
parent
48e2acf0a2
commit
8102c89802
@ -20,7 +20,8 @@ from hscommon.reg import RegistrableApplication
|
||||
from hscommon.notify import Broadcaster
|
||||
from hscommon.path import Path
|
||||
from hscommon.conflict import smart_move, smart_copy
|
||||
from hscommon.util import delete_if_empty, first, escape, nonone, format_time_decimal, allsame
|
||||
from hscommon.util import (delete_if_empty, first, escape, nonone, format_time_decimal, allsame,
|
||||
rem_file_ext)
|
||||
from hscommon.trans import tr, trmsg
|
||||
|
||||
from . import directories, results, scanner, export, fs
|
||||
@ -66,7 +67,11 @@ def format_perc(p):
|
||||
def format_dupe_count(c):
|
||||
return str(c) if c else '---'
|
||||
|
||||
def cmp_value(value):
|
||||
def cmp_value(dupe, column):
|
||||
if column.attr == 'name':
|
||||
value = rem_file_ext(dupe.name)
|
||||
else:
|
||||
value = getattr(dupe, column.attr, '')
|
||||
return value.lower() if isinstance(value, str) else value
|
||||
|
||||
class DupeGuru(RegistrableApplication, Broadcaster):
|
||||
|
@ -63,13 +63,13 @@ class DupeGuru(DupeGuruBase):
|
||||
]
|
||||
|
||||
def _get_dupe_sort_key(self, dupe, get_group, key, delta):
|
||||
r = cmp_value(getattr(dupe, self.COLUMNS[key].attr))
|
||||
r = cmp_value(dupe, self.COLUMNS[key])
|
||||
if delta and (key in self.DELTA_COLUMNS):
|
||||
r -= cmp_value(getattr(get_group().ref, self.COLUMNS[key].attr))
|
||||
r -= cmp_value(get_group().ref, self.COLUMNS[key])
|
||||
return r
|
||||
|
||||
def _get_group_sort_key(self, group, key):
|
||||
return cmp_value(getattr(group.ref, self.COLUMNS[key].attr))
|
||||
return cmp_value(group.ref, self.COLUMNS[key])
|
||||
|
||||
def _prioritization_categories(self):
|
||||
return prioritize.all_categories()
|
||||
|
@ -96,9 +96,9 @@ class DupeGuru(DupeGuruBase):
|
||||
return m.percentage
|
||||
if key == self.DUPECOUNT_COL:
|
||||
return 0
|
||||
r = cmp_value(getattr(dupe, self.COLUMNS[key].attr, ''))
|
||||
r = cmp_value(dupe, self.COLUMNS[key])
|
||||
if delta and (key in self.DELTA_COLUMNS):
|
||||
r -= cmp_value(getattr(get_group().ref, self.COLUMNS[key].attr, ''))
|
||||
r -= cmp_value(get_group().ref, self.COLUMNS[key])
|
||||
return r
|
||||
|
||||
def _get_group_sort_key(self, group, key):
|
||||
@ -106,7 +106,7 @@ class DupeGuru(DupeGuruBase):
|
||||
return group.percentage
|
||||
if key == self.DUPECOUNT_COL:
|
||||
return len(group)
|
||||
return cmp_value(getattr(group.ref, self.COLUMNS[key].attr, ''))
|
||||
return cmp_value(group.ref, self.COLUMNS[key])
|
||||
|
||||
def _prioritization_categories(self):
|
||||
return prioritize.all_categories()
|
||||
|
@ -83,10 +83,10 @@ class DupeGuru(DupeGuruBase):
|
||||
return 0
|
||||
if key == self.FOLDER_COL:
|
||||
dupe_folder_path = getattr(dupe, 'display_folder_path', dupe.folder_path)
|
||||
return cmp_value(str(dupe_folder_path))
|
||||
r = cmp_value(getattr(dupe, self.COLUMNS[key].attr, ''))
|
||||
return str(dupe_folder_path).lower()
|
||||
r = cmp_value(dupe, self.COLUMNS[key])
|
||||
if delta and (key in self.DELTA_COLUMNS):
|
||||
ref_value = cmp_value(getattr(get_group().ref, self.COLUMNS[key].attr, ''))
|
||||
ref_value = cmp_value(get_group().ref, self.COLUMNS[key])
|
||||
if key == 4: # dimensions
|
||||
r = get_delta_dimensions(r, ref_value)
|
||||
else:
|
||||
@ -100,8 +100,8 @@ class DupeGuru(DupeGuruBase):
|
||||
return len(group)
|
||||
if key == self.FOLDER_COL:
|
||||
dupe_folder_path = getattr(group.ref, 'display_folder_path', group.ref.folder_path)
|
||||
return cmp_value(str(dupe_folder_path))
|
||||
return cmp_value(getattr(group.ref, self.COLUMNS[key].attr, ''))
|
||||
return str(dupe_folder_path).lower()
|
||||
return cmp_value(group.ref, self.COLUMNS[key])
|
||||
|
||||
def _prioritization_categories(self):
|
||||
return prioritize.all_categories()
|
||||
|
@ -66,9 +66,9 @@ class DupeGuru(DupeGuruBase):
|
||||
return m.percentage
|
||||
if key == self.DUPECOUNT_COL:
|
||||
return 0
|
||||
r = cmp_value(getattr(dupe, self.COLUMNS[key].attr, ''))
|
||||
r = cmp_value(dupe, self.COLUMNS[key])
|
||||
if delta and (key in self.DELTA_COLUMNS):
|
||||
r -= cmp_value(getattr(get_group().ref, self.COLUMNS[key].attr, ''))
|
||||
r -= cmp_value(get_group().ref, self.COLUMNS[key])
|
||||
return r
|
||||
|
||||
def _get_group_sort_key(self, group, key):
|
||||
@ -76,7 +76,7 @@ class DupeGuru(DupeGuruBase):
|
||||
return group.percentage
|
||||
if key == self.DUPECOUNT_COL:
|
||||
return len(group)
|
||||
return cmp_value(getattr(group.ref, self.COLUMNS[key].attr, ''))
|
||||
return cmp_value(group.ref, self.COLUMNS[key])
|
||||
|
||||
def _prioritization_categories(self):
|
||||
return prioritize.all_categories()
|
||||
|
Loading…
x
Reference in New Issue
Block a user