Make status API

This commit is contained in:
Ruud
2011-09-23 18:04:53 +02:00
parent f7f7d822bd
commit 7bf8a047d6
+11
View File
@@ -1,6 +1,8 @@
from couchpotato import get_session from couchpotato import get_session
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent, fireEvent from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.helpers.request import jsonified
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin from couchpotato.core.plugins.base import Plugin
from couchpotato.core.settings.model import Status from couchpotato.core.settings.model import Status
@@ -26,6 +28,15 @@ class StatusPlugin(Plugin):
addEvent('status.all', self.all) addEvent('status.all', self.all)
addEvent('app.load', self.fill) addEvent('app.load', self.fill)
addApiView('status.list', self.list)
def list(self):
return jsonified({
'success': True,
'list': self.all()
})
def all(self): def all(self):
db = get_session() db = get_session()