From 87c2d2ff50c600a580010ffcd30d76275189cc99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Fern=C3=A1ndez=20Gosende?= Date: Tue, 29 Jan 2013 19:58:45 +0100 Subject: [PATCH] [Create GIF with ImageMagick] Only consider valid bookmarks --- Create GIF with ImageMagick.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Create GIF with ImageMagick.py b/Create GIF with ImageMagick.py index 3bea243..ab05ac8 100644 --- a/Create GIF with ImageMagick.py +++ b/Create GIF with ImageMagick.py @@ -205,13 +205,17 @@ def prompt_path(executable, message_prefix): header='id=ImageMagick columns={0} rows={1}\n\f:\x1A'.format(width, height) if use_bm_only: bmlist = avsp.GetBookmarkList() + frame_count = avsp.GetVideoFramecount() if not bmlist: - gif_range = range(0, avsp.GetVideoFramecount(), select_every) + gif_range = range(0, frame_count, select_every) else: - if len(bmlist) % 2 and not avsp.MsgBox(_('Odd number of bookmarks'), - _('Warning'), cancel=True): - return - bmlist.sort() + bmlist = sorted([bm for bm in bmlist if bm < frame_count]) + if len(bmlist) % 2: + if not avsp.MsgBox(_('Odd number of bookmarks'), + _('Warning'), cancel=True): + return + else: + bmlist.append(frame_count - 1) gif_range = [] for i, bm in enumerate(bmlist): if i%2: