mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
add check for ffmpeg. attempt to install in linux
This commit is contained in:
parent
73f6220674
commit
23aee925ff
1 changed files with 17 additions and 1 deletions
|
@ -7,6 +7,23 @@ from subprocess import call
|
||||||
Logger = logging.getLogger()
|
Logger = logging.getLogger()
|
||||||
|
|
||||||
def Transcode_file(filePath):
|
def Transcode_file(filePath):
|
||||||
|
|
||||||
|
if os.name == 'nt':
|
||||||
|
ffmpeg = os.path.join(os.path.dirname(sys.argv[0]), 'ffmpeg\bin\ffmpeg.exe') # note, will need to package in this dir.
|
||||||
|
if not os.path.isfile(ffmpeg): # problem
|
||||||
|
Logger.error("ffmpeg not found. ffmpeg needs to be located at: %s", ffmpeg)
|
||||||
|
Logger.info("Cannot transcode file %s", filepath)
|
||||||
|
return 1 # failure
|
||||||
|
else
|
||||||
|
if call(['which', ffmpeg]):
|
||||||
|
res = call([os.path,join(os.path.dirname(sys.argv[0]),getffmpeg.sh')])
|
||||||
|
if res or call(['which', ffmpeg]): # did not install or ffmpeg still not found.
|
||||||
|
Logger.error("Failed to install ffmpeg. Please install manually")
|
||||||
|
Logger.info("Cannot transcode file %s", filepath)
|
||||||
|
return 1 # failure
|
||||||
|
else:
|
||||||
|
ffmpeg = 'ffmpeg'
|
||||||
|
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
configFilename = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
configFilename = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
||||||
Logger.info("Loading config from %s", configFilename)
|
Logger.info("Loading config from %s", configFilename)
|
||||||
|
@ -18,7 +35,6 @@ def Transcode_file(filePath):
|
||||||
config.read(configFilename)
|
config.read(configFilename)
|
||||||
|
|
||||||
duplicate = config.get("Transcoder", "duplicate")
|
duplicate = config.get("Transcoder", "duplicate")
|
||||||
ffmpeg = os.path.normpath(config.get("Transcoder", "ffmpeg"))
|
|
||||||
ignoreExtensions = (config.get("Transcoder", "ignoreExtensions")).split(',')
|
ignoreExtensions = (config.get("Transcoder", "ignoreExtensions")).split(',')
|
||||||
outputVideoExtension = config.get("Transcoder", "outputVideoExtension")
|
outputVideoExtension = config.get("Transcoder", "outputVideoExtension")
|
||||||
outputVideoCodec = config.get("Transcoder", "outputVideoCodec")
|
outputVideoCodec = config.get("Transcoder", "outputVideoCodec")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue