fix index sort
This commit is contained in:
parent
5ec372e7ed
commit
2680a96072
1 changed files with 5 additions and 1 deletions
6
edit.py
6
edit.py
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue