mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -07:00
Moved code for gather dirNames for manual sickbeard post-processing into nzbtomediautils and cleanup code in nzbtomedia for manual sickbeard post-processing as well.
This commit is contained in:
parent
753b90e4f8
commit
785a138d02
2 changed files with 29 additions and 25 deletions
|
@ -455,3 +455,26 @@ def parse_args(clientAgent):
|
||||||
if not parseFunc:
|
if not parseFunc:
|
||||||
raise RuntimeError("Could not find client-agent")
|
raise RuntimeError("Could not find client-agent")
|
||||||
return parseFunc(sys.argv)
|
return parseFunc(sys.argv)
|
||||||
|
|
||||||
|
def get_dirnames(section, category):
|
||||||
|
try:
|
||||||
|
watch_dir = config().get(section, "watch_dir")
|
||||||
|
except config.NoOptionError:
|
||||||
|
watch_dir = ""
|
||||||
|
try:
|
||||||
|
outputDirectory = os.path.join(config().get("Torrent", "outputDirectory"), category)
|
||||||
|
except config.NoOptionError:
|
||||||
|
outputDirectory = ""
|
||||||
|
|
||||||
|
# set dirName
|
||||||
|
dirNames = None
|
||||||
|
if watch_dir != "":
|
||||||
|
if os.path.exists(watch_dir):
|
||||||
|
dirNames = [os.path.join(watch_dir, o) for o in os.listdir(watch_dir) if
|
||||||
|
os.path.isdir(os.path.join(watch_dir, o))]
|
||||||
|
elif outputDirectory != "":
|
||||||
|
if os.path.exists(outputDirectory):
|
||||||
|
dirNames = [os.path.join(outputDirectory, o) for o in os.listdir(outputDirectory) if
|
||||||
|
os.path.isdir(os.path.join(outputDirectory, o))]
|
||||||
|
|
||||||
|
return dirNames
|
|
@ -407,38 +407,19 @@ else: # only CPS and SB supports this manual run for now.
|
||||||
nzbDir, inputName, status, inputCategory, download_id = ('Manual Run', 'Manual Run', 0, cpsCategory[0], '')
|
nzbDir, inputName, status, inputCategory, download_id = ('Manual Run', 'Manual Run', 0, cpsCategory[0], '')
|
||||||
|
|
||||||
Logger.info("MAIN: Running autoProcessTV as a manual run...")
|
Logger.info("MAIN: Running autoProcessTV as a manual run...")
|
||||||
inputCategory = sbCategory[0]
|
dirNames = get_dirnames("SickBeard", sbCategory[0])
|
||||||
|
nzbDir, inputName, status, inputCategory, download_id = (dirNames, dirNames, 0, sbCategory[0], '')
|
||||||
|
|
||||||
if inputCategory in cpsCategory:
|
if inputCategory in cpsCategory:
|
||||||
Logger.info("MAIN: Calling CouchPotatoServer to post-process: %s", inputName)
|
Logger.info("MAIN: Calling CouchPotatoServer to post-process: %s", inputName)
|
||||||
result = autoProcessMovie.process(nzbDir, inputName, status, clientAgent, download_id, inputCategory)
|
result = autoProcessMovie.process(nzbDir, inputName, status, clientAgent, download_id, inputCategory)
|
||||||
elif inputCategory in sbCategory:
|
elif inputCategory in sbCategory:
|
||||||
result = 0
|
result = 0
|
||||||
if clientAgent == "manual":
|
if isinstance(nzbDir, list):
|
||||||
section = "SickBeard"
|
for dirName in nzbDir:
|
||||||
try:
|
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName)
|
||||||
watch_dir = config().get(section, "watch_dir")
|
|
||||||
except config.NoOptionError:
|
|
||||||
watch_dir = ""
|
|
||||||
try:
|
|
||||||
outputDirectory = os.path.join(config().get("Torrent", "outputDirectory"), sbCategory[0])
|
|
||||||
except config.NoOptionError:
|
|
||||||
outputDirectory = ""
|
|
||||||
|
|
||||||
# set dirName
|
|
||||||
dirNames = None
|
|
||||||
if watch_dir != "":
|
|
||||||
if os.path.exists(watch_dir):
|
|
||||||
dirNames = [os.path.join(watch_dir, o) for o in os.listdir(watch_dir) if os.path.isdir(os.path.join(watch_dir, o))]
|
|
||||||
elif outputDirectory != "":
|
|
||||||
if os.path.exists(outputDirectory):
|
|
||||||
dirNames = [os.path.join(outputDirectory, o) for o in os.listdir(outputDirectory) if os.path.isdir(os.path.join(outputDirectory, o))]
|
|
||||||
|
|
||||||
for dirName in dirNames:
|
|
||||||
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", dirName)
|
|
||||||
result = autoProcessTV.processEpisode(dirName, dirName, status, clientAgent, inputCategory)
|
result = autoProcessTV.processEpisode(dirName, dirName, status, clientAgent, inputCategory)
|
||||||
if result != 0:
|
if result !=0:break
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName)
|
Logger.info("MAIN: Calling Sick-Beard to post-process: %s", inputName)
|
||||||
result = autoProcessTV.processEpisode(nzbDir, inputName, status, clientAgent, inputCategory)
|
result = autoProcessTV.processEpisode(nzbDir, inputName, status, clientAgent, inputCategory)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue