Couldn't test Synoindex. fix #814
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
from couchpotato.core.event import addEvent
|
from couchpotato.core.event import addEvent
|
||||||
|
from couchpotato.core.helpers.request import jsonified
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from couchpotato.core.notifications.base import Notification
|
from couchpotato.core.notifications.base import Notification
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -9,13 +10,14 @@ log = CPLog(__name__)
|
|||||||
class Synoindex(Notification):
|
class Synoindex(Notification):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
super(Synoindex, self).__init__()
|
||||||
addEvent('renamer.after', self.addToLibrary)
|
addEvent('renamer.after', self.addToLibrary)
|
||||||
|
|
||||||
def addToLibrary(self, group = {}):
|
def addToLibrary(self, group = {}):
|
||||||
if self.isDisabled(): return
|
if self.isDisabled(): return
|
||||||
|
|
||||||
command = ['/usr/syno/bin/synoindex', '-A', group.get('destination_dir')]
|
command = ['/usr/syno/bin/synoindex', '-A', group.get('destination_dir', '')]
|
||||||
log.info(u'Executing synoindex command: %s ', command)
|
log.info('Executing synoindex command: %s ', command)
|
||||||
try:
|
try:
|
||||||
p = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
|
p = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
|
||||||
out = p.communicate()
|
out = p.communicate()
|
||||||
@@ -26,3 +28,7 @@ class Synoindex(Notification):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def test(self):
|
||||||
|
success = self.addToLibrary()
|
||||||
|
return jsonified({'success': success})
|
||||||
|
|||||||
Reference in New Issue
Block a user