Browse Source

fixes UnicodeEncodeError for automation scripts

pull/7166/head
Jean-Michel Lehker 8 years ago
parent
commit
934af86fce
  1. 5
      couchpotato/core/media/movie/providers/automation/base.py

5
couchpotato/core/media/movie/providers/automation/base.py

@ -1,4 +1,5 @@
import time
import unicodedata
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.logger import CPLog
@ -45,7 +46,11 @@ class Automation(AutomationBase):
def search(self, name, year = None, imdb_only = False):
try:
cache_name = name.decode('utf-8').encode('ascii', 'ignore')
except UnicodeEncodeError:
cache_name = unicodedata.normalize('NFKD', name).encode('ascii','ignore')
prop_name = 'automation.cached.%s.%s' % (cache_name, year)
cached_imdb = Env.prop(prop_name, default = False)
if cached_imdb and imdb_only:

Loading…
Cancel
Save