mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
Fixed bugs in nzbTo* scripts.
autoProcessTV now gets movie_id even for previously post-processed movies so that we can skip further post-processing gracefully. Code cleanup misc ...
This commit is contained in:
parent
f9fd1646d6
commit
d2e3275562
11 changed files with 77 additions and 80 deletions
|
@ -210,20 +210,20 @@ elif len(sys.argv) >= nzbtomedia.SABNZB_0717_NO_OF_ARGUMENTS:
|
|||
result = autoProcessMovie().process(sys.argv[1], sys.argv[2], status=sys.argv[7], inputCategory=sys.argv[5], clientAgent = "sabnzbd", download_id='')
|
||||
else:
|
||||
result = 0
|
||||
section = "CouchPotato"
|
||||
|
||||
logger.warning("Invalid number of arguments received from client.")
|
||||
for section, subsection in nzbtomedia.SUBSECTIONS['CouchPotato'].items():
|
||||
for category in subsection:
|
||||
if nzbtomedia.CFG[section][category].isenabled():
|
||||
dirNames = get_dirnames(section, category)
|
||||
for subsection in nzbtomedia.CFG[section]:
|
||||
if nzbtomedia.CFG[section][subsection].isenabled():
|
||||
dirNames = get_dirnames(section, subsection)
|
||||
for dirName in dirNames:
|
||||
logger.postprocess("Running %s:%s as a manual run on folder %s ...", section, category, dirName)
|
||||
results = autoProcessMovie().process(dirName, os.path.basename(dirName), 0, inputCategory=category)
|
||||
logger.postprocess("Running %s:%s as a manual run on folder %s ...", section, subsection, dirName)
|
||||
results = autoProcessMovie().process(dirName, os.path.basename(dirName), 0, inputCategory=subsection)
|
||||
if results != 0:
|
||||
result = results
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, category, dirName)
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, subsection, dirName)
|
||||
else:
|
||||
logger.warning("%s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, category)
|
||||
logger.warning("%s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, subsection)
|
||||
|
||||
if result == 0:
|
||||
logger.postprocess("The script completed successfully.")
|
||||
|
|
|
@ -144,20 +144,20 @@ elif len(sys.argv) >= nzbtomedia.SABNZB_0717_NO_OF_ARGUMENTS:
|
|||
result = autoProcessGames().process(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent, sys.argv[5])
|
||||
else:
|
||||
result = 0
|
||||
section = "Gamez"
|
||||
|
||||
logger.warning("Invalid number of arguments received from client.")
|
||||
for section, subsection in nzbtomedia.SUBSECTIONS['Gamez'].items():
|
||||
for category in subsection:
|
||||
if nzbtomedia.CFG[section][category].isenabled():
|
||||
dirNames = get_dirnames(section, category)
|
||||
for subsection in nzbtomedia.CFG[section]:
|
||||
if nzbtomedia.CFG[section][subsection].isenabled():
|
||||
dirNames = get_dirnames(section, subsection)
|
||||
for dirName in dirNames:
|
||||
logger.postprocess("Running %s:%s as a manual run on folder %s ...", section, category, dirName)
|
||||
results = autoProcessGames().process(dirName, os.path.basename(dirName), 0, inputCategory=category)
|
||||
logger.postprocess("Running %s:%s as a manual run on folder %s ...", section, subsection, dirName)
|
||||
results = autoProcessGames().process(dirName, os.path.basename(dirName), 0, inputCategory=subsection)
|
||||
if results != 0:
|
||||
result = results
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, category, dirName)
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, subsection, dirName)
|
||||
else:
|
||||
logger.warning("%s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, category)
|
||||
logger.warning("%s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, subsection)
|
||||
|
||||
if result == 0:
|
||||
logger.postprocess("The script completed successfully.")
|
||||
|
|
|
@ -154,20 +154,20 @@ elif len(sys.argv) >= nzbtomedia.SABNZB_0717_NO_OF_ARGUMENTS:
|
|||
result = autoProcessMusic().process(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent, sys.argv[5])
|
||||
else:
|
||||
result = 0
|
||||
section = "HeadPhones"
|
||||
|
||||
logger.warning("Invalid number of arguments received from client.")
|
||||
for section, subsection in nzbtomedia.SUBSECTIONS['HeadPhones'].items():
|
||||
for category in subsection:
|
||||
if nzbtomedia.CFG[section][category].isenabled():
|
||||
dirNames = get_dirnames(section, category)
|
||||
for subsection in nzbtomedia.CFG[section]:
|
||||
if nzbtomedia.CFG[section][subsection].isenabled():
|
||||
dirNames = get_dirnames(section, subsection)
|
||||
for dirName in dirNames:
|
||||
logger.postprocess("nzbToHeadPhones running %s:%s as a manual run on folder %s ...", section, category, dirName)
|
||||
results = autoProcessMusic().process(dirName, os.path.basename(dirName), 0, inputCategory=category)
|
||||
logger.postprocess("nzbToHeadPhones running %s:%s as a manual run on folder %s ...", section, subsection, dirName)
|
||||
results = autoProcessMusic().process(dirName, os.path.basename(dirName), 0, inputCategory=subsection)
|
||||
if results != 0:
|
||||
result = results
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, category, dirName)
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, subsection, dirName)
|
||||
else:
|
||||
logger.postprocess("nzbToHeadPhones %s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, category)
|
||||
logger.postprocess("nzbToHeadPhones %s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, subsection)
|
||||
|
||||
if result == 0:
|
||||
logger.postprocess("The autoProcessMusic script completed successfully.")
|
||||
|
|
|
@ -151,20 +151,20 @@ elif len(sys.argv) >= nzbtomedia.SABNZB_0717_NO_OF_ARGUMENTS:
|
|||
result = autoProcessComics().processEpisode(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent, sys.argv[5])
|
||||
else:
|
||||
result = 0
|
||||
section = "Mylar"
|
||||
|
||||
logger.warning("Invalid number of arguments received from client.")
|
||||
section = "Mylar"
|
||||
for category in nzbtomedia.SUBSECTIONS[section]:
|
||||
if nzbtomedia.SUBSECTIONS[section][category].isenabled():
|
||||
dirNames = get_dirnames(section, category)
|
||||
for subsection in nzbtomedia.CFG[section]:
|
||||
if nzbtomedia.CFG[section][subsection].isenabled():
|
||||
dirNames = get_dirnames(section, subsection)
|
||||
for dirName in dirNames:
|
||||
logger.postprocess("nzbToMylar running %s:%s as a manual run on folder %s ...", section, category, dirName)
|
||||
results = autoProcessComics().processEpisode(dirName, os.path.basename(dirName), 0, inputCategory=category)
|
||||
logger.postprocess("nzbToMylar running %s:%s as a manual run on folder %s ...", section, subsection, dirName)
|
||||
results = autoProcessComics().processEpisode(dirName, os.path.basename(dirName), 0, inputCategory=subsection)
|
||||
if results != 0:
|
||||
result = results
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, category, dirName)
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, subsection, dirName)
|
||||
else:
|
||||
logger.postprocess("nzbToMylar %s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, category)
|
||||
logger.postprocess("nzbToMylar %s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, subsection)
|
||||
|
||||
if result == 0:
|
||||
logger.postprocess("The autoProcessComics script completed successfully.")
|
||||
|
|
|
@ -181,20 +181,20 @@ elif len(sys.argv) >= nzbtomedia.SABNZB_0717_NO_OF_ARGUMENTS:
|
|||
result = autoProcessTV().processEpisode(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent, sys.argv[5])
|
||||
else:
|
||||
result = 0
|
||||
section = "NzbDrone"
|
||||
|
||||
logger.warning("Invalid number of arguments received from client.")
|
||||
for section, subsection in nzbtomedia.SUBSECTIONS['NzbDrone'].items():
|
||||
for category in subsection:
|
||||
if nzbtomedia.CFG[section][category].isenabled():
|
||||
dirNames = get_dirnames(section, category)
|
||||
for subsection in nzbtomedia.CFG[section]:
|
||||
if nzbtomedia.CFG[section][subsection].isenabled():
|
||||
dirNames = get_dirnames(section, subsection)
|
||||
for dirName in dirNames:
|
||||
logger.postprocess("nzbToNzbDrone running %s:%s as a manual run on folder %s ...", section, category, dirName)
|
||||
results = autoProcessTV().processEpisode(dirName, os.path.basename(dirName), 0, inputCategory=category)
|
||||
logger.postprocess("nzbToNzbDrone running %s:%s as a manual run on folder %s ...", section, subsection, dirName)
|
||||
results = autoProcessTV().processEpisode(dirName, os.path.basename(dirName), 0, inputCategory=subsection)
|
||||
if results != 0:
|
||||
result = results
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, category, dirName)
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, subsection, dirName)
|
||||
else:
|
||||
logger.postprocess("nzbToNzbDrone %s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, category)
|
||||
logger.postprocess("nzbToNzbDrone %s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, subsection)
|
||||
|
||||
if result == 0:
|
||||
logger.postprocess("The autoProcessTV script completed successfully.")
|
||||
|
|
|
@ -214,20 +214,20 @@ elif len(sys.argv) >= nzbtomedia.SABNZB_0717_NO_OF_ARGUMENTS:
|
|||
result = autoProcessTV().processEpisode(sys.argv[1], sys.argv[2], sys.argv[7], clientAgent, sys.argv[5])
|
||||
else:
|
||||
result = 0
|
||||
section = "SickBeard"
|
||||
|
||||
logger.warning("Invalid number of arguments received from client.")
|
||||
for section, subsection in nzbtomedia.SUBSECTIONS['SickBeard'].items():
|
||||
for category in subsection:
|
||||
if nzbtomedia.CFG[section][category].isenabled():
|
||||
dirNames = get_dirnames(section, category)
|
||||
for subsection in nzbtomedia.CFG[section]:
|
||||
if nzbtomedia.CFG[section][subsection].isenabled():
|
||||
dirNames = get_dirnames(section, subsection)
|
||||
for dirName in dirNames:
|
||||
logger.postprocess("nzbToSickBeard running %s:%s as a manual run on folder %s ...", section, category, dirName)
|
||||
results = autoProcessTV().processEpisode(dirName, os.path.basename(dirName), 0, inputCategory=category)
|
||||
logger.postprocess("nzbToSickBeard running %s:%s as a manual run on folder %s ...", section, subsection, dirName)
|
||||
results = autoProcessTV().processEpisode(dirName, os.path.basename(dirName), 0, inputCategory=subsection)
|
||||
if results != 0:
|
||||
result = results
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, category, dirName)
|
||||
logger.error("A problem was reported when trying to manually run %s:%s on folder %s ...", section, subsection, dirName)
|
||||
else:
|
||||
logger.postprocess("nzbToSickBeard %s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, category)
|
||||
logger.postprocess("nzbToSickBeard %s:%s is DISABLED, you can enable this in autoProcessMedia.cfg ...", section, subsection)
|
||||
|
||||
if result == 0:
|
||||
logger.postprocess("The autoProcessTV script completed successfully.")
|
||||
|
|
|
@ -18,8 +18,6 @@ class autoProcessComics:
|
|||
"We were unable to find a section for category %s, please check your autoProcessMedia.cfg file.", inputCategory)
|
||||
return 1
|
||||
|
||||
logger.postprocess("Loading config from %s", nzbtomedia.CONFIG_FILE)
|
||||
|
||||
host = nzbtomedia.CFG[section][inputCategory]["host"]
|
||||
port = nzbtomedia.CFG[section][inputCategory]["port"]
|
||||
username = nzbtomedia.CFG[section][inputCategory]["username"]
|
||||
|
|
|
@ -17,8 +17,6 @@ class autoProcessGames:
|
|||
"We were unable to find a section for category %s, please check your autoProcessMedia.cfg file.", inputCategory)
|
||||
return 1
|
||||
|
||||
logger.postprocess("Loading config from %s", nzbtomedia.CONFIG_FILE)
|
||||
|
||||
status = int(status)
|
||||
|
||||
host = nzbtomedia.CFG[section][inputCategory]["host"]
|
||||
|
|
|
@ -52,7 +52,7 @@ class autoProcessMovie:
|
|||
return movie_id, imdbid, download_id, movie_status, release_status
|
||||
|
||||
while True:
|
||||
url = baseURL + "media.list/?status=active&release_status=snatched&limit_offset=50," + str(offset)
|
||||
url = baseURL + "media.list/?limit_offset=50," + str(offset)
|
||||
|
||||
logger.debug("Opening URL: %s", url)
|
||||
|
||||
|
@ -90,13 +90,16 @@ class autoProcessMovie:
|
|||
releaselist1 = [item for item in release[index] if item["status"] == "snatched" and "download_info" in item]
|
||||
if download_id:
|
||||
releaselist = [item for item in releaselist1 if item["download_info"]["id"].lower() == download_id.lower()]
|
||||
else:
|
||||
elif len(releaselist1) > 0:
|
||||
releaselist = releaselist1
|
||||
else:
|
||||
releaselist = [item for item in release[index] if item["status"] == "downloaded" and "download_info" in item]
|
||||
|
||||
if imdbid and library[index] == imdbid:
|
||||
movie_id = str(movieid[index])
|
||||
movie_status = str(moviestatus[index])
|
||||
logger.postprocess("Found movie id %s with status %s in CPS database for movie %s", movie_id, movie_status, imdbid)
|
||||
|
||||
if not download_id and len(releaselist) == 1:
|
||||
download_id = releaselist[0]["download_info"]["id"]
|
||||
|
||||
|
@ -169,8 +172,6 @@ class autoProcessMovie:
|
|||
"We were unable to find a section for category %s, please check your autoProcessMedia.cfg file.", inputCategory)
|
||||
return 1
|
||||
|
||||
logger.postprocess("Loading config from %s", nzbtomedia.CONFIG_FILE)
|
||||
|
||||
status = int(status)
|
||||
|
||||
host = nzbtomedia.CFG[section][inputCategory]["host"]
|
||||
|
@ -219,6 +220,10 @@ class autoProcessMovie:
|
|||
|
||||
movie_id, imdbid, download_id, initial_status, initial_release_status = self.get_movie_postprocess(baseURL, imdbid, download_id) # get the CPS database movie id for this movie.
|
||||
|
||||
if initial_release_status == "downloaded":
|
||||
logger.postprocess("This movie has already been post-processed by CouchPotatoServer, skipping ...")
|
||||
return 0
|
||||
|
||||
process_all_exceptions(nzbName.lower(), dirName)
|
||||
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ class autoProcessMusic:
|
|||
"We were unable to find a section for category %s, please check your autoProcessMedia.cfg file.", inputCategory)
|
||||
return 1
|
||||
|
||||
logger.postprocess("Loading config from %s", nzbtomedia.CONFIG_FILE)
|
||||
|
||||
status = int(status)
|
||||
|
||||
host = nzbtomedia.CFG[section][inputCategory]["host"]
|
||||
|
|
|
@ -28,8 +28,6 @@ class autoProcessTV:
|
|||
# auto-detect correct fork
|
||||
fork, fork_params = autoFork(inputCategory)
|
||||
|
||||
logger.postprocess("Loading config from %s", nzbtomedia.CONFIG_FILE)
|
||||
|
||||
status = int(failed)
|
||||
|
||||
host = nzbtomedia.CFG[section][inputCategory]["host"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue