From 2680a960724b9b8ae4a7981d63f002b552c27ced Mon Sep 17 00:00:00 2001 From: j Date: Mon, 12 Nov 2018 11:52:02 +0000 Subject: [PATCH] fix index sort --- edit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/edit.py b/edit.py index 80b690e..c0db577 100755 --- a/edit.py +++ b/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: