From 8fb24bb101bc7443440bca9f956c1c486c728573 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 16 Sep 2012 20:20:47 +0200 Subject: [PATCH] Couldn't test Synoindex. fix #814 --- couchpotato/core/notifications/synoindex/main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/notifications/synoindex/main.py b/couchpotato/core/notifications/synoindex/main.py index 93d6cdbd..89c54de7 100644 --- a/couchpotato/core/notifications/synoindex/main.py +++ b/couchpotato/core/notifications/synoindex/main.py @@ -1,4 +1,5 @@ from couchpotato.core.event import addEvent +from couchpotato.core.helpers.request import jsonified from couchpotato.core.logger import CPLog from couchpotato.core.notifications.base import Notification import subprocess @@ -9,13 +10,14 @@ log = CPLog(__name__) class Synoindex(Notification): def __init__(self): + super(Synoindex, self).__init__() addEvent('renamer.after', self.addToLibrary) def addToLibrary(self, group = {}): if self.isDisabled(): return - command = ['/usr/syno/bin/synoindex', '-A', group.get('destination_dir')] - log.info(u'Executing synoindex command: %s ', command) + command = ['/usr/syno/bin/synoindex', '-A', group.get('destination_dir', '')] + log.info('Executing synoindex command: %s ', command) try: p = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT) out = p.communicate() @@ -26,3 +28,7 @@ class Synoindex(Notification): return False return True + + def test(self): + success = self.addToLibrary() + return jsonified({'success': success})