added NZBDrone fork test and FFProbe path check. fixes #367

This commit is contained in:
clinton-hall 2014-05-03 20:04:15 +09:30
commit 37a8b5aca1
3 changed files with 34 additions and 8 deletions

View file

@ -324,14 +324,20 @@ def initialize(section=None):
FFPROBE = subprocess.Popen(['which', 'ffprobe'], stdout=subprocess.PIPE).communicate()[0].strip()
if not FFMPEG:
FFMPEG = None
logger.warning("Failed to locate ffmpeg, transcoding disabled!")
logger.warning("Install ffmpeg with x264 support to enable this feature ...")
if os.access(os.path.join(FFMPEG_PATH, 'ffmpeg'), os.X_OK):
FFMPEG = os.path.join(FFMPEG_PATH, 'ffmpeg')
else:
FFMPEG = None
logger.warning("Failed to locate ffmpeg, transcoding disabled!")
logger.warning("Install ffmpeg with x264 support to enable this feature ...")
if not FFPROBE:
FFPROBE = None
logger.warning("Failed to locate ffprobe, video corruption detection disabled!")
logger.warning("Install ffmpeg with x264 support to enable this feature ...")
if os.access(os.path.join(FFMPEG_PATH, 'ffprobe'), os.X_OK):
FFPROBE = os.path.join(FFMPEG_PATH, 'ffprobe')
else:
FFPROBE = None
logger.warning("Failed to locate ffprobe, video corruption detection disabled!")
logger.warning("Install ffmpeg with x264 support to enable this feature ...")
# userscript
map(USER_SCRIPT_CATEGORIES.append, ([subsections[0] for subsections in CFG['UserScript'].items()]))

View file

@ -107,7 +107,7 @@ class autoProcessTV:
if status == 0:
logger.postprocess("SUCCESS: The download succeeded, sending a post-process request", section)
else:
if fork in nzbtomedia.SICKBEARD_FAILED:
if fork in nzbtomedia.SICKBEARD_FAILED or section == "NzbDrone":
logger.postprocess("FAILED: The download failed. Sending 'failed' process request to %s branch" % (fork), section)
else:
logger.postprocess("FAILED: The download failed. %s branch does not handle failed downloads. Nothing to process" % (fork), section)

View file

@ -20,6 +20,11 @@ def autoFork(section, inputCategory):
username = None
password = None
try:
apikey = nzbtomedia.CFG[section][inputCategory]["apikey"]
except:
apikey = None
try:
ssl = int(nzbtomedia.CFG[section][inputCategory]["ssl"])
except:
@ -41,7 +46,22 @@ def autoFork(section, inputCategory):
protocol = "http://"
detected = False
if fork == "auto":
if section == "NzbDrone":
logger.info("Attempting to verify %s fork" % inputCategory)
url = "%s%s:%s%s/api/rootfolder" % (protocol,host,port,web_root)
headers={"X-Api-Key": apikey}
try:
r = requests.get(url, headers=headers, stream=True, verify=False)
except requests.ConnectionError:
logger.info("Could not connect to %s:%s to verify fork!" % (section, inputCategory))
break
if r.ok:
fork = ['default', {}]
else:
logger.info("Connection to %s:%s failed! Check your configuration" % (section, inputCategory))
elif fork == "auto":
logger.info("Attempting to auto-detect %s fork" % inputCategory)
for fork in sorted(nzbtomedia.FORKS.iteritems(), reverse=False):
url = "%s%s:%s%s/home/postprocess/processEpisode?%s" % (protocol,host,port,web_root,urllib.urlencode(fork[1]))