#!/usr/bin/env python

import bootstrap
import sys
import openpluginlib
import openimagelib
import openmedialib
import common

openpluginlib.init( "" )

if len( sys.argv ) > 1:
	sys.argv.pop( 0 )
	clips = common.parse_args( sys.argv )
	for clip in clips:
		input = openmedialib.create_input( clip[ 0 ] )
		if input is not None:
			input_name = clip.pop( 0 )
			frame = input.fetch( )
			if frame is not None:
				preview = common.preview( frame )
				i = input.get_frames( )
				while i >= 0:
					i -= 1
					input.seek( i, False )
					frame = input.fetch( )
					if not preview.push( frame ): break
				preview.complete( )
else:
	print "Usage: reverse.py <input> ..."
	
openpluginlib.uninit( )
