Skip to content

Commit

Permalink
[Create GIF with ImageMagick] Only consider valid bookmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
vdcrim committed Jan 29, 2013
1 parent d88f891 commit 87c2d2f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Create GIF with ImageMagick.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 87c2d2f

Please sign in to comment.