mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
fix auto-fork detection. Fixes #501
This commit is contained in:
parent
357d8c4896
commit
5b648be2ea
2 changed files with 24 additions and 20 deletions
|
@ -52,10 +52,11 @@ FORK_DEFAULT = "default"
|
|||
FORK_FAILED = "failed"
|
||||
FORK_FAILED_TORRENT = "failed-torrent"
|
||||
FORK_SICKRAGE = "sickrage"
|
||||
FORKS[FORK_DEFAULT] = {"dir": None, "method": None}
|
||||
FORKS[FORK_DEFAULT] = {"dir": None}
|
||||
FORKS[FORK_FAILED] = {"dirName": None, "failed": None}
|
||||
FORKS[FORK_FAILED_TORRENT] = {"dir": None, "failed": None, "process_method": None}
|
||||
FORKS[FORK_SICKRAGE] = {"dir": None, "failed": None, "process_method": None, "force": None}
|
||||
ALL_FORKS = {"dir": None, "dirName": None, "failed": None, "process_method": None, "force": None}
|
||||
SICKBEARD_FAILED = [FORK_FAILED, FORK_FAILED_TORRENT, FORK_SICKRAGE]
|
||||
SICKBEARD_TORRENT = [FORK_FAILED_TORRENT, FORK_SICKRAGE]
|
||||
|
||||
|
@ -187,7 +188,7 @@ def initialize(section=None):
|
|||
SABNZB_NO_OF_ARGUMENTS, SABNZB_0717_NO_OF_ARGUMENTS, CATEGORIES, TORRENT_CLIENTAGENT, USELINK, OUTPUTDIRECTORY, \
|
||||
NOFLATTEN, UTORRENTPWD, UTORRENTUSR, UTORRENTWEBUI, DELUGEHOST, DELUGEPORT, DELUGEUSR, DELUGEPWD, \
|
||||
TRANSMISSIONHOST, TRANSMISSIONPORT, TRANSMISSIONPWD, TRANSMISSIONUSR, COMPRESSEDCONTAINER, MEDIACONTAINER, \
|
||||
METACONTAINER, SECTIONS, \
|
||||
METACONTAINER, SECTIONS, ALL_FORKS, \
|
||||
__INITIALIZED__, AUTO_UPDATE, APP_FILENAME, USER_DELAY, APP_NAME, TRANSCODE, DEFAULTS, GIT_PATH, GIT_USER, \
|
||||
GIT_BRANCH, GIT_REPO, SYS_ENCODING, NZB_CLIENTAGENT, SABNZBDHOST, SABNZBDPORT, SABNZBDAPIKEY, \
|
||||
DUPLICATE, IGNOREEXTENSIONS, VEXTENSION, OUTPUTVIDEOPATH, PROCESSOUTPUT, VCODEC, VCODEC_ALLOW, VPRESET, \
|
||||
|
|
|
@ -64,10 +64,7 @@ def autoFork(section, inputCategory):
|
|||
logger.info("Attempting to auto-detect %s fork" % inputCategory)
|
||||
# define the order to test. Default must be first since the default fork doesn't reject parameters.
|
||||
# then in order of most unique parameters.
|
||||
for name in [ nzbtomedia.FORK_DEFAULT, nzbtomedia.FORK_FAILED, nzbtomedia.FORK_SICKRAGE, nzbtomedia.FORK_FAILED_TORRENT ]:
|
||||
fork = [name, nzbtomedia.FORKS[name]]
|
||||
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/" % (protocol,host,port,web_root)
|
||||
# attempting to auto-detect fork
|
||||
try:
|
||||
if username and password:
|
||||
|
@ -76,12 +73,18 @@ def autoFork(section, inputCategory):
|
|||
r = requests.get(url, verify=False)
|
||||
except requests.ConnectionError:
|
||||
logger.info("Could not connect to %s:%s to perform auto-fork detection!" % (section, inputCategory))
|
||||
break
|
||||
|
||||
if r.ok:
|
||||
params = nzbtomedia.ALL_FORKS
|
||||
rem_params = []
|
||||
for param in params:
|
||||
if not 'name="%s"' %(param) in r.text:
|
||||
rem_params.append(param)
|
||||
for param in rem_params:
|
||||
params.pop(param)
|
||||
for fork in sorted(nzbtomedia.FORKS.iteritems(), reverse=False):
|
||||
if params == fork[1]:
|
||||
detected = True
|
||||
break
|
||||
|
||||
if detected:
|
||||
logger.info("%s:%s fork auto-detection successful ..." % (section, inputCategory))
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue