Added ffmpeg detection in preparation for automated exporting

This commit is contained in:
WORD559 committed 2018-07-04 12:37:50 +01:00
1 parent 0ef45d240e
commit 53d094b39e
1 file changed
+13 -1
+13 -1
View File
@@ -12,14 +12,26 @@
# - Jsafive for supplying .tmb files # - Jsafive for supplying .tmb files
# - Austin Burk, Midmad on hatena haiku and WDLmaster on hcs64.com for determining the sound codec # - Austin Burk, Midmad on hatena haiku and WDLmaster on hcs64.com for determining the sound codec
# #
import sys, wave, audioop, re#needs os and time aswell in CMD mode import sys, wave, audioop, re, os #needs os and time aswell in CMD mode (UPDATE 2018/07/04: os used to get devnull for discarding subprocess output)
import numpy as np import numpy as np
import subprocess # used for ffmpeg
try: try:
from PIL import Image from PIL import Image
hasPIL = True hasPIL = True
except ImportError: except ImportError:
print "Warning: PIL not found, image extraction won't work!" print "Warning: PIL not found, image extraction won't work!"
hasPIL = False hasPIL = False
# Test for ffmpeg by executing ffmpeg -h; an OSError indicates ffmpeg is not installed
try:
with open(os.devnull,"w") as null:
subprocess.call(["ffmpeg","-h"],
stdout=null,
stderr=null)
hasffmpeg = True
except OSError:
print "Warning: ffmpeg not found, video export unavailable. Please make sure ffmepg is installed and can be accessed on your path."
hasffmpeg = False
#helpers: #helpers:
def AscDec(ascii, LittleEndian=False):#Converts a ascii string into a decimal def AscDec(ascii, LittleEndian=False):#Converts a ascii string into a decimal