From 874b2c613504c57fdbf48a77e1f8c2e315f29553 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Wed, 30 Jan 2013 18:49:12 -0800 Subject: [PATCH] remove failed files/folder if delete_failed option closes #24 --- autoProcessMovie.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/autoProcessMovie.py b/autoProcessMovie.py index 7a178c1b..e358f62c 100644 --- a/autoProcessMovie.py +++ b/autoProcessMovie.py @@ -1,6 +1,7 @@ import sys import urllib import os.path +import shutil import ConfigParser import time import json @@ -45,6 +46,7 @@ def process(dirName, nzbName=None, status=0): apikey = config.get("CouchPotato", "apikey") delay = float(config.get("CouchPotato", "delay")) method = config.get("CouchPotato", "method") + delete_failed = int(config.get("CouchPotato", "delete_failed")) try: ssl = int(config.get("CouchPotato", "ssl")) @@ -146,3 +148,6 @@ def process(dirName, nzbName=None, status=0): print line print "movie", movid, "set to try the next best release on CouchPotatoServer" + if delete_failed: + print "Deleting failed files and folder", dirName + shutil.rmtree('dirName')