mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-16 02:02:53 -07:00
added TPB and multiple fork handling. # 187
This commit is contained in:
parent
65517ddef3
commit
7f51f15d8c
6 changed files with 42 additions and 17 deletions
|
@ -36,6 +36,13 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
extractionSuccess = False
|
extractionSuccess = False
|
||||||
|
|
||||||
Logger.debug("MAIN: Received Directory: %s | Name: %s | Category: %s", inputDirectory, inputName, inputCategory)
|
Logger.debug("MAIN: Received Directory: %s | Name: %s | Category: %s", inputDirectory, inputName, inputCategory)
|
||||||
|
if sbFork == TPB and inputCategory == sbCategory:
|
||||||
|
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName)
|
||||||
|
result = autoProcessTV.processEpisode(inputDirectory, inputName, int(0))
|
||||||
|
if result == 1:
|
||||||
|
Logger.info("MAIN: A problem was reported in the autoProcess* script. If torrent was pasued we will resume seeding")
|
||||||
|
Logger.info("MAIN: All done.")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
inputDirectory, inputName, inputCategory, root = category_search(inputDirectory, inputName, inputCategory, root, categories) # Confirm the category by parsing directory structure
|
inputDirectory, inputName, inputCategory, root = category_search(inputDirectory, inputName, inputCategory, root, categories) # Confirm the category by parsing directory structure
|
||||||
|
|
||||||
|
@ -261,8 +268,8 @@ if __name__ == "__main__":
|
||||||
uTorrentUSR = config.get("Torrent", "uTorrentUSR") # mysecretusr
|
uTorrentUSR = config.get("Torrent", "uTorrentUSR") # mysecretusr
|
||||||
uTorrentPWD = config.get("Torrent", "uTorrentPWD") # mysecretpwr
|
uTorrentPWD = config.get("Torrent", "uTorrentPWD") # mysecretpwr
|
||||||
|
|
||||||
TransmissionHost = config.get("Torrent", "TransmissionHost") # localhost
|
TransmissionHost = config.get("Torrent", "TransmissionHost") # localhost
|
||||||
TransmissionPort = config.get("Torrent", "TransmissionPort") # 8084
|
TransmissionPort = config.get("Torrent", "TransmissionPort") # 8084
|
||||||
TransmissionUSR = config.get("Torrent", "TransmissionUSR") # mysecretusr
|
TransmissionUSR = config.get("Torrent", "TransmissionUSR") # mysecretusr
|
||||||
TransmissionPWD = config.get("Torrent", "TransmissionPWD") # mysecretpwr
|
TransmissionPWD = config.get("Torrent", "TransmissionPWD") # mysecretpwr
|
||||||
|
|
||||||
|
@ -275,6 +282,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
cpsCategory = config.get("CouchPotato", "cpsCategory") # movie
|
cpsCategory = config.get("CouchPotato", "cpsCategory") # movie
|
||||||
sbCategory = config.get("SickBeard", "sbCategory") # tv
|
sbCategory = config.get("SickBeard", "sbCategory") # tv
|
||||||
|
sbFork = config.get("SickBeard", "fork") # tv
|
||||||
hpCategory = config.get("HeadPhones", "hpCategory") # music
|
hpCategory = config.get("HeadPhones", "hpCategory") # music
|
||||||
mlCategory = config.get("Mylar", "mlCategory") # comics
|
mlCategory = config.get("Mylar", "mlCategory") # comics
|
||||||
gzCategory = config.get("Gamez", "gzCategory") # games
|
gzCategory = config.get("Gamez", "gzCategory") # games
|
||||||
|
|
|
@ -94,9 +94,9 @@ def processEpisode(dirName, nzbName=None, failed=False):
|
||||||
watch_dir = ""
|
watch_dir = ""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
failed_fork = int(config.get("SickBeard", "failed_fork"))
|
fork = int(config.get("SickBeard", "fork"))
|
||||||
except (ConfigParser.NoOptionError, ValueError):
|
except (ConfigParser.NoOptionError, ValueError):
|
||||||
failed_fork = 0
|
fork = "default"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
transcode = int(config.get("Transcoder", "transcode"))
|
transcode = int(config.get("Transcoder", "transcode"))
|
||||||
|
@ -116,9 +116,10 @@ def processEpisode(dirName, nzbName=None, failed=False):
|
||||||
mediaContainer = (config.get("Extensions", "mediaExtensions")).split(',')
|
mediaContainer = (config.get("Extensions", "mediaExtensions")).split(',')
|
||||||
minSampleSize = int(config.get("Extensions", "minSampleSize"))
|
minSampleSize = int(config.get("Extensions", "minSampleSize"))
|
||||||
|
|
||||||
process_all_exceptions(nzbName.lower(), dirName)
|
if fork != "TPB":
|
||||||
|
process_all_exceptions(nzbName.lower(), dirName)
|
||||||
|
|
||||||
if nzbName != "Manual Run":
|
if nzbName != "Manual Run" and fork != "TPB":
|
||||||
# Now check if movie files exist in destination:
|
# Now check if movie files exist in destination:
|
||||||
video = int(0)
|
video = int(0)
|
||||||
for dirpath, dirnames, filenames in os.walk(dirName):
|
for dirpath, dirnames, filenames in os.walk(dirName):
|
||||||
|
@ -146,7 +147,7 @@ def processEpisode(dirName, nzbName=None, failed=False):
|
||||||
params['quiet'] = 1
|
params['quiet'] = 1
|
||||||
|
|
||||||
# if you have specified you are using development branch from fork https://github.com/Tolstyak/Sick-Beard.git
|
# if you have specified you are using development branch from fork https://github.com/Tolstyak/Sick-Beard.git
|
||||||
if failed_fork:
|
if fork == "failed":
|
||||||
params['dirName'] = dirName
|
params['dirName'] = dirName
|
||||||
if nzbName != None:
|
if nzbName != None:
|
||||||
params['nzbName'] = nzbName
|
params['nzbName'] = nzbName
|
||||||
|
@ -156,9 +157,19 @@ def processEpisode(dirName, nzbName=None, failed=False):
|
||||||
else:
|
else:
|
||||||
Logger.info("The download failed. Sending 'failed' process request to SickBeard's failed branch")
|
Logger.info("The download failed. Sending 'failed' process request to SickBeard's failed branch")
|
||||||
|
|
||||||
|
# if you have specified you are using development branch from fork https://github.com/Tolstyak/Sick-Beard.git
|
||||||
|
if fork == "TPB":
|
||||||
|
params['dirName'] = dirName
|
||||||
|
if nzbName != None:
|
||||||
|
params['nzbName'] = nzbName
|
||||||
|
params['failed'] = failed
|
||||||
|
if status == 0:
|
||||||
|
Logger.info("The download succeeded. Sending process request to SickBeard's failed branch")
|
||||||
|
else:
|
||||||
|
Logger.info("The download failed. Sending 'failed' process request to SickBeard's failed branch")
|
||||||
|
|
||||||
# this is our default behaviour to work with the standard Master branch of SickBeard
|
# this is our default behaviour to work with the standard Master branch of SickBeard
|
||||||
else:
|
elif fork == "default":
|
||||||
params['dir'] = dirName
|
params['dir'] = dirName
|
||||||
if nzbName != None:
|
if nzbName != None:
|
||||||
params['nzbName'] = nzbName
|
params['nzbName'] = nzbName
|
||||||
|
|
|
@ -54,6 +54,12 @@ def migrate():
|
||||||
option, value = item
|
option, value = item
|
||||||
if option == "category": # change this old format
|
if option == "category": # change this old format
|
||||||
option = "sbCategory"
|
option = "sbCategory"
|
||||||
|
if option == "failed_fork": # change this old format
|
||||||
|
option = "fork"
|
||||||
|
if int(value) == 1:
|
||||||
|
value = "failed"
|
||||||
|
else:
|
||||||
|
value = "default"
|
||||||
if option == "outputDirectory": # move this to new location format
|
if option == "outputDirectory": # move this to new location format
|
||||||
value = os.path.split(os.path.normpath(value))[0]
|
value = os.path.split(os.path.normpath(value))[0]
|
||||||
confignew.set("Torrent", option, value)
|
confignew.set("Torrent", option, value)
|
||||||
|
@ -242,8 +248,8 @@ def addnzbget():
|
||||||
|
|
||||||
|
|
||||||
section = "SickBeard"
|
section = "SickBeard"
|
||||||
envKeys = ['CATEGORY', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FAILED_FORK']
|
envKeys = ['CATEGORY', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK']
|
||||||
cfgKeys = ['sbCategory', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'failed_fork']
|
cfgKeys = ['sbCategory', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork']
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_SB' + envKeys[index]
|
key = 'NZBPO_SB' + envKeys[index]
|
||||||
if os.environ.has_key(key):
|
if os.environ.has_key(key):
|
||||||
|
|
|
@ -32,7 +32,7 @@ web_root =
|
||||||
ssl = 0
|
ssl = 0
|
||||||
delay = 0
|
delay = 0
|
||||||
watch_dir =
|
watch_dir =
|
||||||
failed_fork = 0
|
fork = default
|
||||||
delete_failed = 0
|
delete_failed = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -92,10 +92,10 @@
|
||||||
# set this if SickBeard and nzbGet are on different systems.
|
# set this if SickBeard and nzbGet are on different systems.
|
||||||
#sbwatch_dir=
|
#sbwatch_dir=
|
||||||
|
|
||||||
# SickBeard uses failed fork (0, 1).
|
# SickBeard fork.
|
||||||
#
|
#
|
||||||
# set to 1 if using the custom "failed fork". Default sickBeard uses 0.
|
# set to default or TPB or failed if using the custom "TPB" or "failed fork".
|
||||||
#sbfailed_fork=0
|
#sbfork=default
|
||||||
|
|
||||||
# SickBeard Delete Failed Downloads (0, 1)
|
# SickBeard Delete Failed Downloads (0, 1)
|
||||||
#
|
#
|
||||||
|
|
|
@ -46,10 +46,10 @@
|
||||||
# set this if SickBeard and nzbGet are on different systems.
|
# set this if SickBeard and nzbGet are on different systems.
|
||||||
#sbwatch_dir=
|
#sbwatch_dir=
|
||||||
|
|
||||||
# SickBeard uses failed fork (0, 1).
|
# SickBeard fork.
|
||||||
#
|
#
|
||||||
# set to 1 if using the custom "failed fork". Default sickBeard uses 0.
|
# set to default or TPB or failed if using the custom "TPB" or "failed fork".
|
||||||
#sbfailed_fork=0
|
#sbfork=default
|
||||||
|
|
||||||
# SickBeard Delete Failed Downloads (0, 1).
|
# SickBeard Delete Failed Downloads (0, 1).
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue