mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 13:23:18 -07:00
fix issues with processing categories that are disabled. Fix category testing.
This commit is contained in:
parent
2d1283e4bf
commit
b61aca7e68
4 changed files with 17 additions and 8 deletions
|
@ -266,6 +266,8 @@ def main(args):
|
|||
|
||||
for section, subsections in nzbtomedia.SECTIONS.items():
|
||||
for subsection in subsections:
|
||||
if not nzbtomedia.CFG[section][subsection].isenabled():
|
||||
continue
|
||||
for dirName in nzbtomedia.getDirs(section, subsection, link='hard'):
|
||||
logger.info("Starting manual run for %s:%s - Folder:%s" % (section, subsection, dirName))
|
||||
|
||||
|
|
|
@ -710,6 +710,8 @@ def main(args, section=None):
|
|||
|
||||
for section, subsections in nzbtomedia.SECTIONS.items():
|
||||
for subsection in subsections:
|
||||
if not nzbtomedia.CFG[section][subsection].isenabled():
|
||||
continue
|
||||
for dirName in getDirs(section, subsection, link = 'move'):
|
||||
logger.info("Starting manual run for %s:%s - Folder:%s" % (section, subsection, dirName))
|
||||
|
||||
|
|
|
@ -648,7 +648,8 @@ def initialize(section=None):
|
|||
|
||||
# check for script-defied section and if None set to allow sections
|
||||
SECTIONS = CFG[tuple(x for x in CFG if CFG[x].sections and CFG[x].isenabled()) if not section else (section,)]
|
||||
map(CATEGORIES.extend,([subsection.sections for section,subsection in SECTIONS.items()]))
|
||||
for section,subsections in SECTIONS.items():
|
||||
CATEGORIES.extend([subsection for subsection in subsections if CFG[section][subsection].isenabled()])
|
||||
CATEGORIES = list(set(CATEGORIES))
|
||||
|
||||
# create torrent class
|
||||
|
|
|
@ -99,13 +99,17 @@ def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
|||
|
||||
pathlist = os.path.normpath(inputDirectory).split(os.sep)
|
||||
|
||||
try:
|
||||
inputCategory = list(set(pathlist) & set(categories))[-1] # assume last match is most relevant category.
|
||||
logger.debug("SEARCH: Found Category: %s in directory structure" % (inputCategory))
|
||||
except IndexError:
|
||||
inputCategory = ""
|
||||
logger.debug("SEARCH: Could not find a category in the directory structure")
|
||||
|
||||
if inputCategory and inputCategory in pathlist:
|
||||
logger.debug("SEARCH: Found the Category: %s in directory structure" % (inputCategory))
|
||||
elif inputCategory:
|
||||
logger.debug("SEARCH: Could not find the category: %s in the directory structure" % (inputCategory))
|
||||
else:
|
||||
try:
|
||||
inputCategory = list(set(pathlist) & set(categories))[-1] # assume last match is most relevant category.
|
||||
logger.debug("SEARCH: Found Category: %s in directory structure" % (inputCategory))
|
||||
except IndexError:
|
||||
inputCategory = ""
|
||||
logger.debug("SEARCH: Could not find a category in the directory structure")
|
||||
if not os.path.isdir(inputDirectory) and os.path.isfile(inputDirectory): # If the input directory is a file
|
||||
if not inputName: inputName = os.path.split(os.path.normpath(inputDirectory))[1]
|
||||
return inputDirectory, inputName, inputCategory, root
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue