Files
CouchPotatoServer/couchpotato/core/plugins/library/main.py
T
Ruud 288aa8c0a1 Movie search
Profile Settings
2011-03-20 22:12:33 +01:00

33 lines
785 B
Python

from couchpotato import get_session
from couchpotato.core.event import addEvent
from couchpotato.core.plugins.base import Plugin
from couchpotato.core.settings.model import Library
class LibraryPlugin(Plugin):
def __init__(self):
addEvent('library.add', self.add)
def add(self, attrs = {}):
db = get_session();
l = db.query(Library).filter_by(identifier = attrs.get('identifier')).first()
if not l:
l = Library(
name = attrs.get('name'),
year = attrs.get('year'),
identifier = attrs.get('identifier'),
description = attrs.get('description')
)
db.add(l)
db.commit()
return l
def update(self, item):
pass