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,11 +324,17 @@ def initialize(section=None):
FFPROBE = subprocess.Popen(['which', 'ffprobe'], stdout=subprocess.PIPE).communicate()[0].strip() FFPROBE = subprocess.Popen(['which', 'ffprobe'], stdout=subprocess.PIPE).communicate()[0].strip()
if not FFMPEG: if not FFMPEG:
if os.access(os.path.join(FFMPEG_PATH, 'ffmpeg'), os.X_OK):
FFMPEG = os.path.join(FFMPEG_PATH, 'ffmpeg')
else:
FFMPEG = None FFMPEG = None
logger.warning("Failed to locate ffmpeg, transcoding disabled!") logger.warning("Failed to locate ffmpeg, transcoding disabled!")
logger.warning("Install ffmpeg with x264 support to enable this feature ...") logger.warning("Install ffmpeg with x264 support to enable this feature ...")
if not FFPROBE: if not FFPROBE:
if os.access(os.path.join(FFMPEG_PATH, 'ffprobe'), os.X_OK):
FFPROBE = os.path.join(FFMPEG_PATH, 'ffprobe')
else:
FFPROBE = None FFPROBE = None
logger.warning("Failed to locate ffprobe, video corruption detection disabled!") logger.warning("Failed to locate ffprobe, video corruption detection disabled!")
logger.warning("Install ffmpeg with x264 support to enable this feature ...") logger.warning("Install ffmpeg with x264 support to enable this feature ...")

View file

@ -107,7 +107,7 @@ class autoProcessTV:
if status == 0: if status == 0:
logger.postprocess("SUCCESS: The download succeeded, sending a post-process request", section) logger.postprocess("SUCCESS: The download succeeded, sending a post-process request", section)
else: 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) logger.postprocess("FAILED: The download failed. Sending 'failed' process request to %s branch" % (fork), section)
else: else:
logger.postprocess("FAILED: The download failed. %s branch does not handle failed downloads. Nothing to process" % (fork), section) 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 username = None
password = None password = None
try:
apikey = nzbtomedia.CFG[section][inputCategory]["apikey"]
except:
apikey = None
try: try:
ssl = int(nzbtomedia.CFG[section][inputCategory]["ssl"]) ssl = int(nzbtomedia.CFG[section][inputCategory]["ssl"])
except: except:
@ -41,7 +46,22 @@ def autoFork(section, inputCategory):
protocol = "http://" protocol = "http://"
detected = False 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) logger.info("Attempting to auto-detect %s fork" % inputCategory)
for fork in sorted(nzbtomedia.FORKS.iteritems(), reverse=False): 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])) url = "%s%s:%s%s/home/postprocess/processEpisode?%s" % (protocol,host,port,web_root,urllib.urlencode(fork[1]))