fix index sort

This commit is contained in:
j 2018-11-12 11:52:02 +00:00
parent 5ec372e7ed
commit 2680a96072

View file

@ -72,6 +72,10 @@ def normalize(name):
def sort_clips(edit, sort):
clips = edit['clips']
idx = 0
for clip in clips:
clip['index'] = idx
idx += 1
reverse = sort.startswith('-')
last = '' if reverse else 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
sort = sort.lstrip('-')
@ -83,7 +87,7 @@ def sort_clips(edit, sort):
'id', 'index', 'in', 'out', 'duration',
'title', 'director', 'year', 'videoRatio',
]:
s = sorted(clips, key=lambda c: (str(c.get(sort, last)), c['title'], c['in'], c['out']))
s = sorted(clips, key=lambda c: (ox.sort_string(str(c.get(sort, last))), c['title'], c['in'], c['out']))
if reverse:
s = reversed(s)
else: