Browse Source

Merge pull request #7166 from jlehker/unicode-decode-error-fix

fixes UnicodeEncodeError for automation scripts
pull/7154/head
Ruud Burger 8 years ago
committed by GitHub
parent
commit
0d9bbeeef1
  1. 7
      couchpotato/core/media/movie/providers/automation/base.py

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

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

Loading…
Cancel
Save