add category centric processing. fixes #230

This commit is contained in:
clinton-hall 2014-01-07 21:22:47 +10:30
parent c98604c618
commit 6fe287df0d
8 changed files with 135 additions and 95 deletions

View file

@ -30,7 +30,7 @@ class AuthURLOpener(urllib.FancyURLopener):
return urllib.FancyURLopener.open(self, url)
def processEpisode(dirName, nzbName=None, status=0):
def processEpisode(dirName, nzbName=None, status=0, inputCategory=None):
config = ConfigParser.ConfigParser()
configFilename = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
@ -41,23 +41,26 @@ def processEpisode(dirName, nzbName=None, status=0):
return 1 # failure
config.read(configFilename)
host = config.get("Mylar", "host")
port = config.get("Mylar", "port")
username = config.get("Mylar", "username")
password = config.get("Mylar", "password")
section = "Mylar"
if inputCategory != None and config.has_section(inputCategory):
section = inputCategory
host = config.get(section, "host")
port = config.get(section, "port")
username = config.get(section, "username")
password = config.get(section, "password")
try:
ssl = int(config.get("Mylar", "ssl"))
ssl = int(config.get(section, "ssl"))
except (ConfigParser.NoOptionError, ValueError):
ssl = 0
try:
web_root = config.get("Mylar", "web_root")
web_root = config.get(section, "web_root")
except ConfigParser.NoOptionError:
web_root = ""
try:
watch_dir = config.get("Mylar", "watch_dir")
watch_dir = config.get(section, "watch_dir")
except ConfigParser.NoOptionError:
watch_dir = ""
params = {}