mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-22 06:13:19 -07:00
Merge e9965fa043
into a68a5c54b8
This commit is contained in:
commit
12d3bf38c0
2 changed files with 18 additions and 69 deletions
|
@ -42,8 +42,6 @@ class AuthURLOpener(urllib.FancyURLopener):
|
|||
|
||||
|
||||
def processEpisode(dirName, nzbName=None, failed=False):
|
||||
|
||||
status = int(failed)
|
||||
config = ConfigParser.ConfigParser()
|
||||
configFilename = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessTV.cfg")
|
||||
print "Loading config from", configFilename
|
||||
|
@ -60,7 +58,6 @@ def processEpisode(dirName, nzbName=None, failed=False):
|
|||
print "Could not read configuration file: ", str(e)
|
||||
sys.exit(1)
|
||||
|
||||
watch_dir = ""
|
||||
host = config.get("SickBeard", "host")
|
||||
port = config.get("SickBeard", "port")
|
||||
username = config.get("SickBeard", "username")
|
||||
|
@ -75,46 +72,15 @@ def processEpisode(dirName, nzbName=None, failed=False):
|
|||
except ConfigParser.NoOptionError:
|
||||
web_root = ""
|
||||
|
||||
try:
|
||||
watch_dir = config.get("SickBeard", "watch_dir")
|
||||
except ConfigParser.NoOptionError:
|
||||
watch_dir = ""
|
||||
|
||||
try:
|
||||
failed_fork = int(config.get("SickBeard", "failed_fork"))
|
||||
except (ConfigParser.NoOptionError, ValueError):
|
||||
failed_fork = 0
|
||||
|
||||
#allows us to specify the default watch directory and call the postproecssing on another PC with different directory structure.
|
||||
if watch_dir != "":
|
||||
dirName = watch_dir
|
||||
|
||||
params = {}
|
||||
|
||||
params['quiet'] = 1
|
||||
|
||||
# if you have specified you are using development branch from fork https://github.com/Tolstyak/Sick-Beard.git
|
||||
if failed_fork:
|
||||
params['dirName'] = dirName
|
||||
if nzbName != None:
|
||||
params['nzbName'] = nzbName
|
||||
params['failed'] = failed
|
||||
if status:
|
||||
print "The download failed. Sending 'failed' process request to SickBeard's failed branch"
|
||||
else:
|
||||
print "The download succeeded. Sending process request to SickBeard's failed branch"
|
||||
|
||||
# this is our default behaviour to work with the standard Master branch of SickBeard
|
||||
else:
|
||||
params['dir'] = dirName
|
||||
if nzbName != None:
|
||||
params['nzbName'] = nzbName
|
||||
# the standard Master bamch of SickBeard cannot process failed downloads. So Exit here.
|
||||
if status:
|
||||
print "The download failed. Nothing to process"
|
||||
sys.exit()
|
||||
else:
|
||||
print "The download succeeded. Sending process request to SickBeard"
|
||||
params['failed'] = failed
|
||||
|
||||
myOpener = AuthURLOpener(username, password)
|
||||
|
||||
|
|
|
@ -17,18 +17,17 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Edited by Clinton Hall to prevent processing of failed downloads.
|
||||
# Also added suppot for NZBGet. With help from thorli
|
||||
|
||||
|
||||
import sys
|
||||
import autoProcessTV
|
||||
|
||||
print "nzbToSickBeard V4.0"
|
||||
if len(sys.argv) < 8:
|
||||
print "Not enough arguments received from SABnzbd. Please update it."
|
||||
sys.exit()
|
||||
else:
|
||||
autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7])
|
||||
|
||||
# SABnzbd
|
||||
if len(sys.argv) == 8:
|
||||
# SABnzbd argv:
|
||||
# 1 The final directory of the job (full path)
|
||||
# 2 The original name of the NZB file
|
||||
|
@ -36,20 +35,4 @@ if len(sys.argv) == 8:
|
|||
# 4 Indexer's report number (if supported)
|
||||
# 5 User-defined category
|
||||
# 6 Group that the NZB was posted in e.g. alt.binaries.x
|
||||
# 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2
|
||||
print "Script triggered from SABnzbd, starting autoProcessTV..."
|
||||
autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[7])
|
||||
|
||||
# NZBGet
|
||||
elif len(sys.argv) == 4:
|
||||
# NZBGet argv:
|
||||
# 1 The final directory of the job (full path)
|
||||
# 2 The original name of the NZB file
|
||||
# 3 The status of the download: 0 == successful
|
||||
print "Script triggered from NZBGet, starting autoProcessTV..."
|
||||
|
||||
autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||
|
||||
else:
|
||||
print "Invalid number of arguments received from client."
|
||||
sys.exit()
|
||||
# 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+21
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue