Merge branch 'development' into hermes

# Conflicts:
#	bazarr/main.py
#	bazarr/scheduler.py
This commit is contained in:
Louis Vézina 2020-04-25 09:11:05 -04:00
commit 83d226a8a0
15 changed files with 54 additions and 23 deletions

View File

@ -11,6 +11,7 @@ At the request of some, here is a way to demonstrate your appreciation for the e
[![GitHub issues](https://img.shields.io/github/issues/morpheus65535/bazarr.svg?style=flat-square)](https://github.com/morpheus65535/bazarr/issues)
[![GitHub stars](https://img.shields.io/github/stars/morpheus65535/bazarr.svg?style=flat-square)](https://github.com/morpheus65535/bazarr/stargazers)
[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/bazarr.svg?style=flat-square)](https://hub.docker.com/r/linuxserver/bazarr/)
[![Docker Pulls](https://img.shields.io/docker/pulls/hotio/bazarr.svg?style=flat-square)](https://hub.docker.com/r/hotio/bazarr/)
[![Discord](https://img.shields.io/badge/discord-chat-MH2e2eb.svg?style=flat-square)](https://discord.gg/MH2e2eb)
# Support

View File

@ -33,6 +33,8 @@ def gitconfig():
logging.debug('BAZARR Settings git email')
config_write.set_value("user", "email", "bazarr@fake.email")
config_write.release()
def check_and_apply_update():
check_releases()

View File

@ -147,6 +147,7 @@ defaults = {
settings = simpleconfigparser(defaults=defaults, interpolation=None)
settings.read(os.path.join(args.config_dir, 'config', 'config.ini'))
settings.general.base_url = settings.general.base_url if settings.general.base_url else '/'
base_url = settings.general.base_url

View File

@ -197,7 +197,7 @@ def download_subtitle(path, language, audio_language, hi, forced, providers, pro
path_decoder=force_unicode
)
except Exception as e:
logging.exception('BAZARR Error saving Subtitles file to disk for this file:' + path)
logging.exception('BAZARR Error saving Subtitles file to disk for this file:' + path + ': ' + repr(e))
pass
else:
saved_any = True
@ -458,11 +458,14 @@ def manual_download_subtitle(path, language, audio_language, hi, forced, subtitl
logging.debug('BAZARR Ended manually downloading Subtitles for file: ' + path)
def manual_upload_subtitle(path, language, forced, title, scene_name, media_type, subtitle):
def manual_upload_subtitle(path, language, forced, title, scene_name, media_type, subtitle, audio_language):
logging.debug('BAZARR Manually uploading subtitles for this file: ' + path)
single = settings.general.getboolean('single_language')
use_postprocessing = settings.general.getboolean('use_postprocessing')
postprocessing_cmd = settings.general.postprocessing_cmd
chmod = int(settings.general.chmod, 8) if not sys.platform.startswith(
'win') and settings.general.getboolean('chmod_enabled') else None
@ -525,6 +528,20 @@ def manual_upload_subtitle(path, language, forced, title, scene_name, media_type
os.chmod(subtitle_path, chmod)
message = language_from_alpha3(language) + (" forced" if forced else "") + " Subtitles manually uploaded."
uploaded_language_code3 = language
uploaded_language = language_from_alpha3(uploaded_language_code3)
uploaded_language_code2 = alpha2_from_alpha3(uploaded_language_code3)
audio_language_code2 = alpha2_from_language(audio_language)
audio_language_code3 = alpha3_from_language(audio_language)
if use_postprocessing is True:
command = pp_replace(postprocessing_cmd, path, subtitle_path, uploaded_language,
uploaded_language_code2, uploaded_language_code3, audio_language,
audio_language_code2, audio_language_code3, forced)
postprocessing(command, path)
if media_type == 'series':
reversed_path = path_replace_reverse(path)
@ -957,7 +974,10 @@ def refine_from_ffprobe(path, video):
video.video_codec = data['video'][0]['codec']
if 'frame_rate' in data['video'][0]:
if not video.fps:
video.fps = data['video'][0]['frame_rate']
if isinstance(data['video'][0]['frame_rate'], float):
video.fps = data['video'][0]['frame_rate']
else:
video.fps = data['video'][0]['frame_rate'].magnitude
if 'audio' not in data:
logging.debug('BAZARR FFprobe was unable to find audio tracks in the file!')

View File

@ -387,7 +387,7 @@ def guess_external_subtitles(dest_folder, subtitles):
logging.debug('BAZARR detected encoding %r', guess)
if guess["confidence"] < 0.6:
raise UnicodeError
if guess["confidence"] < 0.8 or guess["encoding"] == "ascii":
if guess["confidence"] < 0.7 or guess["encoding"] == "ascii":
guess["encoding"] = "utf-8"
text = text.decode(guess["encoding"])
detected_language = guess_language(text)

View File

@ -30,10 +30,7 @@ class Scheduler:
def __init__(self):
self.__running_tasks = []
if str(get_localzone()) == "local":
self.aps_scheduler = BackgroundScheduler(timezone=pytz.timezone('UTC'))
else:
self.aps_scheduler = BackgroundScheduler()
self.aps_scheduler = BackgroundScheduler()
# task listener
def task_listener_add(event):

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -35,7 +35,8 @@ def fix_tv_naming(title):
"Marvel's Luke Cage": "Luke Cage",
"Marvel's Iron Fist": "Iron Fist",
"Marvel's Jessica Jones": "Jessica Jones",
"DC's Legends of Tomorrow": "Legends of Tomorrow"
"DC's Legends of Tomorrow": "Legends of Tomorrow",
"Doctor Who (2005)": "Doctor Who",
}, True)
class SubsSabBzSubtitle(Subtitle):

View File

@ -34,7 +34,8 @@ def fix_tv_naming(title):
return fix_inconsistent_naming(title, {"Marvel's Daredevil": "Daredevil",
"Marvel's Luke Cage": "Luke Cage",
"Marvel's Iron Fist": "Iron Fist",
"DC's Legends of Tomorrow": "Legends of Tomorrow"
"DC's Legends of Tomorrow": "Legends of Tomorrow",
"Doctor Who (2005)": "Doctor Who",
}, True)
class SubsUnacsSubtitle(Subtitle):

View File

@ -84,11 +84,10 @@ def _get_localzone(_root='/'):
if not etctz:
continue
tz = pytz.timezone(etctz.replace(' ', '_'))
# Disabling this offset valdation due to issue with some timezone: https://github.com/regebro/tzlocal/issues/80
# if _root == '/':
if _root == '/':
# We are using a file in etc to name the timezone.
# Verify that the timezone specified there is actually used:
# utils.assert_tz_offset(tz)
utils.assert_tz_offset(tz)
return tz
except IOError:

View File

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
import time
import datetime
import calendar
def get_system_offset():
@ -11,8 +13,14 @@ def get_system_offset():
To keep compatibility with Windows, we're always importing time module here.
"""
import time
if time.daylight and time.localtime().tm_isdst > 0:
localtime = calendar.timegm(time.localtime())
gmtime = calendar.timegm(time.gmtime())
offset = gmtime - localtime
# We could get the localtime and gmtime on either side of a second switch
# so we check that the difference is less than one minute, because nobody
# has that small DST differences.
if abs(offset - time.altzone) < 60:
return -time.altzone
else:
return -time.timezone

View File

@ -87,6 +87,7 @@ win_tz = {'AUS Central Standard Time': 'Australia/Darwin',
'Pacific Standard Time (Mexico)': 'America/Tijuana',
'Pakistan Standard Time': 'Asia/Karachi',
'Paraguay Standard Time': 'America/Asuncion',
'Qyzylorda Standard Time': 'Asia/Qyzylorda',
'Romance Standard Time': 'Europe/Paris',
'Russia Time Zone 10': 'Asia/Srednekolymsk',
'Russia Time Zone 11': 'Asia/Kamchatka',
@ -127,6 +128,7 @@ win_tz = {'AUS Central Standard Time': 'Australia/Darwin',
'Ulaanbaatar Standard Time': 'Asia/Ulaanbaatar',
'Venezuela Standard Time': 'America/Caracas',
'Vladivostok Standard Time': 'Asia/Vladivostok',
'Volgograd Standard Time': 'Europe/Volgograd',
'W. Australia Standard Time': 'Australia/Perth',
'W. Central Africa Standard Time': 'Africa/Lagos',
'W. Europe Standard Time': 'Europe/Berlin',
@ -287,7 +289,7 @@ tz_win = {'Africa/Abidjan': 'Greenwich Standard Time',
'America/Mendoza': 'Argentina Standard Time',
'America/Menominee': 'Central Standard Time',
'America/Merida': 'Central Standard Time (Mexico)',
'America/Metlakatla': 'Pacific Standard Time',
'America/Metlakatla': 'Alaskan Standard Time',
'America/Mexico_City': 'Central Standard Time (Mexico)',
'America/Miquelon': 'Saint Pierre Standard Time',
'America/Moncton': 'Atlantic Standard Time',
@ -347,13 +349,13 @@ tz_win = {'Africa/Abidjan': 'Greenwich Standard Time',
'America/Winnipeg': 'Central Standard Time',
'America/Yakutat': 'Alaskan Standard Time',
'America/Yellowknife': 'Mountain Standard Time',
'Antarctica/Casey': 'W. Australia Standard Time',
'Antarctica/Casey': 'Singapore Standard Time',
'Antarctica/Davis': 'SE Asia Standard Time',
'Antarctica/DumontDUrville': 'West Pacific Standard Time',
'Antarctica/Macquarie': 'Central Pacific Standard Time',
'Antarctica/Mawson': 'West Asia Standard Time',
'Antarctica/McMurdo': 'New Zealand Standard Time',
'Antarctica/Palmer': 'Magallanes Standard Time',
'Antarctica/Palmer': 'SA Eastern Standard Time',
'Antarctica/Rothera': 'SA Eastern Standard Time',
'Antarctica/South_Pole': 'New Zealand Standard Time',
'Antarctica/Syowa': 'E. Africa Standard Time',
@ -424,7 +426,7 @@ tz_win = {'Africa/Abidjan': 'Greenwich Standard Time',
'Asia/Pyongyang': 'North Korea Standard Time',
'Asia/Qatar': 'Arab Standard Time',
'Asia/Qostanay': 'Central Asia Standard Time',
'Asia/Qyzylorda': 'West Asia Standard Time',
'Asia/Qyzylorda': 'Qyzylorda Standard Time',
'Asia/Rangoon': 'Myanmar Standard Time',
'Asia/Riyadh': 'Arab Standard Time',
'Asia/Saigon': 'SE Asia Standard Time',
@ -592,7 +594,7 @@ tz_win = {'Africa/Abidjan': 'Greenwich Standard Time',
'Europe/Vatican': 'W. Europe Standard Time',
'Europe/Vienna': 'W. Europe Standard Time',
'Europe/Vilnius': 'FLE Standard Time',
'Europe/Volgograd': 'Russian Standard Time',
'Europe/Volgograd': 'Volgograd Standard Time',
'Europe/Warsaw': 'Central European Standard Time',
'Europe/Zagreb': 'Central European Standard Time',
'Europe/Zaporozhye': 'FLE Standard Time',

View File

@ -1,4 +1,4 @@
apprise=0.8.2
apprise=0.8.5
apscheduler=3.5.1
babelfish=0.5.5
backports.functools-lru-cache=1.5
@ -15,7 +15,6 @@ guessit=2.1.4
guess_language-spirit=0.5.3
Js2Py=0.63 <-- modified: manually merged from upstream: https://github.com/PiotrDabkowski/Js2Py/pull/192/files
knowit=0.3.0-dev
peewee=3.9.6
py-pretty=1
pycountry=18.2.23
pyga=2.6.1
@ -27,6 +26,6 @@ six=1.11.0
SimpleConfigParser=0.1.0 <-- modified version: do not update!!!
stevedore=1.28.0
subliminal=2.1.0dev
tzlocal=1.5.1
tzlocal=2.1b1
urllib3=1.23
Waitress=1.4.3