Skip to content

Commit

Permalink
[#108 state:fixed] Fixed column mess after the earlier removal of the…
Browse files Browse the repository at this point in the history
… ctime col.
  • Loading branch information
Virgil Dupras committed Oct 4, 2010
1 parent a50a3b0 commit d574bc6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
13 changes: 8 additions & 5 deletions core_me/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
{'attr':'dupe_count','display':'Dupe Count'},
]

MATCHPERC_COL = 15
DUPECOUNT_COL = 17

METADATA_TO_READ = ['size', 'mtime', 'duration', 'bitrate', 'samplerate', 'title', 'artist',
'album', 'genre', 'year', 'track', 'comment']

Expand Down Expand Up @@ -76,19 +79,19 @@ def GetDisplayInfo(dupe, group, delta):
]

def GetDupeSortKey(dupe, get_group, key, delta):
if key == 16:
if key == MATCHPERC_COL:
m = get_group().get_match_of(dupe)
return m.percentage
if key == 18:
if key == DUPECOUNT_COL:
return 0
r = cmp_value(getattr(dupe, COLUMNS[key]['attr'], ''))
if delta and (key in (2, 3, 4, 7, 8)):
if delta and (key in {2, 3, 4, 7}):
r -= cmp_value(getattr(get_group().ref, COLUMNS[key]['attr'], ''))
return r

def GetGroupSortKey(group, key):
if key == 16:
if key == MATCHPERC_COL:
return group.percentage
if key == 18:
if key == DUPECOUNT_COL:
return len(group)
return cmp_value(getattr(group.ref, COLUMNS[key]['attr'], ''))
13 changes: 8 additions & 5 deletions core_pe/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def format_dimensions(dimensions):
{'attr':'dupe_count','display':'Dupe Count'},
]

MATCHPERC_COL = 6
DUPECOUNT_COL = 7

METADATA_TO_READ = ['size', 'mtime', 'dimensions']

def GetDisplayInfo(dupe,group,delta=False):
Expand Down Expand Up @@ -54,20 +57,20 @@ def GetDisplayInfo(dupe,group,delta=False):
]

def GetDupeSortKey(dupe, get_group, key, delta):
if key == 7:
if key == MATCHPERC_COL:
m = get_group().get_match_of(dupe)
return m.percentage
if key == 8:
if key == DUPECOUNT_COL:
return 0
r = cmp_value(getattr(dupe, COLUMNS[key]['attr'], ''))
if delta and (key in (2, 5, 6)):
if delta and (key in {2, 5}):
r -= cmp_value(getattr(get_group().ref, COLUMNS[key]['attr'], ''))
return r

def GetGroupSortKey(group, key):
if key == 7:
if key == MATCHPERC_COL:
return group.percentage
if key == 8:
if key == DUPECOUNT_COL:
return len(group)
return cmp_value(getattr(group.ref, COLUMNS[key]['attr'], ''))

13 changes: 8 additions & 5 deletions core_se/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
{'attr':'dupe_count','display':'Dupe Count'},
]

MATCHPERC_COL = 5
DUPECOUNT_COL = 7

METADATA_TO_READ = ['size', 'mtime']

def GetDisplayInfo(dupe, group, delta):
Expand Down Expand Up @@ -49,19 +52,19 @@ def GetDisplayInfo(dupe, group, delta):
]

def GetDupeSortKey(dupe, get_group, key, delta):
if key == 6:
if key == MATCHPERC_COL:
m = get_group().get_match_of(dupe)
return m.percentage
if key == 8:
if key == DUPECOUNT_COL:
return 0
r = cmp_value(getattr(dupe, COLUMNS[key]['attr'], ''))
if delta and (key in (2, 4, 5)):
if delta and (key in {2, 4}):
r -= cmp_value(getattr(get_group().ref, COLUMNS[key]['attr'], ''))
return r

def GetGroupSortKey(group, key):
if key == 6:
if key == MATCHPERC_COL:
return group.percentage
if key == 8:
if key == DUPECOUNT_COL:
return len(group)
return cmp_value(getattr(group.ref, COLUMNS[key]['attr'], ''))

0 comments on commit d574bc6

Please sign in to comment.