<s> from __future__ import print_function <EOL> import logging <EOL> import os <EOL> import shutil <EOL> import sys <EOL> import tempfile <EOL> from optparse import OptionParser <EOL> from qtfaststart import VERSION <EOL> from qtfaststart import processor <EOL> from qtfaststart . exceptions import FastStartException <EOL> log = logging . getLogger ( "<STR_LIT>" ) <EOL> def run ( ) : <EOL> logging . basicConfig ( level = logging . INFO , stream = sys . stdout , <EOL> format = "<STR_LIT>" ) <EOL> parser = OptionParser ( usage = "<STR_LIT>" , <EOL> version = "<STR_LIT>" + VERSION ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , default = False , <EOL> action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT:list>" , default = False , <EOL> action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , default = False , <EOL> action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , default = False , <EOL> action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> options , args = parser . parse_args ( ) <EOL> if len ( args ) < <NUM_LIT:1> : <EOL> parser . print_help ( ) <EOL> raise SystemExit ( <NUM_LIT:1> ) <EOL> if options . debug : <EOL> logging . getLogger ( ) . setLevel ( logging . DEBUG ) <EOL> if options . list : <EOL> index = processor . get_index ( open ( args [ <NUM_LIT:0> ] , "<STR_LIT:rb>" ) ) <EOL> for atom , pos , size in index : <EOL> if atom == "<STR_LIT>" : <EOL> atom = "<STR_LIT>" <EOL> print ( atom , "<STR_LIT:(>" + str ( size ) + "<STR_LIT>" ) <EOL> raise SystemExit <EOL> if len ( args ) == <NUM_LIT:1> : <EOL> if options . sample : <EOL> print ( "<STR_LIT>" ) <EOL> raise SystemExit ( <NUM_LIT:1> ) <EOL> tmp , outfile = tempfile . mkstemp ( ) <EOL> os . close ( tmp ) <EOL> else : <EOL> outfile = args [ <NUM_LIT:1> ] <EOL> limit = <NUM_LIT:0> <EOL> if options . sample : <EOL> limit = <NUM_LIT:4> * ( <NUM_LIT> ** <NUM_LIT:2> ) <EOL> try : <EOL> processor . process ( args [ <NUM_LIT:0> ] , outfile , limit = limit , to_end = options . to_end ) <EOL> except FastStartException : <EOL> raise SystemExit ( <NUM_LIT:1> ) <EOL> if len ( args ) == <NUM_LIT:1> : <EOL> shutil . move ( outfile , args [ <NUM_LIT:0> ] ) </s>
