diff --git a/setup/PostProcess/main.py b/setup/PostProcess/main.py index 74b0d722..ac032de3 100644 --- a/setup/PostProcess/main.py +++ b/setup/PostProcess/main.py @@ -3,7 +3,6 @@ from couchpotato.core.plugins.base import Plugin from subprocess import Popen, PIPE import traceback -import copy import os log = CPLog(__name__) @@ -32,28 +31,22 @@ def callscript(self, message = None, group = None): command.append(os.path.join(path, 'CPProcess.py')) command.append(imdbid) command.append(original) + for x in moviefile: + command.append(x) - success = False; + log.info("Command generated: %s", command) + try: + p = Popen(command, stdout=PIPE) + res = p.wait() + if res == 0: + log.info('PostProcess Script was called successfully') + return True + else: + log.info('PostProcess Script returned an error code: %s', str(res)) + log.info(p.stdout.read()) - for x in moviefile: - final = copy.copy(command) - final.append(x) - - log.info("Command generated: %s", command) - try: - p = Popen(final, stdout=PIPE) - res = p.wait() - if res == 0: - success = True - log.info('PostProcess Script was called successfully') - else: - log.info('PostProcess Script returned an error code: %s', str(res)) - log.info(p.stdout.read()) - except: - log.error('Failed to call script: %s', (traceback.format_exc())) - - if (success): - log.info('PostProcess Script was called successfully') - return True - else: - return False + except: + log.error('Failed to call script: %s', (traceback.format_exc())) + + + return False