Merge branch 'development' into halali

pull/249/head
morpheus65535 6 years ago
commit 1fb0a4078f

@ -45,7 +45,7 @@ If you need something that is not already part of Bazarr, feel free to create a
You can get more in the [screenshot](https://github.com/morpheus65535/bazarr/tree/master/screenshot) directory but it should look familiar: You can get more in the [screenshot](https://github.com/morpheus65535/bazarr/tree/master/screenshot) directory but it should look familiar:
![Series](/screenshot/series.png?raw=true "Series") ![Series](/screenshot/1-series/series-2-episodes.png?raw=true "Series")
### License ### License

@ -97,7 +97,7 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName,
logging.debug('BAZARR ' + str(len(subtitles_list)) + " subtitles have been found for this file: " + path) logging.debug('BAZARR ' + str(len(subtitles_list)) + " subtitles have been found for this file: " + path)
if len(subtitles_list) > 0: if len(subtitles_list) > 0:
try: try:
pdownload_result = False download_result = False
for subtitle in subtitles_list: for subtitle in subtitles_list:
download_result = p.download_subtitle(subtitle) download_result = p.download_subtitle(subtitle)
if download_result == True: if download_result == True:
@ -130,7 +130,7 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName,
downloaded_language = language_from_alpha3(result[0].language.alpha3) downloaded_language = language_from_alpha3(result[0].language.alpha3)
downloaded_language_code2 = alpha2_from_alpha3(result[0].language.alpha3) downloaded_language_code2 = alpha2_from_alpha3(result[0].language.alpha3)
downloaded_language_code3 = result[0].language.alpha3 downloaded_language_code3 = result[0].language.alpha3
downloaded_path = get_subtitle_path(path, language=language_set) downloaded_path = get_subtitle_path(path, downloaded_language_code2)
logging.debug('BAZARR Subtitles file saved to disk: ' + downloaded_path) logging.debug('BAZARR Subtitles file saved to disk: ' + downloaded_path)
if used_sceneName == True: if used_sceneName == True:
message = downloaded_language + " subtitles downloaded from " + downloaded_provider + " with a score of " + unicode(calculated_score) + "% using this scene name: " + sceneName message = downloaded_language + " subtitles downloaded from " + downloaded_provider + " with a score of " + unicode(calculated_score) + "% using this scene name: " + sceneName
@ -235,7 +235,7 @@ def manual_search(path, language, hi, providers, providers_auth, sceneName, medi
if type(s) is LegendasTVSubtitle: if type(s) is LegendasTVSubtitle:
# The pickle doesn't work very well with RAR (rarfile.RarFile) or ZIP (zipfile.ZipFile) # The pickle doesn't work very well with RAR (rarfile.RarFile) or ZIP (zipfile.ZipFile)
s.archive.content = None s.archive.content = None
subtitles_list.append(dict(score=round((compute_score(s, video, hearing_impaired=hi) / max_score * 100), 2), language=alpha2_from_alpha3(s.language.alpha3), hearing_impaired=str(s.hearing_impaired), provider=s.provider_name, subtitle=codecs.encode(pickle.dumps(s), "base64").decode(), url=s.page_link, matches=list(matched), dont_matches=list(not_matched))) subtitles_list.append(dict(score=round((compute_score(s, video, hearing_impaired=hi) / max_score * 100), 2), language=alpha2_from_alpha3(s.language.alpha3), hearing_impaired=str(s.hearing_impaired), provider=s.provider_name, subtitle=codecs.encode(pickle.dumps(s), "base64").decode(), url=s.page_link, matches=list(matched), dont_matches=list(not_matched)))
subtitles_dict = {} subtitles_dict = {}
subtitles_dict = sorted(subtitles_list, key=lambda x: x['score'], reverse=True) subtitles_dict = sorted(subtitles_list, key=lambda x: x['score'], reverse=True)
logging.debug('BAZARR ' + str(len(subtitles_dict)) + " subtitles have been found for this file: " + path) logging.debug('BAZARR ' + str(len(subtitles_dict)) + " subtitles have been found for this file: " + path)
@ -299,7 +299,7 @@ def manual_download_subtitle(path, language, hi, subtitle, provider, providers_a
downloaded_language = language_from_alpha3(result[0].language.alpha3) downloaded_language = language_from_alpha3(result[0].language.alpha3)
downloaded_language_code2 = alpha2_from_alpha3(result[0].language.alpha3) downloaded_language_code2 = alpha2_from_alpha3(result[0].language.alpha3)
downloaded_language_code3 = result[0].language.alpha3 downloaded_language_code3 = result[0].language.alpha3
downloaded_path = get_subtitle_path(path, language=lang_obj) downloaded_path = get_subtitle_path(path, downloaded_language_code2)
logging.debug('BAZARR Subtitles file saved to disk: ' + downloaded_path) logging.debug('BAZARR Subtitles file saved to disk: ' + downloaded_path)
message = downloaded_language + " subtitles downloaded from " + downloaded_provider + " with a score of " + unicode(score) + "% using manual search." message = downloaded_language + " subtitles downloaded from " + downloaded_provider + " with a score of " + unicode(score) + "% using manual search."

@ -54,10 +54,10 @@ def store_subtitles(file):
encoding = UnicodeDammit(text) encoding = UnicodeDammit(text)
try: try:
text = text.decode(encoding.original_encoding) text = text.decode(encoding.original_encoding)
detected_language = langdetect.detect(text)
except Exception as e: except Exception as e:
logging.exception('BAZARR Error trying to detect character encoding for this subtitles file: ' + path_replace(os.path.join(os.path.dirname(file), subtitle)) + ' You should try to delete this subtitles file manually and ask Bazarr to download it again.') logging.exception('BAZARR Error trying to detect character encoding for this subtitles file: ' + path_replace(os.path.join(os.path.dirname(file), subtitle)) + ' You should try to delete this subtitles file manually and ask Bazarr to download it again.')
else: else:
detected_language = langdetect.detect(text)
if len(detected_language) > 0: if len(detected_language) > 0:
actual_subtitles.append([str(detected_language), path_replace_reverse(os.path.join(os.path.dirname(file), subtitle))]) actual_subtitles.append([str(detected_language), path_replace_reverse(os.path.join(os.path.dirname(file), subtitle))])
@ -106,10 +106,10 @@ def store_subtitles_movie(file):
encoding = UnicodeDammit(text) encoding = UnicodeDammit(text)
try: try:
text = text.decode(encoding.original_encoding) text = text.decode(encoding.original_encoding)
detected_language = langdetect.detect(text)
except Exception as e: except Exception as e:
logging.exception('BAZARR Error trying to detect character encoding for this subtitles file: ' + path_replace_movie(os.path.join(os.path.dirname(file), subtitle)) + ' You should try to delete this subtitles file manually and ask Bazarr to download it again.') logging.exception('BAZARR Error trying to detect character encoding for this subtitles file: ' + path_replace_movie(os.path.join(os.path.dirname(file), subtitle)) + ' You should try to delete this subtitles file manually and ask Bazarr to download it again.')
else: else:
detected_language = langdetect.detect(text)
if len(detected_language) > 0: if len(detected_language) > 0:
actual_subtitles.append([str(detected_language), path_replace_reverse_movie(os.path.join(os.path.dirname(file), subtitle))]) actual_subtitles.append([str(detected_language), path_replace_reverse_movie(os.path.join(os.path.dirname(file), subtitle))])

@ -1,19 +1,12 @@
import os import os
import sys
import logging import logging
import re import re
from logging.handlers import TimedRotatingFileHandler from logging.handlers import TimedRotatingFileHandler
from get_argv import config_dir from get_argv import config_dir
from get_settings import get_general_settings
logger = logging.getLogger() logger = logging.getLogger()
debug = get_general_settings()[4]
if debug is False:
log_level = "INFO"
else:
log_level = "DEBUG"
class OneLineExceptionFormatter(logging.Formatter): class OneLineExceptionFormatter(logging.Formatter):
def formatException(self, exc_info): def formatException(self, exc_info):
@ -39,7 +32,12 @@ class NoExceptionFormatter(logging.Formatter):
return '' return ''
def configure_logging(): def configure_logging(debug=False):
if not debug:
log_level = "INFO"
else:
log_level = "DEBUG"
logger.handlers = [] logger.handlers = []
logger.setLevel(log_level) logger.setLevel(log_level)
@ -54,7 +52,7 @@ def configure_logging():
# ch.addFilter(MyFilter()) # ch.addFilter(MyFilter())
logger.addHandler(ch) logger.addHandler(ch)
#File Logging # File Logging
global fh global fh
fh = TimedRotatingFileHandler(os.path.join(config_dir, 'log/bazarr.log'), when="midnight", interval=1, fh = TimedRotatingFileHandler(os.path.join(config_dir, 'log/bazarr.log'), when="midnight", interval=1,
backupCount=7) backupCount=7)
@ -64,7 +62,7 @@ def configure_logging():
fh.addFilter(BlacklistFilter()) fh.addFilter(BlacklistFilter())
fh.addFilter(PublicIPFilter()) fh.addFilter(PublicIPFilter())
if debug is True: if debug:
logging.getLogger("apscheduler").setLevel(logging.DEBUG) logging.getLogger("apscheduler").setLevel(logging.DEBUG)
logging.getLogger("subliminal").setLevel(logging.DEBUG) logging.getLogger("subliminal").setLevel(logging.DEBUG)
logging.getLogger("git").setLevel(logging.DEBUG) logging.getLogger("git").setLevel(logging.DEBUG)
@ -145,13 +143,3 @@ class PublicIPFilter(logging.Filter):
def empty_log(): def empty_log():
fh.doRollover() fh.doRollover()
def update_settings(debug):
if debug == 'False':
level = "INFO"
else:
level = "DEBUG"
logger.setLevel(level)
for handler in logger.handlers:
handler.setLevel(level)

@ -1,4 +1,4 @@
bazarr_version = '0.6.7.1' bazarr_version = '0.6.8'
import gc import gc
gc.enable() gc.enable()
@ -23,8 +23,9 @@ update_notifier()
from get_settings import get_general_settings, get_proxy_settings from get_settings import get_general_settings, get_proxy_settings
import logging import logging
from logger import configure_logging, empty_log, update_settings from logger import configure_logging, empty_log
configure_logging()
configure_logging(get_general_settings()[4])
import requests import requests
if get_proxy_settings()[0] != 'None': if get_proxy_settings()[0] != 'None':
@ -469,6 +470,7 @@ def image_proxy_movies(url):
@route(base_url) @route(base_url)
@route(base_url.rstrip('/'))
@custom_auth_basic(check_credentials) @custom_auth_basic(check_credentials)
def redirect_root(): def redirect_root():
authorize() authorize()
@ -1129,8 +1131,6 @@ def save_settings():
cfg.set('general', 'use_embedded_subs', text_type(settings_general_embedded)) cfg.set('general', 'use_embedded_subs', text_type(settings_general_embedded))
cfg.set('general', 'only_monitored', text_type(settings_general_only_monitored)) cfg.set('general', 'only_monitored', text_type(settings_general_only_monitored))
cfg.set('general', 'adaptive_searching', text_type(settings_general_adaptive_searching)) cfg.set('general', 'adaptive_searching', text_type(settings_general_adaptive_searching))
update_settings(settings_general_debug)
if after != before: if after != before:
configured() configured()
@ -1301,6 +1301,8 @@ def save_settings():
with open(config_file, 'wb') as f: with open(config_file, 'wb') as f:
cfg.write(f) cfg.write(f)
configure_logging(get_general_settings()[4])
notifiers = c.execute("SELECT * FROM table_settings_notifier ORDER BY name").fetchall() notifiers = c.execute("SELECT * FROM table_settings_notifier ORDER BY name").fetchall()
for notifier in notifiers: for notifier in notifiers:
enabled = request.forms.get('settings_notifier_' + notifier[0] + '_enabled') enabled = request.forms.get('settings_notifier_' + notifier[0] + '_enabled')

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

@ -1059,9 +1059,6 @@
</div> </div>
<div class="ui dividing header">Subtitles providers</div> <div class="ui dividing header">Subtitles providers</div>
<div class="twelve wide column"> <div class="twelve wide column">
<div class="ui orange message">
<p>Be aware that the more providers you enable, the longer it will take everytime you search for a subtitles.</p>
</div>
<div class="ui grid"> <div class="ui grid">
<div class="middle aligned row"> <div class="middle aligned row">
<div class="right aligned four wide column"> <div class="right aligned four wide column">

@ -337,9 +337,6 @@
</div> </div>
<div class="ui dividing header">Subtitles providers</div> <div class="ui dividing header">Subtitles providers</div>
<div class="twelve wide column"> <div class="twelve wide column">
<div class="ui orange message">
<p>Be aware that the more providers you enable, the longer it will take everytime you search for a subtitles.</p>
</div>
<div class="ui grid"> <div class="ui grid">
<div class="middle aligned row"> <div class="middle aligned row">
<div class="right aligned four wide column"> <div class="right aligned four wide column">

Loading…
Cancel
Save