fixing pep8 and pylint recomendations
This commit is contained in:
@@ -7,37 +7,30 @@ Created on Fri Jul 5 14:11:00 2013
|
||||
Library to interface with handbrake to encode video files
|
||||
"""
|
||||
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
#==============================================================================
|
||||
# HANDBRAKECOMMAND = ['HandBrakeCLI', '--verbose', '-i',
|
||||
# "SUBSTITUTE WITH INPUT FILE", '-o',
|
||||
# "SUBSTITUDE WITH OUTPUT FILE", '-f', 'mkv', '-e', 'x264',
|
||||
# '-x264-preset', 'slower', '-x264-tune', 'animation', '-q',
|
||||
# '20', '--loose-anamorphic', '--decomb', '--detelecine',
|
||||
# '--denoise="2:1:2:3"', '--deblock']
|
||||
#==============================================================================
|
||||
|
||||
class Encoder:
|
||||
def __init__(self, handbrakeCommand):
|
||||
self.handbrakeCommand = handbrakeCommand
|
||||
|
||||
def Encode(self, input, output, waitForCompletion=True, logger=None):
|
||||
self.handbrakeCommand[3] = input
|
||||
self.handbrakeCommand[5] = output
|
||||
def encode(handbrakecommand, inputfile, outputfile, waitforcompletion=True,
|
||||
logger=None):
|
||||
"""
|
||||
Encode inputfile and save the result to outputfile. handbrakecommand is
|
||||
a list of strings containing the arguments to handbrakecli.
|
||||
"""
|
||||
|
||||
if logger:
|
||||
logger.debug("Handbrake command is: {0}".format(self.handbrakeCommand))
|
||||
handbrakecommand[3] = inputfile
|
||||
handbrakecommand[5] = outputfile
|
||||
|
||||
process = subprocess.Popen(self.handbrakeCommand)
|
||||
|
||||
if waitForCompletion:
|
||||
process.wait()
|
||||
|
||||
if logger is not None:
|
||||
logger.info("Handbrake completed with return code {0}".format(process.returncode))
|
||||
return process.returncode
|
||||
|
||||
return None
|
||||
|
||||
if logger:
|
||||
logger.debug("Handbrake command is: {0}".format(handbrakecommand))
|
||||
|
||||
process = subprocess.Popen(handbrakecommand)
|
||||
|
||||
if waitforcompletion:
|
||||
process.wait()
|
||||
|
||||
if logger is not None:
|
||||
logger.info("Handbrake completed with return code {0}".format(
|
||||
process.returncode))
|
||||
return process.returncode
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user