Skip to content

Commit

Permalink
Revert "improve couchpotato script to handle multiple files being pre…
Browse files Browse the repository at this point in the history
…sent"

This reverts commit 2791a75.
  • Loading branch information
Michael Higgins committed Feb 16, 2015
1 parent 2791a75 commit d111ff8
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions setup/PostProcess/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down Expand Up @@ -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

0 comments on commit d111ff8

Please sign in to comment.