Example #1
0
#

REAL_PATH = os.path.dirname(os.path.realpath(__file__))

config = ConfigParser.RawConfigParser()
config.read('%s/../settings.cfg' % REAL_PATH)

HB_NICE = config.getint('HANDBRAKE', 'nice')
HB_CLI = config.get('HANDBRAKE', 'com')
HB_OUT = config.get('HANDBRAKE', 'temp_output')

#
#   CODE
#

hb = HandBrake()

if not hb.findProcess():
    if hb.loadMovie():
        print "Encoding and compressing %s" % hb.getMovieTitle()
        stopwatch = Timer()

        if hb.convert(args=HB_CLI, nice=HB_NICE, output=HB_OUT):
            print "Movie was compressed and encoded successfully"

            stopwatch.stop()
            print("It took %s minutes to compress %s" %
                  (stopwatch.getTime(), hb.getMovieTitle()))
        else:
            stopwatch.stop()
            print "HandBrake did not complete successfully"