mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-22 14:13:33 -07:00
Merge 9969eaa47a
into bb3febaa9c
This commit is contained in:
commit
5927311dca
5 changed files with 39 additions and 35 deletions
|
@ -106,6 +106,11 @@ def processEpisode(dirName, nzbName=None, failed=False, clientAgent=None, inputC
|
|||
except (ConfigParser.NoOptionError, ValueError):
|
||||
nzbExtractionBy = "Downloader"
|
||||
|
||||
try:
|
||||
process_method = config.get(section, "process_method")
|
||||
except ConfigParser.NoOptionError:
|
||||
process_method = None
|
||||
|
||||
TimeOut = 60 * int(wait_for) # SickBeard needs to complete all moving and renaming before returning the log sequence via url.
|
||||
socket.setdefaulttimeout(int(TimeOut)) #initialize socket timeout.
|
||||
|
||||
|
@ -151,17 +156,24 @@ def processEpisode(dirName, nzbName=None, failed=False, clientAgent=None, inputC
|
|||
if watch_dir != "" and (not host in ['localhost', '127.0.0.1'] or nzbName == "Manual Run"):
|
||||
dirName = watch_dir
|
||||
|
||||
# don't have sickbeard display any output
|
||||
params['quiet'] = 1
|
||||
|
||||
for param in copy.copy(params):
|
||||
if param is "failed":
|
||||
params["failed"] = failed
|
||||
params[param] = failed
|
||||
|
||||
if param is "dirName":
|
||||
params["dirName"] = dirName
|
||||
params[param] = dirName
|
||||
|
||||
if param is "dir":
|
||||
params["dir"] = dirName
|
||||
params[param] = dirName
|
||||
|
||||
if param is "process_method":
|
||||
if process_method:
|
||||
params[param] = process_method
|
||||
else:
|
||||
del params[param]
|
||||
|
||||
if param is "process":
|
||||
params["process"] = None
|
||||
|
|
|
@ -305,8 +305,8 @@ def addnzbget():
|
|||
|
||||
|
||||
section = "SickBeard"
|
||||
envKeys = ['CATEGORY', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'DELAY', 'WAIT_FOR']
|
||||
cfgKeys = ['sbCategory', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'delay', 'wait_for']
|
||||
envKeys = ['CATEGORY', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'DELAY', 'WAIT_FOR', 'PROCESS_METHOD']
|
||||
cfgKeys = ['sbCategory', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'delay', 'wait_for', 'process_method']
|
||||
for index in range(len(envKeys)):
|
||||
key = 'NZBPO_SB' + envKeys[index]
|
||||
if os.environ.has_key(key):
|
||||
|
|
|
@ -10,18 +10,14 @@ SABNZB_0717_NO_OF_ARGUMENTS = 9
|
|||
|
||||
# Constants pertaining to SickBeard Branches:
|
||||
fork_default = "default"
|
||||
fork_default_new = "default-new"
|
||||
fork_failed = "failed"
|
||||
fork_failed_new = "failed-new"
|
||||
fork_failed_torrent = "failed-torrent"
|
||||
|
||||
forks = {} # these need to be in order of most unique params first.
|
||||
forks[1] = {'name': fork_failed_torrent, 'params': {"dir": None, "failed": None, "process_method": None}}
|
||||
forks[2] = {'name': fork_failed, 'params': {"dirName": None, "failed": None}}
|
||||
forks[3] = {'name': fork_failed_new, 'params': {"dir": None, "failed": None}}
|
||||
forks[4] = {'name': fork_default_new, 'params': {"dir": None, "process": None}}
|
||||
forks[5] = {'name': fork_default, 'params': {"dir": None}}
|
||||
forks = {}
|
||||
forks[fork_default] = {"dir": None, "process": None}
|
||||
forks[fork_failed] = {"dirName": None, "failed": None}
|
||||
forks[fork_failed_torrent] = {"dir": None, "failed": None, "process_method": None}
|
||||
|
||||
SICKBEARD_FAILED = [fork_failed, fork_failed_torrent, fork_failed_new]
|
||||
SICKBEARD_FAILED = [fork_failed, fork_failed_torrent]
|
||||
SICKBEARD_TORRENT = [fork_failed_torrent]
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ fork = auto
|
|||
delete_failed = 0
|
||||
nzbExtractionBy = Downloader
|
||||
Torrent_ForceLink = 1
|
||||
|
||||
process_method =
|
||||
|
||||
[HeadPhones]
|
||||
#### autoProcessing for Music
|
||||
|
|
|
@ -50,10 +50,12 @@ def autoFork(fork=None):
|
|||
|
||||
try:
|
||||
fork = config.get(section, "fork")
|
||||
if not fork in "auto":
|
||||
fork = forks[fork] \
|
||||
if fork in SICKBEARD_FAILED or SICKBEARD_TORRENT else forks[fork_default]
|
||||
except ConfigParser.NoOptionError:
|
||||
fork = "auto"
|
||||
fork = forks[fork_default]
|
||||
|
||||
if fork in "auto":
|
||||
myOpener = AuthURLOpener(username, password)
|
||||
|
||||
if ssl:
|
||||
|
@ -61,26 +63,20 @@ def autoFork(fork=None):
|
|||
else:
|
||||
protocol = "http://"
|
||||
|
||||
if fork in "auto":
|
||||
Logger.info("Attempting to auto-detect SickBeard fork")
|
||||
for f in forks.iteritems():
|
||||
url = protocol + host + ":" + port + web_root + "/home/postprocess/processEpisode?" + urllib.urlencode(f[1]['params'])
|
||||
url = protocol + host + ":" + port + web_root + "/home/postprocess/processEpisode?" + urllib.urlencode(f[1])
|
||||
|
||||
# attempting to auto-detect fork
|
||||
urlObj = myOpener.openit(url)
|
||||
|
||||
if urlObj.getcode() == 200:
|
||||
Logger.info("SickBeard fork auto-detection successful. Fork set to %s", f[1]['name'])
|
||||
return f[1]['name'], f[1]['params']
|
||||
Logger.info("SickBeard fork auto-detection successful. Fork set to %s", f[0])
|
||||
return f[0], f[1]
|
||||
|
||||
# failed to auto-detect fork
|
||||
Logger.info("SickBeard fork auto-detection failed")
|
||||
|
||||
else: #if not fork in "auto"
|
||||
try:
|
||||
fork = fork if fork in SICKBEARD_FAILED or fork in SICKBEARD_TORRENT else fork_default
|
||||
fork = [f for f in forks.iteritems() if f[1]['name'] == fork][0]
|
||||
except:
|
||||
fork = [f for f in forks.iteritems() if f[1]['name'] == fork_default][0]
|
||||
|
||||
Logger.info("SickBeard fork set to %s", fork[1]['name'])
|
||||
return fork[1]['name'], fork[1]['params']
|
||||
Logger.info("SickBeard fork set to %s", fork[0])
|
||||
return fork[0], fork[1]
|
Loading…
Add table
Add a link
Reference in a new issue