Couldn't test Synoindex. fix #814
This commit is contained in:
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user