Movie.get by id event
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
from couchpotato import get_session
|
from couchpotato import get_session
|
||||||
from couchpotato.api import addApiView
|
from couchpotato.api import addApiView
|
||||||
from couchpotato.core.event import fireEvent, fireEventAsync
|
from couchpotato.core.event import fireEvent, fireEventAsync, addEvent
|
||||||
from couchpotato.core.helpers.request import getParams, jsonified
|
from couchpotato.core.helpers.request import getParams, jsonified
|
||||||
from couchpotato.core.plugins.base import Plugin
|
from couchpotato.core.plugins.base import Plugin
|
||||||
from couchpotato.core.settings.model import Movie
|
from couchpotato.core.settings.model import Movie
|
||||||
@@ -28,6 +28,15 @@ class MoviePlugin(Plugin):
|
|||||||
addApiView('movie.edit', self.edit)
|
addApiView('movie.edit', self.edit)
|
||||||
addApiView('movie.delete', self.delete)
|
addApiView('movie.delete', self.delete)
|
||||||
|
|
||||||
|
addEvent('movie.get', self.get)
|
||||||
|
|
||||||
|
def get(self, movie_id):
|
||||||
|
|
||||||
|
db = get_session()
|
||||||
|
m = db.query(Movie).filter_by(movie_id = movie_id).first()
|
||||||
|
|
||||||
|
return m.to_dict(self.default_dict)
|
||||||
|
|
||||||
def list(self):
|
def list(self):
|
||||||
|
|
||||||
params = getParams()
|
params = getParams()
|
||||||
|
|||||||
Reference in New Issue
Block a user