def compress():
    """
    compress temp docstring
    """
    hb_nice = int(read_value('nice'))
    hb_cli = read_value('com')
    hb_out = read_value('temp_output')

    hb_api = HandBrake()

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

            if hb_api.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_api.getMovieTitle()))
            else:
                stopwatch.stop()
                print "HandBrake did not complete successfully"
        else:
            print "Queue does not exist or is empty"
    else:
        print "Process already running skipper"
#

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"
    else:
Exemple #3
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"