Detects ffmpeg and ffprobe at startup but will alert you to if there missing only when needed to be used so that we don't get a stupid error message at startup for no reason.

This commit is contained in:
echel0n 2014-04-19 17:55:44 -07:00
commit 8434a58df0
5 changed files with 26 additions and 23 deletions

View file

@ -53,7 +53,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
status = 0
# Check video files for corruption
for video in listMediaFiles(inputDirectory):
if nzbtomedia.FFPROBE and not Transcoder().isVideoGood(video):
if not Transcoder().isVideoGood(video):
status = 1
logger.info("Calling autoProcessTV to post-process: %s",inputName)
@ -196,7 +196,7 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
# Check video files for corruption
for video in listMediaFiles(inputDirectory):
if nzbtomedia.FFPROBE and not Transcoder().isVideoGood(video):
if not Transcoder().isVideoGood(video):
status = 1
if nzbtomedia.CFG['CouchPotato'][inputCategory]:

View file

@ -2,14 +2,22 @@
# For more information, visit https://github.com/clinton-hall/nzbToMedia/wiki
[General]
# Enable/Disable update notifications
version_notify = 1
# Enable/Disable automatic updates
auto_update = 0
# Set to where your git executable is located
git_path =
# GitHUB user for repo
git_user =
# GitHUB branch for repo
git_branch =
force_clean = 0
# Enable/Disable logging debug messages to nzbtomedia.log
log_debug = 0
# Set to where your ffmpeg/ffprobe executables are located
ffmpeg_path =
[CouchPotato]
#### autoProcessing for Movies
#### movie - category that gets called for post-processing with CPS
@ -169,8 +177,6 @@
[Transcoder]
transcode = 0
# Set ffmpeg_path to the location where ffmpeg is located
ffmpeg_path =
###### duplicate =1 will cretae a new file. =0 will replace the original
duplicate = 1
# Only works on Linux. Highest priority is -20, lowest priority is 19.

View file

@ -292,7 +292,7 @@ def process(nzbDir, inputName=None, status=0, clientAgent='manual', download_id=
if section:
# Check video files for corruption
for video in listMediaFiles(nzbDir):
if nzbtomedia.FFPROBE and not Transcoder().isVideoGood(video):
if not Transcoder().isVideoGood(video):
status = 1
logger.info("Sending %s to %s for post-processing ..." % (inputName, str(section).upper()))

View file

@ -14,6 +14,10 @@ class Transcoder:
else:
bitbucket = open('/dev/null')
if not nzbtomedia.FFPROBE:
logger.error("Cannot detect corrupt video files!, set your ffmpeg_path in your autoProcessMedia.cfg ...")
return False
command = [nzbtomedia.FFPROBE, videofile]
try:
logger.info('Checking if %s has any corruption, please stand by ...' % (videofile))
@ -35,6 +39,10 @@ class Transcoder:
else:
bitbucket = open('/dev/null')
if not nzbtomedia.FFMPEG:
logger.error("Cannot transcode files!, set your ffmpeg_path in your autoProcessMedia.cfg ...")
return 1
logger.info("Checking for files to be transcoded")
final_result = 0 # initialize as successful
for file in listMediaFiles(dirName):

View file

@ -195,6 +195,7 @@ def initialize(section=None):
GIT_USER = CFG['General']['git_user'] or 'clinton-hall'
GIT_BRANCH = CFG['General']['git_branch'] or 'dev'
FORCE_CLEAN = CFG["General"]["force_clean"]
FFMPEG_PATH = CFG["General"]["ffmpeg_path"]
# Check for updates via GitHUB
if versionCheck.CheckVersion().check_for_new_version():
@ -245,7 +246,6 @@ def initialize(section=None):
SAMPLEIDS = (CFG["Extensions"]["SampleIDs"]) # sample,-s.
TRANSCODE = int(CFG["Transcoder"]["transcode"])
FFMPEG_PATH = CFG["Transcoder"]["ffmpeg_path"]
DUPLICATE = int(CFG["Transcoder"]["duplicate"])
IGNOREEXTENSIONS = (CFG["Transcoder"]["ignoreExtensions"])
OUTPUTVIDEOEXTENSION = CFG["Transcoder"]["outputVideoExtension"].strip()
@ -265,35 +265,24 @@ def initialize(section=None):
FFMPEG = os.path.join(FFMPEG_PATH, 'ffmpeg.exe')
FFPROBE = os.path.join(FFMPEG_PATH, 'ffprobe.exe')
if TRANSCODE and not os.path.isfile(FFMPEG): # problem
logger.error("%s not found, insure that it does exist and that you've set the correct ffmpeg_path in your autoProcessMedia.cfg" % FFMPEG)
logger.error("Cannot transcode files, disabling transcoding!")
TRANSCODE = 0
FFMPEG = None
if not os.path.isfile(FFPROBE): # problem
logger.error(
"%s not found, insure that it does exist and that you've set the correct ffmpeg_path in your autoProcessMedia.cfg" % FFPROBE)
logger.error("Cannot detect corrupt video files, disabling!")
FFPROBE = None
else:
bitbucket = open('/dev/null')
FFMPEG = 'ffmpeg'
FFPROBE = 'ffprobe'
if subprocess.call(['which', 'ffmpeg']) != 0:
if TRANSCODE and subprocess.call(['which', 'ffmpeg']) != 0 or subprocess.call(['which', 'ffprobe']) != 0:
res = subprocess.call([os.path.join(PROGRAM_DIR, 'getffmpeg.sh')], stdout=bitbucket, stderr=bitbucket)
if res or subprocess.call(['which', 'ffmpeg'], stdout=bitbucket, stderr=bitbucket) != 0: # did not install or ffmpeg still not found.
if res: # did not install or ffmpeg still not found.
logger.error("Failed to install ffmpeg. Please install manually")
logger.info("Cannot transcode video files, disabling transcoding!")
TRANSCODE = 0
if subprocess.call(['which', 'ffmpeg'], stdout=bitbucket, stderr=bitbucket) != 0:
FFMPEG = None
if subprocess.call(['which', 'ffprobe']) != 0:
res = subprocess.call([os.path.join(PROGRAM_DIR, 'getffmpeg.sh')], stdout=bitbucket, stderr=bitbucket)
if res or subprocess.call(['which', 'ffprobe'], stdout=bitbucket, stderr=bitbucket) != 0:
logger.error("Failed to install ffprobe. Please install manually")
logger.info("Cannot detect corrupt video files, disabling corrupt video detection!")
if subprocess.call(['which', 'ffprobe'], stdout=bitbucket, stderr=bitbucket) != 0:
FFPROBE = None
USER_SCRIPT_CATEGORIES = CFG["UserScript"]["user_script_categories"]