unicode cleanup

This commit is contained in:
Ruud
2012-01-15 00:09:42 +01:00
parent 44cebc7ecd
commit 88c7f3e9b3
5 changed files with 14 additions and 12 deletions
+2 -1
View File
@@ -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:
@@ -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')
+2 -2
View File
@@ -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
+8 -7
View File
@@ -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)
+1 -1
View File
@@ -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)