diff --git a/nzbtomedia/autoProcess/autoProcessComics.py b/nzbtomedia/autoProcess/autoProcessComics.py index 31576a8a..12ba1d47 100644 --- a/nzbtomedia/autoProcess/autoProcessComics.py +++ b/nzbtomedia/autoProcess/autoProcessComics.py @@ -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 diff --git a/nzbtomedia/autoProcess/autoProcessGames.py b/nzbtomedia/autoProcess/autoProcessGames.py index a4e8aaeb..effe56ae 100644 --- a/nzbtomedia/autoProcess/autoProcessGames.py +++ b/nzbtomedia/autoProcess/autoProcessGames.py @@ -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 diff --git a/nzbtomedia/autoProcess/autoProcessMovie.py b/nzbtomedia/autoProcess/autoProcessMovie.py index 471aa04a..29ff6c79 100644 --- a/nzbtomedia/autoProcess/autoProcessMovie.py +++ b/nzbtomedia/autoProcess/autoProcessMovie.py @@ -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 diff --git a/nzbtomedia/autoProcess/autoProcessMusic.py b/nzbtomedia/autoProcess/autoProcessMusic.py index e73c6551..72117bf1 100644 --- a/nzbtomedia/autoProcess/autoProcessMusic.py +++ b/nzbtomedia/autoProcess/autoProcessMusic.py @@ -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 diff --git a/nzbtomedia/autoProcess/autoProcessTV.py b/nzbtomedia/autoProcess/autoProcessTV.py index 3dd18c50..d28fca97 100644 --- a/nzbtomedia/autoProcess/autoProcessTV.py +++ b/nzbtomedia/autoProcess/autoProcessTV.py @@ -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