From a9556dd7a023bbd39b08222f37a598dff9be28ca Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Fri, 21 Mar 2014 21:55:00 +1030 Subject: [PATCH] cleanup and a few fixes. #288 --- TorrentToMedia.py | 5 +++-- autoSickBeardFork.py => autoProcess/autoSickBeardFork.py | 6 +++--- autoProcess/migratecfg.py | 2 ++ nzbToMedia.py | 2 +- nzbToSickBeard.py | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) rename autoSickBeardFork.py => autoProcess/autoSickBeardFork.py (90%) diff --git a/TorrentToMedia.py b/TorrentToMedia.py index ccb71b30..692fdeab 100755 --- a/TorrentToMedia.py +++ b/TorrentToMedia.py @@ -21,7 +21,7 @@ import autoProcess.autoProcessMovie as autoProcessMovie import autoProcess.autoProcessTV as autoProcessTV from autoProcess.nzbToMediaEnv import * from autoProcess.nzbToMediaUtil import * -from autoSickBeardFork import autoFork +from autoProcess.autoSickBeardFork import autoFork from utorrent.client import UTorrentClient from transmissionrpc.client import Client as TransmissionClient from synchronousdeluge.client import DelugeClient @@ -44,6 +44,8 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID): Logger.debug("MAIN: Determined Directory: %s | Name: %s | Category: %s", inputDirectory, inputName, inputCategory) + sbFork, sbParams = autoFork() + if inputCategory in sbCategory and sbFork in SICKBEARD_TORRENT and Torrent_ForceLink != 1: Logger.info("MAIN: Calling SickBeard's %s branch to post-process: %s",sbFork ,inputName) result = autoProcessTV.processEpisode(inputDirectory, inputName, int(0)) @@ -490,7 +492,6 @@ if __name__ == "__main__": cpsCategory = (config.get("CouchPotato", "cpsCategory")).split(',') # movie sbCategory = (config.get("SickBeard", "sbCategory")).split(',') # tv - sbFork, sbParams = autoFork(config.get("SickBeard", "fork")) # default Torrent_ForceLink = int(config.get("SickBeard", "Torrent_ForceLink")) # 1 hpCategory = (config.get("HeadPhones", "hpCategory")).split(',') # music mlCategory = (config.get("Mylar", "mlCategory")).split(',') # comics diff --git a/autoSickBeardFork.py b/autoProcess/autoSickBeardFork.py similarity index 90% rename from autoSickBeardFork.py rename to autoProcess/autoSickBeardFork.py index bfaef381..bbaaf405 100644 --- a/autoSickBeardFork.py +++ b/autoProcess/autoSickBeardFork.py @@ -51,10 +51,10 @@ def autoFork(fork=None): try: fork = config.get(section, "fork") if not fork in "auto": - fork = forks[fork] \ - if fork in SICKBEARD_FAILED or SICKBEARD_TORRENT else forks[fork_default] + fork = fork if fork in SICKBEARD_FAILED or fork in SICKBEARD_TORRENT else fork_default + fork = [f for f in forks.iteritems() if f[0] == fork][0] except ConfigParser.NoOptionError: - fork = forks[fork_default] + fork = [f for f in forks.iteritems() if f[0] == fork_default][0] myOpener = AuthURLOpener(username, password) diff --git a/autoProcess/migratecfg.py b/autoProcess/migratecfg.py index fc17680c..ff639fc6 100644 --- a/autoProcess/migratecfg.py +++ b/autoProcess/migratecfg.py @@ -61,6 +61,8 @@ def migrate(): if option == "failed_fork": # change this old format option = "fork" value = "auto" + if option == "fork" and value in ["TPB", "TPB-failed", "Pistachitos"]: # Merge all these to "auto" + value = "auto" if option == "outputDirectory": # move this to new location format value = os.path.split(os.path.normpath(value))[0] confignew.set("Torrent", option, value) diff --git a/nzbToMedia.py b/nzbToMedia.py index e7db98af..1a50a5e3 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -109,7 +109,7 @@ # SickBeard fork. # -# set to default or auto to auto-detect the custom failed fork type". +# set to default or auto to auto-detect the custom fork type. #sbfork=auto # SickBeard Delete Failed Downloads (0, 1) diff --git a/nzbToSickBeard.py b/nzbToSickBeard.py index 70ba9b79..1c554fe1 100755 --- a/nzbToSickBeard.py +++ b/nzbToSickBeard.py @@ -58,8 +58,8 @@ # SickBeard fork. # -# set to default or TPB or failed if using the custom "TPB" or "failed fork". -#sbfork=default +# set to default or auto to auto-detect the custom fork type. +#sbfork=auto # SickBeard Delete Failed Downloads (0, 1). #