From e124e1c3fd90052b0f2a069ca5f776418b4ac68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Tue, 16 Oct 2018 21:15:42 -0400 Subject: [PATCH 1/8] Fix to create daemon stop and restart file in config_dir. Add a fix for automatic reloading after restart when using a reverse proxy with SSL. --- bazarr.py | 16 +++++++++++++--- bazarr/main.py | 4 ++-- views/menu.tpl | 6 ++++-- views/system.tpl | 6 ++++-- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/bazarr.py b/bazarr.py index 06c39ead2..44511a4b1 100644 --- a/bazarr.py +++ b/bazarr.py @@ -5,6 +5,9 @@ import os import sys import getopt +config_dir = os.path.join(os.path.dirname(__file__), 'data/') +no_update = False + arguments = [] try: opts, args = getopt.getopt(sys.argv[1:],"h:",["no-update", "config="]) @@ -13,7 +16,14 @@ except getopt.GetoptError: sys.exit(2) for opt, arg in opts: arguments.append(opt) - if arg != '': + if opt == '-h': + print 'bazarr.py -h --no-update --config ' + sys.exit() + elif opt in ("--no-update"): + no_update = True + elif opt in ("--config"): + config_dir = arg + elif arg != '': arguments.append(arg) @@ -32,8 +42,8 @@ def start_bazarr(): if __name__ == '__main__': - restartfile = os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr.restart')) - stopfile = os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr.stop')) + restartfile = os.path.normcase(os.path.join(config_dir, 'bazarr.restart')) + stopfile = os.path.normcase(os.path.join(config_dir, 'bazarr.stop')) try: os.remove(restartfile) diff --git a/bazarr/main.py b/bazarr/main.py index e6be41237..178bf300e 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -199,7 +199,7 @@ def redirect_root(): @route(base_url + 'shutdown') def shutdown(): try: - stop_file = open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "bazarr.stop"), "w") + stop_file = open(os.path.join(config_dir, "bazarr.stop"), "w") except Exception as e: logging.error('Cannot create bazarr.stop file.') else: @@ -215,7 +215,7 @@ def restart(): logging.error('Cannot stop CherryPy.') else: try: - restart_file = open(os.path.join(os.path.dirname(os.path.dirname(__file__)), "bazarr.restart"), "w") + restart_file = open(os.path.join(config_dir, "bazarr.restart"), "w") except Exception as e: logging.error('Cannot create bazarr.restart file.') else: diff --git a/views/menu.tpl b/views/menu.tpl index 15a9f27b1..1cabb40be 100644 --- a/views/menu.tpl +++ b/views/menu.tpl @@ -190,11 +190,13 @@ public_ip = "{{ip}}"; } + protocol = window.location.protocol; + function ping() { $.ajax({ - url: 'http://' + public_ip + ':{{port}}{{base_url}}', + url: protocol + '://' + public_ip + ':{{port}}{{base_url}}', success: function(result) { - window.location.href= 'http://' + public_ip + ':{{port}}{{base_url}}'; + window.location.href= protocol + '://' + public_ip + ':{{port}}{{base_url}}'; } }); } diff --git a/views/system.tpl b/views/system.tpl index 9cd3163de..7022ee5c5 100644 --- a/views/system.tpl +++ b/views/system.tpl @@ -246,11 +246,13 @@ public_ip = "{{ip}}"; } + protocol = window.location.protocol; + function ping() { $.ajax({ - url: 'http://' + public_ip + ':{{port}}{{base_url}}', + url: protocol + '://' + public_ip + ':{{port}}{{base_url}}', success: function(result) { - window.location.href= 'http://' + public_ip + ':{{port}}{{base_url}}'; + window.location.href= protocol + '://' + public_ip + ':{{port}}{{base_url}}'; } }); } From 376ee719fbc0a98c1208871c256280960fb76142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Tue, 16 Oct 2018 21:55:30 -0400 Subject: [PATCH 2/8] Fix for arguments not passed correctly to child process. --- bazarr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bazarr.py b/bazarr.py index 44511a4b1..405158a2b 100644 --- a/bazarr.py +++ b/bazarr.py @@ -16,6 +16,9 @@ except getopt.GetoptError: sys.exit(2) for opt, arg in opts: arguments.append(opt) + if arg != '': + arguments.append(arg) + if opt == '-h': print 'bazarr.py -h --no-update --config ' sys.exit() @@ -23,8 +26,6 @@ for opt, arg in opts: no_update = True elif opt in ("--config"): config_dir = arg - elif arg != '': - arguments.append(arg) dir_name = os.path.dirname(__file__) From fb2860396ae6d2c417b9fcda36aaa492e4931207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Tue, 16 Oct 2018 22:04:07 -0400 Subject: [PATCH 3/8] Fix for incorrect reloading URL --- views/menu.tpl | 4 ++-- views/system.tpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/views/menu.tpl b/views/menu.tpl index 1cabb40be..42b0efc0e 100644 --- a/views/menu.tpl +++ b/views/menu.tpl @@ -194,9 +194,9 @@ function ping() { $.ajax({ - url: protocol + '://' + public_ip + ':{{port}}{{base_url}}', + url: protocol + '//' + public_ip + ':{{port}}{{base_url}}', success: function(result) { - window.location.href= protocol + '://' + public_ip + ':{{port}}{{base_url}}'; + window.location.href= protocol + '//' + public_ip + ':{{port}}{{base_url}}'; } }); } diff --git a/views/system.tpl b/views/system.tpl index 7022ee5c5..c92bc9e97 100644 --- a/views/system.tpl +++ b/views/system.tpl @@ -250,9 +250,9 @@ function ping() { $.ajax({ - url: protocol + '://' + public_ip + ':{{port}}{{base_url}}', + url: protocol + '//' + public_ip + ':{{port}}{{base_url}}', success: function(result) { - window.location.href= protocol + '://' + public_ip + ':{{port}}{{base_url}}'; + window.location.href= protocol + '//' + public_ip + ':{{port}}{{base_url}}'; } }); } From 09206a91d8b6ac6c20dca050339a18424405c2f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Tue, 16 Oct 2018 23:25:04 -0400 Subject: [PATCH 4/8] Fix for reverse proxy port and loader message when restarting. --- bazarr/main.py | 30 +++++++++++++++--------------- views/history.tpl | 2 +- views/historymovies.tpl | 2 +- views/historyseries.tpl | 2 +- views/logs.tpl | 2 +- views/menu.tpl | 10 ++++++++-- views/movies.tpl | 2 +- views/movieseditor.tpl | 2 +- views/series.tpl | 2 +- views/serieseditor.tpl | 2 +- views/settings.tpl | 2 +- views/system.tpl | 10 ++++++++-- 12 files changed, 40 insertions(+), 28 deletions(-) diff --git a/bazarr/main.py b/bazarr/main.py index 178bf300e..43eb39982 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -324,7 +324,7 @@ def series(): c.execute("SELECT table_shows.sonarrSeriesId, COUNT(table_episodes.missing_subtitles) FROM table_shows LEFT JOIN table_episodes ON table_shows.sonarrSeriesId=table_episodes.sonarrSeriesId WHERE table_shows.languages IS NOT 'None' GROUP BY table_shows.sonarrSeriesId") total_subtitles_list = c.fetchall() c.close() - output = template('series', __file__=__file__, bazarr_version=bazarr_version, rows=data, missing_subtitles_list=missing_subtitles_list, total_subtitles_list=total_subtitles_list, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, single_language=single_language, page_size=page_size) + output = template('series', __file__=__file__, bazarr_version=bazarr_version, rows=data, missing_subtitles_list=missing_subtitles_list, total_subtitles_list=total_subtitles_list, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, single_language=single_language, page_size=page_size, current_port=port) return output @route(base_url + 'serieseditor') @@ -346,7 +346,7 @@ def serieseditor(): c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1") languages = c.fetchall() c.close() - output = template('serieseditor', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, base_url=base_url, single_language=single_language) + output = template('serieseditor', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, base_url=base_url, single_language=single_language, current_port=port) return output @@ -471,7 +471,7 @@ def episodes(no): for key, season in itertools.groupby(episodes,operator.itemgetter(2)): seasons_list.append(list(season)) - return template('episodes', __file__=__file__, bazarr_version=bazarr_version, no=no, details=series_details, languages=languages, seasons=seasons_list, url_sonarr_short=url_sonarr_short, base_url=base_url, tvdbid=tvdbid, number=number) + return template('episodes', __file__=__file__, bazarr_version=bazarr_version, no=no, details=series_details, languages=languages, seasons=seasons_list, url_sonarr_short=url_sonarr_short, base_url=base_url, tvdbid=tvdbid, number=number, current_port=port) @route(base_url + 'movies') @custom_auth_basic(check_credentials) @@ -498,7 +498,7 @@ def movies(): c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1") languages = c.fetchall() c.close() - output = template('movies', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, single_language=single_language, page_size=page_size) + output = template('movies', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, single_language=single_language, page_size=page_size, current_port=port) return output @route(base_url + 'movieseditor') @@ -520,7 +520,7 @@ def movieseditor(): c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1") languages = c.fetchall() c.close() - output = template('movieseditor', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, base_url=base_url, single_language=single_language) + output = template('movieseditor', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, base_url=base_url, single_language=single_language, current_port=port) return output @route(base_url + 'edit_movieseditor', method='POST') @@ -605,7 +605,7 @@ def movie(no): languages = c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1").fetchall() c.close() - return template('movie', __file__=__file__, bazarr_version=bazarr_version, no=no, details=movies_details, languages=languages, url_radarr_short=url_radarr_short, base_url=base_url, tmdbid=tmdbid) + return template('movie', __file__=__file__, bazarr_version=bazarr_version, no=no, details=movies_details, languages=languages, url_radarr_short=url_radarr_short, base_url=base_url, tmdbid=tmdbid, current_port=port) @route(base_url + 'scan_disk/', method='GET') @custom_auth_basic(check_credentials) @@ -651,7 +651,7 @@ def search_missing_subtitles_movie(no): @custom_auth_basic(check_credentials) def history(): authorize() - return template('history', __file__=__file__, bazarr_version=bazarr_version, base_url=base_url) + return template('history', __file__=__file__, bazarr_version=bazarr_version, base_url=base_url, current_port=port) @route(base_url + 'historyseries') @custom_auth_basic(check_credentials) @@ -689,7 +689,7 @@ def historyseries(): data = c.fetchall() c.close() data = reversed(sorted(data, key=operator.itemgetter(4))) - return template('historyseries', __file__=__file__, bazarr_version=bazarr_version, rows=data, row_count=row_count, page=page, max_page=max_page, stats=stats, base_url=base_url, page_size=page_size) + return template('historyseries', __file__=__file__, bazarr_version=bazarr_version, rows=data, row_count=row_count, page=page, max_page=max_page, stats=stats, base_url=base_url, page_size=page_size, current_port=port) @route(base_url + 'historymovies') @custom_auth_basic(check_credentials) @@ -727,13 +727,13 @@ def historymovies(): data = c.fetchall() c.close() data = reversed(sorted(data, key=operator.itemgetter(2))) - return template('historymovies', __file__=__file__, bazarr_version=bazarr_version, rows=data, row_count=row_count, page=page, max_page=max_page, stats=stats, base_url=base_url, page_size=page_size) + return template('historymovies', __file__=__file__, bazarr_version=bazarr_version, rows=data, row_count=row_count, page=page, max_page=max_page, stats=stats, base_url=base_url, page_size=page_size, current_port=port) @route(base_url + 'wanted') @custom_auth_basic(check_credentials) def wanted(): authorize() - return template('wanted', __file__=__file__, bazarr_version=bazarr_version, base_url=base_url) + return template('wanted', __file__=__file__, bazarr_version=bazarr_version, base_url=base_url, current_port=port) @route(base_url + 'wantedseries') @custom_auth_basic(check_credentials) @@ -761,7 +761,7 @@ def wantedseries(): c.execute("SELECT table_shows.title, table_episodes.season || 'x' || table_episodes.episode, table_episodes.title, table_episodes.missing_subtitles, table_episodes.sonarrSeriesId, path_substitution(table_episodes.path), table_shows.hearing_impaired, table_episodes.sonarrEpisodeId, table_episodes.scene_name FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.missing_subtitles != '[]'" + monitored_only_query_string + " ORDER BY table_episodes._rowid_ DESC LIMIT ? OFFSET ?", (page_size, offset,)) data = c.fetchall() c.close() - return template('wantedseries', __file__=__file__, bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, page_size=page_size) + return template('wantedseries', __file__=__file__, bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, page_size=page_size, current_port=port) @route(base_url + 'wantedmovies') @custom_auth_basic(check_credentials) @@ -789,7 +789,7 @@ def wantedmovies(): c.execute("SELECT title, missing_subtitles, radarrId, path_substitution(path), hearing_impaired, sceneName FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string + " ORDER BY _rowid_ DESC LIMIT ? OFFSET ?", (page_size, offset,)) data = c.fetchall() c.close() - return template('wantedmovies', __file__=__file__, bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, page_size=page_size) + return template('wantedmovies', __file__=__file__, bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, page_size=page_size, current_port=port) @route(base_url + 'wanted_search_missing_subtitles') @custom_auth_basic(check_credentials) @@ -822,7 +822,7 @@ def settings(): settings_sonarr = get_sonarr_settings() settings_radarr = get_radarr_settings() - return template('settings', __file__=__file__, bazarr_version=bazarr_version, settings_general=settings_general, settings_proxy=settings_proxy, settings_auth=settings_auth, settings_languages=settings_languages, settings_providers=settings_providers, settings_sonarr=settings_sonarr, settings_radarr=settings_radarr, settings_notifier=settings_notifier, base_url=base_url) + return template('settings', __file__=__file__, bazarr_version=bazarr_version, settings_general=settings_general, settings_proxy=settings_proxy, settings_auth=settings_auth, settings_languages=settings_languages, settings_providers=settings_providers, settings_sonarr=settings_sonarr, settings_radarr=settings_radarr, settings_notifier=settings_notifier, base_url=base_url, current_port=port) @route(base_url + 'save_settings', method='POST') @custom_auth_basic(check_credentials) @@ -1435,7 +1435,7 @@ def system(): for release in r.json(): releases.append([release['name'],release['body']]) - return template('system', __file__=__file__, bazarr_version=bazarr_version, base_url=base_url, task_list=task_list, row_count=row_count, max_page=max_page, page_size=page_size, releases=releases) + return template('system', __file__=__file__, bazarr_version=bazarr_version, base_url=base_url, task_list=task_list, row_count=row_count, max_page=max_page, page_size=page_size, releases=releases, current_port=port) @route(base_url + 'logs/') @custom_auth_basic(check_credentials) @@ -1449,7 +1449,7 @@ def get_logs(page): logs_complete.append(line.rstrip()) logs = logs_complete[begin:end] - return template('logs', logs=logs, base_url=base_url) + return template('logs', logs=logs, base_url=base_url, current_port=port) @route(base_url + 'execute/') @custom_auth_basic(check_credentials) diff --git a/views/history.tpl b/views/history.tpl index b4916a2b3..cdabe9b15 100644 --- a/views/history.tpl +++ b/views/history.tpl @@ -46,7 +46,7 @@
-
Loading...
+
Loading...
% include('menu.tpl') diff --git a/views/historymovies.tpl b/views/historymovies.tpl index 0221e74be..e25b537e7 100644 --- a/views/historymovies.tpl +++ b/views/historymovies.tpl @@ -47,7 +47,7 @@
-
Loading...
+
Loading...
diff --git a/views/historyseries.tpl b/views/historyseries.tpl index e6c7880ee..0542f9ba2 100644 --- a/views/historyseries.tpl +++ b/views/historyseries.tpl @@ -47,7 +47,7 @@
-
Loading...
+
Loading...
diff --git a/views/logs.tpl b/views/logs.tpl index ada48b4ce..ea8fe473f 100644 --- a/views/logs.tpl +++ b/views/logs.tpl @@ -14,7 +14,7 @@
-
Loading...
+
Loading...
diff --git a/views/menu.tpl b/views/menu.tpl index 42b0efc0e..997b1a452 100644 --- a/views/menu.tpl +++ b/views/menu.tpl @@ -192,11 +192,17 @@ protocol = window.location.protocol; + if (window.location.port == '{{current_port}}') { + public_port = '{{port}}'; + } else { + public_port = window.location.port; + } + function ping() { $.ajax({ - url: protocol + '//' + public_ip + ':{{port}}{{base_url}}', + url: protocol + '//' + public_ip + ':' + public_port + '{{base_url}}', success: function(result) { - window.location.href= protocol + '//' + public_ip + ':{{port}}{{base_url}}'; + window.location.href= protocol + '//' + public_ip + ':' + public_port + '{{base_url}}'; } }); } diff --git a/views/movies.tpl b/views/movies.tpl index 058c36d2c..3a321fbb7 100644 --- a/views/movies.tpl +++ b/views/movies.tpl @@ -45,7 +45,7 @@
-
Loading...
+
Loading...
% include('menu.tpl') diff --git a/views/movieseditor.tpl b/views/movieseditor.tpl index bc3e96f98..7a51b55a9 100644 --- a/views/movieseditor.tpl +++ b/views/movieseditor.tpl @@ -49,7 +49,7 @@
-
Loading...
+
Loading...
% include('menu.tpl') diff --git a/views/series.tpl b/views/series.tpl index 5c9a5fd63..8aad09843 100644 --- a/views/series.tpl +++ b/views/series.tpl @@ -45,7 +45,7 @@
-
Loading...
+
Loading...
% include('menu.tpl') diff --git a/views/serieseditor.tpl b/views/serieseditor.tpl index cfc311db1..2b9d867e3 100644 --- a/views/serieseditor.tpl +++ b/views/serieseditor.tpl @@ -49,7 +49,7 @@
-
Loading...
+
Loading...
% include('menu.tpl') diff --git a/views/settings.tpl b/views/settings.tpl index 1648fc06e..b698ce56b 100644 --- a/views/settings.tpl +++ b/views/settings.tpl @@ -37,7 +37,7 @@
-
Loading...
+
Loading...
% include('menu.tpl') diff --git a/views/system.tpl b/views/system.tpl index c92bc9e97..a2882b14c 100644 --- a/views/system.tpl +++ b/views/system.tpl @@ -248,11 +248,17 @@ protocol = window.location.protocol; + if (window.location.port == '{{current_port}}') { + public_port = '{{port}}'; + } else { + public_port = window.location.port; + } + function ping() { $.ajax({ - url: protocol + '//' + public_ip + ':{{port}}{{base_url}}', + url: protocol + '//' + public_ip + ':' + public_port + '{{base_url}}', success: function(result) { - window.location.href= protocol + '//' + public_ip + ':{{port}}{{base_url}}'; + window.location.href= protocol + '//' + public_ip + ':' + public_port + '{{base_url}}'; } }); } From 4dfc250287aa60734588cf07ec3ba3417ac286b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Wed, 17 Oct 2018 00:21:24 -0400 Subject: [PATCH 5/8] Fix for Subliminal exception: 'list' object has no attribute 'lower'. This is panni's fix. --- libs/subliminal/subtitle.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/libs/subliminal/subtitle.py b/libs/subliminal/subtitle.py index 83beab63a..53313a7c7 100644 --- a/libs/subliminal/subtitle.py +++ b/libs/subliminal/subtitle.py @@ -6,6 +6,8 @@ import os import chardet import pysrt +import types + from .score import get_equivalent_release_groups from .video import Episode, Movie from .utils import sanitize, sanitize_release_group @@ -238,11 +240,24 @@ def guess_matches(video, guess, partial=False): if video.resolution and 'screen_size' in guess and guess['screen_size'] == video.resolution: matches.add('resolution') # format - # Guessit may return a list for `format`, which indicates a conflict in the guessing. - # We should match `format` only when it returns single value to avoid false `format` matches - if video.format and guess.get('format') and not isinstance(guess['format'], list) \ - and guess['format'].lower() == video.format.lower(): - matches.add('format') + if 'format' in guess: + formats = guess["format"] + if not isinstance(formats, types.ListType): + formats = [formats] + + if video.format: + video_format = video.format + if video_format in ("HDTV", "SDTV", "TV"): + video_format = "TV" + logger.debug("Treating HDTV/SDTV the same") + + for frmt in formats: + if frmt in ("HDTV", "SDTV"): + frmt = "TV" + + if frmt.lower() == video_format.lower(): + matches.add('format') + break # video_codec if video.video_codec and 'video_codec' in guess and guess['video_codec'] == video.video_codec: matches.add('video_codec') From 3c1532148a9ffdb2fd62a52e2b05305e10102491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Wed, 17 Oct 2018 06:24:13 -0400 Subject: [PATCH 6/8] Second part of previous fix. --- libs/subliminal/subtitle.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libs/subliminal/subtitle.py b/libs/subliminal/subtitle.py index 53313a7c7..eb4a985ef 100644 --- a/libs/subliminal/subtitle.py +++ b/libs/subliminal/subtitle.py @@ -232,10 +232,17 @@ def guess_matches(video, guess, partial=False): if video.title and 'title' in guess and sanitize(guess['title']) == sanitize(video.title): matches.add('title') # release_group - if (video.release_group and 'release_group' in guess and - sanitize_release_group(guess['release_group']) in - get_equivalent_release_groups(sanitize_release_group(video.release_group))): - matches.add('release_group') + if 'release_group' in guess: + release_groups = guess["release_group"] + if not isinstance(release_groups, types.ListType): + release_groups = [release_groups] + + if video.release_group: + for release_group in release_groups: + if (sanitize_release_group(release_group) in + get_equivalent_release_groups(sanitize_release_group(video.release_group))): + matches.add('release_group') + break # resolution if video.resolution and 'screen_size' in guess and guess['screen_size'] == video.resolution: matches.add('resolution') From fda9badc95c5264ff904280392cbe9a4509ef8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Wed, 17 Oct 2018 20:51:34 -0400 Subject: [PATCH 7/8] Fix for check_update working directory after moving every python script to bazarr subdirectory. --- bazarr/check_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazarr/check_update.py b/bazarr/check_update.py index 23d5f22ea..f5a87764f 100644 --- a/bazarr/check_update.py +++ b/bazarr/check_update.py @@ -8,7 +8,7 @@ import sqlite3 import git -current_working_directory = os.path.dirname(__file__) +current_working_directory = os.path.dirname(os.path.dirname(__file__)) def gitconfig(): g = git.Repo.init(current_working_directory) From f56912d1d83d43c4590adc4faabf26a2a8f01d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Wed, 17 Oct 2018 20:52:44 -0400 Subject: [PATCH 8/8] Fix for test Sonarr and Radarr connection not working caused by an unencoded url. --- bazarr/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bazarr/main.py b/bazarr/main.py index 43eb39982..992e56d0d 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -87,6 +87,7 @@ import math import ast import hashlib import time +import urllib from get_languages import load_language_in_db, language_from_alpha3 from get_providers import load_providers, get_providers, get_providers_auth @@ -1689,6 +1690,7 @@ def api_history(): @route(base_url + 'test_url//', method='GET') @custom_auth_basic(check_credentials) def test_url(protocol, url): + url = urllib.unquote(url) try: result = requests.get(protocol + "://" + url, allow_redirects=False).json()['version'] except: