diff --git a/bazarr/get_series.py b/bazarr/get_series.py index c909dda09..1cd46b2ef 100644 --- a/bazarr/get_series.py +++ b/bazarr/get_series.py @@ -84,7 +84,7 @@ def update_series(): # Add shows in Sonarr to current shows list current_shows_sonarr.append(show['id']) - if show['tvdbId'] in current_shows_db_list: + if show['id'] in current_shows_db_list: series_to_update.append({'title': six.text_type(show["title"]), 'path': six.text_type(show["path"]), 'tvdbId': int(show["tvdbId"]), diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index 81d2e8a6e..be4d36ad2 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -249,6 +249,11 @@ def download_subtitle(path, language, hi, forced, providers, providers_auth, sce if os.name == 'nt': out = out.decode(encoding) + + try: + out = out.decode(sys.stdout.encoding) + except (UnicodeDecodeError, AttributeError): + pass except: if out == "": @@ -474,6 +479,11 @@ def manual_download_subtitle(path, language, hi, forced, subtitle, provider, pro if os.name == 'nt': out = out.decode(encoding) + + try: + out = out.decode(sys.stdout.encoding) + except (UnicodeDecodeError, AttributeError): + pass except: if out == "": diff --git a/bazarr/main.py b/bazarr/main.py index 696bc6f68..0a149e31c 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -1,6 +1,6 @@ # coding=utf-8 -bazarr_version = '0.8.4' +bazarr_version = '0.8.4.1' import os os.environ["SZ_USER_AGENT"] = "Bazarr/1" @@ -1749,9 +1749,9 @@ def execute_task(taskid): @custom_auth_basic(check_credentials) def remove_subtitles(): authorize() - episodePath = request.forms.get('episodePath') + episodePath = request.forms.episodePath language = request.forms.get('language') - subtitlesPath = request.forms.get('subtitlesPath') + subtitlesPath = request.forms.subtitlesPath sonarrSeriesId = request.forms.get('sonarrSeriesId') sonarrEpisodeId = request.forms.get('sonarrEpisodeId') @@ -1768,9 +1768,9 @@ def remove_subtitles(): @custom_auth_basic(check_credentials) def remove_subtitles_movie(): authorize() - moviePath = request.forms.get('moviePath') + moviePath = request.forms.moviePath language = request.forms.get('language') - subtitlesPath = request.forms.get('subtitlesPath') + subtitlesPath = request.forms.subtitlesPath radarrId = request.forms.get('radarrId') try: @@ -1788,14 +1788,14 @@ def get_subtitle(): authorize() ref = request.environ['HTTP_REFERER'] - episodePath = request.forms.get('episodePath') - sceneName = request.forms.get('sceneName') + episodePath = request.forms.episodePath + sceneName = request.forms.sceneName language = request.forms.get('language') hi = request.forms.get('hi') forced = request.forms.get('forced') sonarrSeriesId = request.forms.get('sonarrSeriesId') sonarrEpisodeId = request.forms.get('sonarrEpisodeId') - title = request.forms.get('title') + title = request.forms.title providers_list = get_providers() providers_auth = get_providers_auth() @@ -1823,12 +1823,12 @@ def get_subtitle(): def manual_search_json(): authorize() - episodePath = request.forms.get('episodePath') - sceneName = request.forms.get('sceneName') + episodePath = request.forms.episodePath + sceneName = request.forms.sceneName language = request.forms.get('language') hi = request.forms.get('hi') forced = request.forms.get('forced') - title = request.forms.get('title') + title = request.forms.title providers_list = get_providers() providers_auth = get_providers_auth() @@ -1843,16 +1843,16 @@ def manual_get_subtitle(): authorize() ref = request.environ['HTTP_REFERER'] - episodePath = request.forms.get('episodePath') - sceneName = request.forms.get('sceneName') + episodePath = request.forms.episodePath + sceneName = request.forms.sceneName language = request.forms.get('language') hi = request.forms.get('hi') forced = request.forms.get('forced') selected_provider = request.forms.get('provider') - subtitle = request.forms.get('subtitle') + subtitle = request.forms.subtitle sonarrSeriesId = request.forms.get('sonarrSeriesId') sonarrEpisodeId = request.forms.get('sonarrEpisodeId') - title = request.forms.get('title') + title = request.forms.title providers_auth = get_providers_auth() @@ -1881,14 +1881,14 @@ def perform_manual_upload_subtitle(): authorize() ref = request.environ['HTTP_REFERER'] - episodePath = request.forms.get('episodePath') - sceneName = request.forms.get('sceneName') + episodePath = request.forms.episodePath + sceneName = request.forms.sceneName language = request.forms.get('language') forced = True if request.forms.get('forced') == '1' else False upload = request.files.get('upload') sonarrSeriesId = request.forms.get('sonarrSeriesId') sonarrEpisodeId = request.forms.get('sonarrEpisodeId') - title = request.forms.get('title') + title = request.forms.title _, ext = os.path.splitext(upload.filename) @@ -1925,13 +1925,13 @@ def get_subtitle_movie(): authorize() ref = request.environ['HTTP_REFERER'] - moviePath = request.forms.get('moviePath') - sceneName = request.forms.get('sceneName') + moviePath = request.forms.moviePath + sceneName = request.forms.sceneName language = request.forms.get('language') hi = request.forms.get('hi') forced = request.forms.get('forced') radarrId = request.forms.get('radarrId') - title = request.forms.get('title') + title = request.forms.title providers_list = get_providers() providers_auth = get_providers_auth() @@ -1959,12 +1959,12 @@ def get_subtitle_movie(): def manual_search_movie_json(): authorize() - moviePath = request.forms.get('moviePath') - sceneName = request.forms.get('sceneName') + moviePath = request.forms.moviePath + sceneName = request.forms.sceneName language = request.forms.get('language') hi = request.forms.get('hi') forced = request.forms.get('forced') - title = request.forms.get('title') + title = request.forms.title providers_list = get_providers() providers_auth = get_providers_auth() @@ -1979,15 +1979,15 @@ def manual_get_subtitle_movie(): authorize() ref = request.environ['HTTP_REFERER'] - moviePath = request.forms.get('moviePath') - sceneName = request.forms.get('sceneName') + moviePath = request.forms.moviePath + sceneName = request.forms.sceneName language = request.forms.get('language') hi = request.forms.get('hi') forced = request.forms.get('forced') - selected_provider = request.forms.get('provider') - subtitle = request.forms.get('subtitle') + selected_provider = request.forms.provider + subtitle = request.forms.subtitle radarrId = request.forms.get('radarrId') - title = request.forms.get('title') + title = request.forms.title providers_auth = get_providers_auth() @@ -2015,13 +2015,13 @@ def perform_manual_upload_subtitle_movie(): authorize() ref = request.environ['HTTP_REFERER'] - moviePath = request.forms.get('moviePath') - sceneName = request.forms.get('sceneName') + moviePath = request.forms.moviePath + sceneName = request.forms.sceneName language = request.forms.get('language') forced = True if request.forms.get('forced') == '1' else False upload = request.files.get('upload') radarrId = request.forms.get('radarrId') - title = request.forms.get('title') + title = request.forms.title _, ext = os.path.splitext(upload.filename) diff --git a/libs/tzlocal/unix.py b/libs/tzlocal/unix.py index 388273c27..8574965a5 100644 --- a/libs/tzlocal/unix.py +++ b/libs/tzlocal/unix.py @@ -138,7 +138,7 @@ def _get_localzone(_root='/'): if os.path.exists(tzpath) and os.path.islink(tzpath): tzpath = os.path.realpath(tzpath) start = tzpath.find("/")+1 - while start is not 0: + while start != 0: tzpath = tzpath[start:] try: return pytz.timezone(tzpath)