mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-16 02:02:53 -07:00
improve passing of download_id
This commit is contained in:
parent
ded99d40f1
commit
3b076a5cfa
15 changed files with 93 additions and 42 deletions
|
@ -170,7 +170,13 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
|||
|
||||
if inputCategory == cpsCategory:
|
||||
Logger.info("MAIN: Calling CouchPotatoServer to post-process: %s", inputName)
|
||||
result = autoProcessMovie.process(outputDestination, inputName, status, clientAgent, inputHash)
|
||||
if clientAgent == 'utorrent' and inputHash != '':
|
||||
download_id = 'uTorrent_' + inputHash
|
||||
elif clientAgent == 'transmission' and inputHash != '':
|
||||
download_id = 'Transmission_' + inputHash
|
||||
else:
|
||||
download_id = inputHash
|
||||
result = autoProcessMovie.process(outputDestination, inputName, status, clientAgent, download_id)
|
||||
elif inputCategory == sbCategory:
|
||||
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName)
|
||||
result = autoProcessTV.processEpisode(outputDestination, inputName, status)
|
||||
|
|
|
@ -34,21 +34,26 @@ class AuthURLOpener(urllib.FancyURLopener):
|
|||
|
||||
def get_imdb(nzbName, dirName):
|
||||
|
||||
a=nzbName.find('.cp(')+4 #search for .cptt( in nzbName
|
||||
b=nzbName[a:].find(')')+a
|
||||
imdbid=nzbName[a:b]
|
||||
imdbid = ""
|
||||
|
||||
a = nzbName.find('.cp(') + 4 #search for .cptt( in nzbName
|
||||
b = nzbName[a:].find(')') + a
|
||||
if a > 3: # a == 3 if not exist
|
||||
imdbid = nzbName[a:b]
|
||||
|
||||
if imdbid:
|
||||
Logger.info("Found movie id %s in name", imdbid)
|
||||
return imdbid
|
||||
|
||||
a=dirName.find('.cp(')+4 #search for .cptt( in dirname
|
||||
b=dirName[a:].find(')')+a
|
||||
imdbid=dirName[a:b]
|
||||
a = dirName.find('.cp(') + 4 #search for .cptt( in dirname
|
||||
b = dirName[a:].find(')') + a
|
||||
if a > 3: # a == 3 if not exist
|
||||
imdbid = dirName[a:b]
|
||||
|
||||
if imdbid:
|
||||
Logger.info("Found movie id %s in directory", imdbid)
|
||||
return imdbid
|
||||
|
||||
else:
|
||||
Logger.warning("Could not find an imdb id in directory or name")
|
||||
Logger.info("Postprocessing will continue, but the movie may not be identified correctly by CouchPotato")
|
||||
|
@ -78,7 +83,7 @@ def get_movie_info(myOpener, baseURL, imdbid, download_id):
|
|||
if not imdbid:
|
||||
movieindex = [index for index in range(len(movieid)) if len(releases[index]) > 0]
|
||||
for index in movieindex:
|
||||
releaseindex = [index2 for index2 in range(len(releases[index])) if len(releases[index][index2]) > 0 and "download_id" in releases[index][index2]["info"] and releases[index][index2]["info"]["download_id"] == download_id]
|
||||
releaseindex = [index2 for index2 in range(len(releases[index])) if len(releases[index][index2]) > 0 and "download_id" in releases[index][index2]["info"] and releases[index][index2]["info"]["download_id"].lower() == download_id.lower()]
|
||||
if len(releaseindex) > 0:
|
||||
imdbid_list.append(library[index])
|
||||
unique_imdbid_list = list(set(imdbid_list)) # convert this to a unique list to be sure we only have one imdbid
|
||||
|
@ -124,8 +129,8 @@ def get_status(myOpener, baseURL, movie_id, clientAgent, download_id):
|
|||
try:
|
||||
release_status = "none"
|
||||
if download_id != "" and download_id != "none": # we have the download id from the downloader. Let's see if it's valid.
|
||||
release_statuslist = [item["status"]["identifier"] for item in result["movie"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"] == download_id]
|
||||
clientAgentlist = [item["info"]["download_downloader"] for item in result["movie"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"] == download_id]
|
||||
release_statuslist = [item["status"]["identifier"] for item in result["movie"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower()]
|
||||
clientAgentlist = [item["info"]["download_downloader"] for item in result["movie"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower()]
|
||||
if len(release_statuslist) == 1: # we have found a release by this id. :)
|
||||
release_status = release_statuslist[0]
|
||||
clientAgent = clientAgentlist[0]
|
||||
|
@ -135,7 +140,7 @@ def get_status(myOpener, baseURL, movie_id, clientAgent, download_id):
|
|||
clients = [item for item in clientAgentlist if item.lower() == clientAgent.lower()]
|
||||
clientAgent = clients[0]
|
||||
if len(clients) == 1: # ok.. a unique entry for download_id and clientAgent ;)
|
||||
release_status = [item["status"]["identifier"] for item in result["movie"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"] == download_id and item["info"]["download_downloader"] == clientAgent][0]
|
||||
release_status = [item["status"]["identifier"] for item in result["movie"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower() and item["info"]["download_downloader"] == clientAgent][0]
|
||||
Logger.debug("Found a single release for download_id: %s and clientAgent: %s. Release status is: %s", download_id, clientAgent, release_status)
|
||||
else: # doesn't matter. only really used as secondary confirmation of movie status change. Let's continue.
|
||||
Logger.debug("Found several releases for download_id: %s and clientAgent: %s. Cannot determine the release status", download_id, clientAgent)
|
||||
|
@ -161,9 +166,10 @@ def get_status(myOpener, baseURL, movie_id, clientAgent, download_id):
|
|||
download_id = "none"
|
||||
release_status = "none"
|
||||
else:
|
||||
index = [index for index in range(len(clientAgentlist)) if clientAgentlist[index] == clientAgent]
|
||||
index = [index for index in range(len(clientAgentlist)) if clientAgentlist[index].lower() == clientAgent.lower()]
|
||||
if len(index) == 1:
|
||||
download_id = download_idlist[index[0]]
|
||||
clientAgent = clientAgentlist[index[0]]
|
||||
release_status = "snatched"
|
||||
Logger.debug("Found download_id: %s for clientAgent: %s. Release status is: %s", download_id, clientAgent, release_status)
|
||||
else:
|
||||
|
@ -269,9 +275,9 @@ def process(dirName, nzbName=None, status=0, clientAgent = "manual", download_id
|
|||
result = json.load(urlObj)
|
||||
Logger.info("CouchPotatoServer returned %s", result)
|
||||
if result['success']:
|
||||
Logger.info("%s started on CouchPotatoServer for %s", command, nzbName)
|
||||
Logger.info("%s scan started on CouchPotatoServer for %s", method, nzbName)
|
||||
else:
|
||||
Logger.error("%s has NOT started on CouchPotatoServer for %s. Exiting", command, nzbName)
|
||||
Logger.error("%s scan has NOT started on CouchPotatoServer for %s. Exiting", method, nzbName)
|
||||
return 1 # failure
|
||||
|
||||
else:
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# Make things easy and less error prone by centralising all common values
|
||||
|
||||
# Global Constants
|
||||
VERSION = 'V7.1'
|
||||
VERSION = 'V7.2'
|
||||
|
||||
# Constants pertinant to SabNzb
|
||||
SABNZB_NO_OF_ARGUMENTS = 8
|
||||
|
||||
# Constants pertinant to NzbGet
|
||||
NZBGET_NO_OF_ARGUMENTS = 5
|
||||
NZBGET_NO_OF_ARGUMENTS = 6
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
Change_LOG / History
|
||||
|
||||
V7.2 XX/04/2013
|
||||
|
||||
Impacts All
|
||||
Added download_id pass through for CouchPotato release matching
|
||||
Uses single directory scanning for CouchPotato renamer
|
||||
Matches imdb_id, download_id, clientAgent with CPS database
|
||||
|
||||
Impacts NZB
|
||||
Fixed TLS support for NZBGet email notifications
|
||||
|
||||
V7.1 28/03/2013
|
||||
|
||||
Impacts Torrents
|
||||
|
|
|
@ -39,9 +39,11 @@ elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
|
|||
# 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
|
||||
# 4 The category of the download:
|
||||
# 5 The download_id
|
||||
Logger.info("Script triggered from NZBGet, starting autoProcessMovie...")
|
||||
clientAgent = "nzbget"
|
||||
result = autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[3], clientAgent)
|
||||
result = autoProcessMovie.process(sys.argv[1], sys.argv[2], sys.argv[3], clientAgent, sys.argv[5])
|
||||
else:
|
||||
Logger.warn("Invalid number of arguments received from client.")
|
||||
Logger.info("Running autoProcessMovie as a manual run...")
|
||||
|
|
|
@ -38,6 +38,8 @@ elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
|
|||
# 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
|
||||
# 4 The category of the download:
|
||||
# 5 The download_id
|
||||
Logger.info("Script triggered from NZBGet, starting autoProcessGames...")
|
||||
result = autoProcessGames.process(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||
else:
|
||||
|
|
|
@ -38,6 +38,8 @@ elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
|
|||
# 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
|
||||
# 4 The category of the download:
|
||||
# 5 The download_id
|
||||
Logger.info("Script triggered from NZBGet, starting autoProcessMusic...")
|
||||
result = autoProcessMusic.process(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||
else:
|
||||
|
|
|
@ -51,26 +51,27 @@ if len(sys.argv) == SABNZB_NO_OF_ARGUMENTS:
|
|||
# 7 Status of post processing. 0 = OK, 1=failed verification, 2=failed unpack, 3=1+2
|
||||
Logger.info("MAIN: Script triggered from SABnzbd")
|
||||
clientAgent = "sabnzbd"
|
||||
nzbDir, inputName, status, inputCategory = (sys.argv[1], sys.argv[2], sys.argv[7], sys.argv[5])
|
||||
nzbDir, inputName, status, inputCategory, download_id = (sys.argv[1], sys.argv[2], sys.argv[7], sys.argv[5], '')
|
||||
# NZBGet
|
||||
elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
|
||||
# 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
|
||||
# 4 User-defined category
|
||||
# 4 The category of the download:
|
||||
# 5 The download_id
|
||||
Logger.info("MAIN: Script triggered from NZBGet")
|
||||
clientAgent = "nzbget"
|
||||
nzbDir, inputName, status, inputCategory = (sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
|
||||
nzbDir, inputName, status, inputCategory, download_id = (sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
|
||||
else: # only CPS supports this manual run for now.
|
||||
Logger.warn("MAIN: Invalid number of arguments received from client.")
|
||||
Logger.info("MAIN: Running autoProcessMovie as a manual run...")
|
||||
clientAgent = "manual"
|
||||
nzbDir, inputName, status, inputCategory = ('Manual Run', 'Manual Run', 0, cpsCategory)
|
||||
nzbDir, inputName, status, inputCategory, download_id = ('Manual Run', 'Manual Run', 0, cpsCategory, '')
|
||||
|
||||
if inputCategory == cpsCategory:
|
||||
Logger.info("MAIN: Calling CouchPotatoServer to post-process: %s", inputName)
|
||||
result = autoProcessMovie.process(nzbDir, inputName, status, clientAgent)
|
||||
result = autoProcessMovie.process(nzbDir, inputName, status, clientAgent, download_id)
|
||||
elif inputCategory == sbCategory:
|
||||
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName)
|
||||
result = autoProcessTV.processEpisode(nzbDir, inputName, status)
|
||||
|
|
|
@ -38,6 +38,8 @@ elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
|
|||
# 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
|
||||
# 4 The category of the download:
|
||||
# 5 The download_id
|
||||
Logger.info("Script triggered from NZBGet, starting autoProcessComics...")
|
||||
result = autoProcessComics.processEpisode(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||
else:
|
||||
|
|
|
@ -60,6 +60,8 @@ elif len(sys.argv) == NZBGET_NO_OF_ARGUMENTS:
|
|||
# 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
|
||||
# 4 The category of the download:
|
||||
# 5 The download_id
|
||||
Logger.info("Script triggered from NZBGet, starting autoProcessTV...")
|
||||
result = autoProcessTV.processEpisode(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||
else:
|
||||
|
|
|
@ -82,9 +82,13 @@ nzbToMedia() {
|
|||
if [ -n "$1" ]; then PostProcessStatus=$1 ; fi
|
||||
if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: comparing '$NZBPP_CATEGORY' to '$CouchPotatoCategory' and '$SickBeardCategory'" | tee -a $tmplog; fi
|
||||
find "$NZBPP_DIRECTORY" -type f -size -200000k -iname \*sample\* -exec rm {} \; >/dev/null 2>&1
|
||||
download_id=""
|
||||
if [ "$NZBPP_CATEGORY" = "$CouchPotatoCategory" ]; then
|
||||
if [ "$CouchPotato" = "yes" -a -e "$NzbToCouchPotato" ]; then
|
||||
script=$NzbToCouchPotato
|
||||
if [ $NZBPR_couchpotato ]; then
|
||||
download_id=$NZBPR_couchpotato
|
||||
fi
|
||||
# Call Couchpotato's postprocessing script
|
||||
echo "[INFO] Post-Process: Running CouchPotato's postprocessing script" | tee -a $tmplog
|
||||
if [ "$Debug" = "yes" ]; then
|
||||
|
@ -93,7 +97,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$CouchPotato" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as it is disabled by user ('$CouchPotato')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToCouchPotato" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as the specified script ('$NzbToCouchPotato') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -110,7 +114,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: SickBeard-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: SickBeard-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$SickBeard" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as it is disabled by user ('$SickBeard')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToSickBeard" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as the specified script ('$NzbToSickBeard') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -127,7 +131,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: HeadPhones-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: HeadPhones-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToHeadPhones "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToHeadPhones "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$HeadPhones" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run HeadPhones' postprocessing script as it is disabled by user ('$HeadPhones')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToHeadPhones" ]; then echo "[DETAIL] Post-Process: Ignored to run HeadPhones' postprocessing script as the specified script ('$NzbToHeadPhones') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -144,7 +148,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: Mylar-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: Mylar-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToMylar "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToMylar "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$Mylar" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run Mylar's postprocessing script as it is disabled by user ('$Mylar')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToMylar" ]; then echo "[DETAIL] Post-Process: Ignored to run Mylar's postprocessing script as the specified script ('$NzbToMylar') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -161,7 +165,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: Gamez-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: Gamez-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToGamez "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToGamez "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$Gamez" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run Gamez's postprocessing script as it is disabled by user ('$Gamez')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToGamez" ]; then echo "[DETAIL] Post-Process: Ignored to run Gamez's postprocessing script as the specified script ('$NzbToGamez') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -178,7 +182,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: Custom-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: Custom-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$CustomCmd $CustomScript "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$CustomCmd $CustomScript "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$Custom" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as it is disabled by user ('$Custom')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$CustomScript" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as the specified script ('$CustomScript') does not exist" | tee -a $tmplog; fi
|
||||
|
|
|
@ -103,9 +103,13 @@ nzbToMedia() {
|
|||
if [ -n "$1" ]; then PostProcessStatus=$1 ; fi
|
||||
if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: comparing '$NZBPP_CATEGORY' to '$CouchPotatoCategory' and '$SickBeardCategory'" | tee -a $tmplog; fi
|
||||
find "$NZBPP_DIRECTORY" -type f -size -200000k -iname \*sample\* -exec rm {} \; >/dev/null 2>&1
|
||||
download_id=""
|
||||
if [ "$NZBPP_CATEGORY" = "$CouchPotatoCategory" ]; then
|
||||
if [ "$CouchPotato" = "yes" -a -e "$NzbToCouchPotato" ]; then
|
||||
script=$NzbToCouchPotato
|
||||
if [ $NZBPR_couchpotato ]; then
|
||||
download_id=$NZBPR_couchpotato
|
||||
fi
|
||||
# Call Couchpotato's postprocessing script
|
||||
echo "[INFO] Post-Process: Running CouchPotato's postprocessing script" | tee -a $tmplog
|
||||
if [ "$Debug" = "yes" ]; then
|
||||
|
@ -114,7 +118,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$CouchPotato" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as it is disabled by user ('$CouchPotato')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToCouchPotato" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as the specified script ('$NzbToCouchPotato') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -131,7 +135,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: SickBeard-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: SickBeard-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$SickBeard" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as it is disabled by user ('$SickBeard')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToSickBeard" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as the specified script ('$NzbToSickBeard') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -148,7 +152,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: Custom-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: Custom-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$CustomCmd $CustomScript "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$CustomCmd $CustomScript "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$Custom" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as it is disabled by user ('$Custom')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$CustomScript" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as the specified script ('$CustomScript') does not exist" | tee -a $tmplog; fi
|
||||
|
|
|
@ -82,9 +82,13 @@ nzbToMedia() {
|
|||
if [ -n "$1" ]; then PostProcessStatus=$1 ; fi
|
||||
if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: comparing '$NZBPP_CATEGORY' to '$CouchPotatoCategory' and '$SickBeardCategory'" | tee -a $tmplog; fi
|
||||
find "$NZBPP_DIRECTORY" -type f -size -200000k -iname \*sample\* -exec rm {} \; >/dev/null 2>&1
|
||||
download_id=""
|
||||
if [ "$NZBPP_CATEGORY" = "$CouchPotatoCategory" ]; then
|
||||
if [ "$CouchPotato" = "yes" -a -e "$NzbToCouchPotato" ]; then
|
||||
script=$NzbToCouchPotato
|
||||
if [ $NZBPR_couchpotato ]; then
|
||||
download_id=$NZBPR_couchpotato
|
||||
fi
|
||||
# Call Couchpotato's postprocessing script
|
||||
echo "[INFO] Post-Process: Running CouchPotato's postprocessing script" | tee -a $tmplog
|
||||
if [ "$Debug" = "yes" ]; then
|
||||
|
@ -93,7 +97,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: CouchPotato-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToCouchPotato "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$CouchPotato" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as it is disabled by user ('$CouchPotato')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToCouchPotato" ]; then echo "[DETAIL] Post-Process: Ignored to run CouchPotato's postprocessing script as the specified script ('$NzbToCouchPotato') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -110,7 +114,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: SickBeard-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: SickBeard-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToSickBeard "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$SickBeard" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as it is disabled by user ('$SickBeard')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToSickBeard" ]; then echo "[DETAIL] Post-Process: Ignored to run SickBeard's postprocessing script as the specified script ('$NzbToSickBeard') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -127,7 +131,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: HeadPhones-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: HeadPhones-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToHeadPhones "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToHeadPhones "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$HeadPhones" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run HeadPhones' postprocessing script as it is disabled by user ('$HeadPhones')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToHeadPhones" ]; then echo "[DETAIL] Post-Process: Ignored to run HeadPhones' postprocessing script as the specified script ('$NzbToHeadPhones') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -144,7 +148,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: Mylar-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: Mylar-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToMylar "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToMylar "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$Mylar" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run Mylar's postprocessing script as it is disabled by user ('$Mylar')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToMylar" ]; then echo "[DETAIL] Post-Process: Ignored to run Mylar's postprocessing script as the specified script ('$NzbToMylar') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -161,7 +165,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: Gamez-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: Gamez-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$PythonCmd $NzbToGamez "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$PythonCmd $NzbToGamez "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$Gamez" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run Gamez's postprocessing script as it is disabled by user ('$Gamez')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$NzbToGamez" ]; then echo "[DETAIL] Post-Process: Ignored to run Gamez's postprocessing script as the specified script ('$NzbToGamez') does not exist" | tee -a $tmplog; fi
|
||||
|
@ -178,7 +182,7 @@ nzbToMedia() {
|
|||
echo "[DETAIL] Post-Process: Custom-Script-ARGV2=$NZBPP_NZBFILENAME" | tee -a $tmplog
|
||||
echo "[DETAIL] Post-Process: Custom-Script-ARGV3=$PostProcessStatus" | tee -a $tmplog
|
||||
fi
|
||||
$CustomCmd $CustomScript "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
$CustomCmd $CustomScript "$NZBPP_DIRECTORY" "$NZBPP_NZBFILENAME" "$PostProcessStatus" "$NZBPP_CATEGORY" "$download_id" | while read line ; do if [ "$line" != "" ] ; then replaceLogLine "${line}" ; fi ; done
|
||||
else
|
||||
if [ "$Custom" != "yes" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as it is disabled by user ('$Custom')" | tee -a $tmplog; fi
|
||||
if [ ! -e "$CustomScript" ]; then echo "[DETAIL] Post-Process: Ignored to run the Custom postprocessing script as the specified script ('$CustomScript') does not exist" | tee -a $tmplog; fi
|
||||
|
|
|
@ -119,7 +119,7 @@ Email_To=
|
|||
Email_Server=
|
||||
|
||||
# Server uses tsl (auto, yes, no).
|
||||
Tsl=auto
|
||||
Tls=auto
|
||||
|
||||
# Enter your smtp server user name (if required)
|
||||
Email_User=
|
||||
|
|
|
@ -83,7 +83,7 @@ def nzbToMedia(nzbStatus):
|
|||
Logger.debug("Post-Process: CouchPotato-Script-ARGV1= %s", NZBPP_DIRECTORY)
|
||||
Logger.debug("Post-Process: CouchPotato-Script-ARGV2= %s", NZBPP_NZBFILENAME)
|
||||
Logger.debug("Post-Process: CouchPotato-Script-ARGV3= %s", PostProcessStatus)
|
||||
result = autoProcessMovie.process(NZBPP_DIRECTORY, NZBPP_NZBFILENAME, PostProcessStatus)
|
||||
result = autoProcessMovie.process(NZBPP_DIRECTORY, NZBPP_NZBFILENAME, PostProcessStatus, clientAgent, download_id)
|
||||
else:
|
||||
Logger.debug("Post-Process: Ignored to run CouchPotato's postprocessing script as it is disabled by user")
|
||||
|
||||
|
@ -188,7 +188,7 @@ def do_exit(Process_Code):
|
|||
if line != "":
|
||||
Email_Message2 = Email_Message2 + "\r\n" + line
|
||||
f.close()
|
||||
command = [sendEmail, "-f", Email_From, "-t", Email_To, "-s", Email_Server, "-o", "tsl=" + Tsl]
|
||||
command = [sendEmail, "-f", Email_From, "-t", Email_To, "-s", Email_Server, "-o", "tls=" + Tls]
|
||||
if Email_User != "" and Email_Pass != "":
|
||||
command.append("-xu")
|
||||
command.append(Email_User)
|
||||
|
@ -211,7 +211,7 @@ def do_exit(Process_Code):
|
|||
if line != "":
|
||||
Email_Message2 = Email_Message2 + "\r\n" + line
|
||||
f.close()
|
||||
command = [sendEmail, "-f", Email_From, "-t", Email_To, "-s", Email_Server, "-o", "tsl=" + Tsl]
|
||||
command = [sendEmail, "-f", Email_From, "-t", Email_To, "-s", Email_Server, "-o", "tls=" + Tls]
|
||||
if Email_User != "" and Email_Pass != "":
|
||||
command.append("-xu")
|
||||
command.append(Email_User)
|
||||
|
@ -276,6 +276,12 @@ NZBPR_PostProcess = os.getenv('NZBPR_PostProcess')
|
|||
NZBPR_DestDir = os.getenv('NZBPR_DestDir')
|
||||
NZBOP_ALLOWREPROCESS = os.getenv('NZBOP_ALLOWREPROCESS')
|
||||
|
||||
clientAgent = "nzbget"
|
||||
try:
|
||||
download_id = os.getenv('NZBPR_couchpotato')
|
||||
except:
|
||||
download_id = ""
|
||||
|
||||
# Name of script's configuration file
|
||||
SCRIPT_CONFIG_FILE = "nzbget-postprocess.conf"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue