Browse Source

Just check for synoindex file on test.

pull/863/head
Ruud 13 years ago
parent
commit
f474962225
  1. 8
      couchpotato/core/notifications/synoindex/main.py

8
couchpotato/core/notifications/synoindex/main.py

@ -2,6 +2,7 @@ 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 os
import subprocess
log = CPLog(__name__)
@ -9,6 +10,8 @@ log = CPLog(__name__)
class Synoindex(Notification):
index_path = '/usr/syno/bin/synoindex'
def __init__(self):
super(Synoindex, self).__init__()
addEvent('renamer.after', self.addToLibrary)
@ -16,7 +19,7 @@ class Synoindex(Notification):
def addToLibrary(self, group = {}):
if self.isDisabled(): return
command = ['/usr/syno/bin/synoindex', '-A', group.get('destination_dir', '')]
command = [self.index_path, '-A', group.get('destination_dir')]
log.info('Executing synoindex command: %s ', command)
try:
p = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
@ -30,5 +33,4 @@ class Synoindex(Notification):
return True
def test(self):
success = self.addToLibrary()
return jsonified({'success': success})
return jsonified({'success': os.path.isfile(self.index_path)})

Loading…
Cancel
Save