diff --git a/couchpotato/core/downloaders/sabnzbd/main.py b/couchpotato/core/downloaders/sabnzbd/main.py index f2e8dbaf..d2b47786 100644 --- a/couchpotato/core/downloaders/sabnzbd/main.py +++ b/couchpotato/core/downloaders/sabnzbd/main.py @@ -1,6 +1,7 @@ from couchpotato.core.downloaders.base import Downloader from couchpotato.core.helpers.variable import cleanHost from couchpotato.core.logger import CPLog +from inspect import isfunction from tempfile import mkstemp from urllib import urlencode import base64 @@ -41,7 +42,7 @@ class Sabnzbd(Downloader): 'nzbname': '%s%s' % (data.get('name'), self.cpTag(movie)), } - if data.get('download'): + if isfunction(data.get('download')): nzb_file = data.get('download')(url = data.get('url'), nzb_id = data.get('id')) if len(nzb_file) < 50: diff --git a/couchpotato/core/notifications/boxcar/main.py b/couchpotato/core/notifications/boxcar/main.py index 12f9a8af..cbf907ff 100644 --- a/couchpotato/core/notifications/boxcar/main.py +++ b/couchpotato/core/notifications/boxcar/main.py @@ -32,4 +32,4 @@ class Boxcar(Notification): return True def isEnabled(self): - return super(Boxcar, self) and self.conf('email') + return super(Boxcar, self).isEnabled() and self.conf('email') diff --git a/couchpotato/core/plugins/file/main.py b/couchpotato/core/plugins/file/main.py index 5fed471b..28b2fb80 100644 --- a/couchpotato/core/plugins/file/main.py +++ b/couchpotato/core/plugins/file/main.py @@ -48,12 +48,12 @@ class FileManager(Plugin): def add(self, path = '', part = 1, type = (), available = 1, properties = {}): db = get_session() - f = db.query(File).filter(or_(File.path == toUnicode(path), File.path == path)).first() + f = db.query(File).filter(File.path == toUnicode(path)).first() if not f: f = File() db.add(f) - f.path = path + f.path = toUnicode(path) f.part = part f.available = available f.type_id = self.getType(type).id diff --git a/couchpotato/core/plugins/library/main.py b/couchpotato/core/plugins/library/main.py index 59354792..fd9e2197 100644 --- a/couchpotato/core/plugins/library/main.py +++ b/couchpotato/core/plugins/library/main.py @@ -1,5 +1,6 @@ from couchpotato import get_session from couchpotato.core.event import addEvent, fireEventAsync, fireEvent +from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin from couchpotato.core.settings.model import Library, LibraryTitle, File, \ @@ -26,13 +27,13 @@ class LibraryPlugin(Plugin): l = Library( year = attrs.get('year'), identifier = attrs.get('identifier'), - plot = attrs.get('plot'), - tagline = attrs.get('tagline'), + plot = toUnicode(attrs.get('plot')), + tagline = toUnicode(attrs.get('tagline')), status_id = status.get('id') ) title = LibraryTitle( - title = attrs.get('title') + title = toUnicode(attrs.get('title')) ) l.titles.append(title) @@ -68,8 +69,8 @@ class LibraryPlugin(Plugin): # Main info if do_update: - library.plot = info.get('plot', '') - library.tagline = info.get('tagline', '') + library.plot = toUnicode(info.get('plot', '')) + library.tagline = toUnicode(info.get('tagline', '')) library.year = info.get('year', 0) library.status_id = done_status.get('id') db.commit() @@ -82,7 +83,7 @@ class LibraryPlugin(Plugin): log.debug('Adding titles: %s' % titles) for title in titles: t = LibraryTitle( - title = title, + title = toUnicode(title), default = title.lower() == default_title.lower() ) library.titles.append(t) @@ -97,7 +98,7 @@ class LibraryPlugin(Plugin): log.debug('Adding genres: %s' % genres) for genre in genres: g = LibraryGenre( - name = genre + name = toUnicode(genre) ) library.genres.append(g) diff --git a/couchpotato/core/plugins/profile/main.py b/couchpotato/core/plugins/profile/main.py index b34b62b4..f34849b2 100644 --- a/couchpotato/core/plugins/profile/main.py +++ b/couchpotato/core/plugins/profile/main.py @@ -43,7 +43,7 @@ class ProfilePlugin(Plugin): p = Profile() db.add(p) - p.label = params.get('label') + p.label = toUnicode(params.get('label')) p.order = params.get('order', p.order if p.order else 0) p.core = params.get('core', False)