Made some changes to how sections are returned, now with a section counter

This commit is contained in:
echel0n 2014-04-07 02:54:44 -07:00
commit 640f25895b
5 changed files with 15 additions and 15 deletions

View file

@ -15,12 +15,12 @@ class autoProcessComics:
return 1 # failure
# auto-detect correct section
section = [x for x in config.issubsection(inputCategory) if int(config()[x][inputCategory]['enabled']) == 1][0]
if len(section) > 1:
secCount, section = [x for x in enumerate(config.issubsection(inputCategory)) if int(config()[x[1]][inputCategory]['enabled']) == 1]
if secCount > 1:
Logger.error(
"MAIN: You can't have multiple sub-sections with the same name enabled, fix your autoProcessMedia.cfg file.")
return 1
elif len(section) == 0:
elif secCount == 0:
Logger.error(
"MAIN: We were unable to find a processor for category %s that was enabled, please check your autoProcessMedia.cfg file.", inputCategory)
return 1

View file

@ -14,12 +14,12 @@ class autoProcessGames:
return 1 # failure
# auto-detect correct section
section = [x for x in config.issubsection(inputCategory) if int(config()[x][inputCategory]['enabled']) == 1][0]
if len(section) > 1:
secCount, section = [x for x in enumerate(config.issubsection(inputCategory)) if int(config()[x[1]][inputCategory]['enabled']) == 1]
if secCount > 1:
Logger.error(
"MAIN: You can't have multiple sub-sections with the same name enabled, fix your autoProcessMedia.cfg file.")
return 1
elif len(section) == 0:
elif secCount == 0:
Logger.error(
"MAIN: We were unable to find a processor for category %s that was enabled, please check your autoProcessMedia.cfg file.", inputCategory)
return 1

View file

@ -166,12 +166,12 @@ class autoProcessMovie:
return 1 # failure
# auto-detect correct section
section = [x for x in config.issubsection(inputCategory) if int(config()[x][inputCategory]['enabled']) == 1][0]
if len(section) > 1:
secCount, section = [x for x in enumerate(config.issubsection(inputCategory)) if int(config()[x[1]][inputCategory]['enabled']) == 1]
if secCount > 1:
Logger.error(
"MAIN: You can't have multiple sub-sections with the same name enabled, fix your autoProcessMedia.cfg file.")
return 1
elif len(section) == 0:
elif secCount == 0:
Logger.error(
"MAIN: We were unable to find a processor for category %s that was enabled, please check your autoProcessMedia.cfg file.", inputCategory)
return 1

View file

@ -15,12 +15,12 @@ class autoProcessMusic:
return 1 # failure
# auto-detect correct section
section = [x for x in config.issubsection(inputCategory) if int(config()[x][inputCategory]['enabled']) == 1][0]
if len(section) > 1:
secCount, section = [x for x in enumerate(config.issubsection(inputCategory)) if int(config()[x[1]][inputCategory]['enabled']) == 1]
if secCount > 1:
Logger.error(
"MAIN: You can't have multiple sub-sections with the same name enabled, fix your autoProcessMedia.cfg file.")
return 1
elif len(section) == 0:
elif secCount == 0:
Logger.error(
"MAIN: We were unable to find a processor for category %s that was enabled, please check your autoProcessMedia.cfg file.", inputCategory)
return 1

View file

@ -20,12 +20,12 @@ class autoProcessTV:
return 1 # failure
# auto-detect correct section
section = [x for x in config.issubsection(inputCategory) if int(config()[x][inputCategory]['enabled']) == 1][0]
if len(section) > 1:
secCount, section = [x for x in enumerate(config.issubsection(inputCategory)) if int(config()[x[1]][inputCategory]['enabled']) == 1]
if secCount > 1:
Logger.error(
"MAIN: You can't have multiple sub-sections with the same name enabled, fix your autoProcessMedia.cfg file.")
return 1
elif len(section) == 0:
elif secCount == 0:
Logger.error(
"MAIN: We were unable to find a processor for category %s that was enabled, please check your autoProcessMedia.cfg file.", inputCategory)
return 1