From 68cbfc4d849ccd3f13dbf01b626084217c6accae Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 11 Jul 2012 01:00:56 +0200 Subject: [PATCH] Send unicode to Subliminal --- couchpotato/core/plugins/scanner/main.py | 4 ++-- couchpotato/core/plugins/subtitle/main.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/scanner/main.py b/couchpotato/core/plugins/scanner/main.py index d31726fd..43547b89 100644 --- a/couchpotato/core/plugins/scanner/main.py +++ b/couchpotato/core/plugins/scanner/main.py @@ -460,7 +460,7 @@ class Scanner(Plugin): scan_result = [] for p in paths: if not group['is_dvd']: - video = Video.from_path(p) + video = Video.from_path(toUnicode(p)) video_result = [(video, video.scan())] scan_result.extend(video_result) @@ -782,7 +782,7 @@ class Scanner(Plugin): guess = {} if file_name: try: - guess = guess_movie_info(file_name) + guess = guess_movie_info(toUnicode(file_name)) if guess.get('title') and guess.get('year'): guess = { 'name': guess.get('title'), diff --git a/couchpotato/core/plugins/subtitle/main.py b/couchpotato/core/plugins/subtitle/main.py index 56bda59f..0efb9110 100644 --- a/couchpotato/core/plugins/subtitle/main.py +++ b/couchpotato/core/plugins/subtitle/main.py @@ -1,5 +1,6 @@ from couchpotato import get_session from couchpotato.core.event import addEvent, 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, FileType @@ -48,9 +49,11 @@ class Subtitle(Plugin): try: available_languages = sum(group['subtitle_language'].itervalues(), []) downloaded = [] + files = [toUnicode(x) for x in group['files']['movie']] + for lang in self.getLanguages(): if lang not in available_languages: - download = subliminal.download_subtitles(group['files']['movie'], multi = True, force = False, languages = [lang], services = self.services, cache_dir = Env.get('cache_dir')) + download = subliminal.download_subtitles(files, multi = True, force = False, languages = [lang], services = self.services, cache_dir = Env.get('cache_dir')) downloaded.extend(download) for d_sub in downloaded: @@ -62,5 +65,7 @@ class Subtitle(Plugin): except: log.error('Failed searching for subtitle: %s', (traceback.format_exc())) + return False + def getLanguages(self): return [x.strip() for x in self.conf('languages').split(',')]