unicode cleanup
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
from couchpotato.core.downloaders.base import Downloader
|
from couchpotato.core.downloaders.base import Downloader
|
||||||
from couchpotato.core.helpers.variable import cleanHost
|
from couchpotato.core.helpers.variable import cleanHost
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
|
from inspect import isfunction
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
import base64
|
import base64
|
||||||
@@ -41,7 +42,7 @@ class Sabnzbd(Downloader):
|
|||||||
'nzbname': '%s%s' % (data.get('name'), self.cpTag(movie)),
|
'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'))
|
nzb_file = data.get('download')(url = data.get('url'), nzb_id = data.get('id'))
|
||||||
|
|
||||||
if len(nzb_file) < 50:
|
if len(nzb_file) < 50:
|
||||||
|
|||||||
@@ -32,4 +32,4 @@ class Boxcar(Notification):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def isEnabled(self):
|
def isEnabled(self):
|
||||||
return super(Boxcar, self) and self.conf('email')
|
return super(Boxcar, self).isEnabled() and self.conf('email')
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ class FileManager(Plugin):
|
|||||||
def add(self, path = '', part = 1, type = (), available = 1, properties = {}):
|
def add(self, path = '', part = 1, type = (), available = 1, properties = {}):
|
||||||
db = get_session()
|
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:
|
if not f:
|
||||||
f = File()
|
f = File()
|
||||||
db.add(f)
|
db.add(f)
|
||||||
|
|
||||||
f.path = path
|
f.path = toUnicode(path)
|
||||||
f.part = part
|
f.part = part
|
||||||
f.available = available
|
f.available = available
|
||||||
f.type_id = self.getType(type).id
|
f.type_id = self.getType(type).id
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from couchpotato import get_session
|
from couchpotato import get_session
|
||||||
from couchpotato.core.event import addEvent, fireEventAsync, fireEvent
|
from couchpotato.core.event import addEvent, fireEventAsync, fireEvent
|
||||||
|
from couchpotato.core.helpers.encoding import toUnicode
|
||||||
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 Library, LibraryTitle, File, \
|
from couchpotato.core.settings.model import Library, LibraryTitle, File, \
|
||||||
@@ -26,13 +27,13 @@ class LibraryPlugin(Plugin):
|
|||||||
l = Library(
|
l = Library(
|
||||||
year = attrs.get('year'),
|
year = attrs.get('year'),
|
||||||
identifier = attrs.get('identifier'),
|
identifier = attrs.get('identifier'),
|
||||||
plot = attrs.get('plot'),
|
plot = toUnicode(attrs.get('plot')),
|
||||||
tagline = attrs.get('tagline'),
|
tagline = toUnicode(attrs.get('tagline')),
|
||||||
status_id = status.get('id')
|
status_id = status.get('id')
|
||||||
)
|
)
|
||||||
|
|
||||||
title = LibraryTitle(
|
title = LibraryTitle(
|
||||||
title = attrs.get('title')
|
title = toUnicode(attrs.get('title'))
|
||||||
)
|
)
|
||||||
|
|
||||||
l.titles.append(title)
|
l.titles.append(title)
|
||||||
@@ -68,8 +69,8 @@ class LibraryPlugin(Plugin):
|
|||||||
|
|
||||||
# Main info
|
# Main info
|
||||||
if do_update:
|
if do_update:
|
||||||
library.plot = info.get('plot', '')
|
library.plot = toUnicode(info.get('plot', ''))
|
||||||
library.tagline = info.get('tagline', '')
|
library.tagline = toUnicode(info.get('tagline', ''))
|
||||||
library.year = info.get('year', 0)
|
library.year = info.get('year', 0)
|
||||||
library.status_id = done_status.get('id')
|
library.status_id = done_status.get('id')
|
||||||
db.commit()
|
db.commit()
|
||||||
@@ -82,7 +83,7 @@ class LibraryPlugin(Plugin):
|
|||||||
log.debug('Adding titles: %s' % titles)
|
log.debug('Adding titles: %s' % titles)
|
||||||
for title in titles:
|
for title in titles:
|
||||||
t = LibraryTitle(
|
t = LibraryTitle(
|
||||||
title = title,
|
title = toUnicode(title),
|
||||||
default = title.lower() == default_title.lower()
|
default = title.lower() == default_title.lower()
|
||||||
)
|
)
|
||||||
library.titles.append(t)
|
library.titles.append(t)
|
||||||
@@ -97,7 +98,7 @@ class LibraryPlugin(Plugin):
|
|||||||
log.debug('Adding genres: %s' % genres)
|
log.debug('Adding genres: %s' % genres)
|
||||||
for genre in genres:
|
for genre in genres:
|
||||||
g = LibraryGenre(
|
g = LibraryGenre(
|
||||||
name = genre
|
name = toUnicode(genre)
|
||||||
)
|
)
|
||||||
library.genres.append(g)
|
library.genres.append(g)
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class ProfilePlugin(Plugin):
|
|||||||
p = Profile()
|
p = Profile()
|
||||||
db.add(p)
|
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.order = params.get('order', p.order if p.order else 0)
|
||||||
p.core = params.get('core', False)
|
p.core = params.get('core', False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user