diff --git a/bazarr/config.py b/bazarr/config.py index 2bfdcf2bf..317a849e9 100644 --- a/bazarr/config.py +++ b/bazarr/config.py @@ -107,6 +107,10 @@ defaults = { 'deathbycaptcha': { 'username': '', 'password': '' + }, + 'napisy24': { + 'username': '', + 'password': '' } } diff --git a/bazarr/get_providers.py b/bazarr/get_providers.py index 1dafee00c..c87c38674 100644 --- a/bazarr/get_providers.py +++ b/bazarr/get_providers.py @@ -109,7 +109,10 @@ def get_providers_auth(): 'xsubs': {'username': settings.xsubs.username, 'password': settings.xsubs.password, }, - 'assrt': {'token': settings.assrt.token, } + 'assrt': {'token': settings.assrt.token, }, + 'napisy24': {'username': settings.napisy24.username, + 'password': settings.napisy24.password, + } } return providers_auth diff --git a/bazarr/main.py b/bazarr/main.py index 7d49ee4a2..c74225df7 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -391,6 +391,8 @@ def save_wizard(): settings.opensubtitles.skip_wrong_fps = text_type(settings_opensubtitles_skip_wrong_fps) settings.xsubs.username = request.forms.get('settings_xsubs_username') settings.xsubs.password = request.forms.get('settings_xsubs_password') + settings.napisy24.username = request.forms.get('settings_napisy24_username') + settings.napisy24.password = request.forms.get('settings_napisy24_password') settings_subliminal_languages = request.forms.getall('settings_subliminal_languages') c.execute("UPDATE table_settings_languages SET enabled = 0") @@ -1494,6 +1496,8 @@ def save_settings(): settings.opensubtitles.skip_wrong_fps = text_type(settings_opensubtitles_skip_wrong_fps) settings.xsubs.username = request.forms.get('settings_xsubs_username') settings.xsubs.password = request.forms.get('settings_xsubs_password') + settings.napisy24.username = request.forms.get('settings_napisy24_username') + settings.napisy24.password = request.forms.get('settings_napisy24_password') settings_subliminal_languages = request.forms.getall('settings_subliminal_languages') c.execute("UPDATE table_settings_languages SET enabled = 0") diff --git a/libs/subliminal_patch/providers/napisy24.py b/libs/subliminal_patch/providers/napisy24.py index 50aca099b..e9d4b2eec 100644 --- a/libs/subliminal_patch/providers/napisy24.py +++ b/libs/subliminal_patch/providers/napisy24.py @@ -6,10 +6,11 @@ from zipfile import ZipFile from babelfish import Language from requests import Session -from subliminal.providers import Provider +from subliminal_patch.subtitle import Subtitle +from subliminal_patch.providers import Provider from subliminal import __short_version__ from subliminal.exceptions import AuthenticationError, ConfigurationError -from subliminal.subtitle import Subtitle, fix_line_ending +from subliminal.subtitle import fix_line_ending logger = logging.getLogger(__name__) @@ -44,13 +45,18 @@ class Napisy24Subtitle(Subtitle): class Napisy24Provider(Provider): '''Napisy24 Provider.''' - languages = {Language.fromalpha2(l) for l in ['pl']} + languages = {Language(l) for l in ['pol']} required_hash = 'opensubtitles' api_url = 'http://napisy24.pl/run/CheckSubAgent.php' - def __init__(self): - self.username = 'subliminal' - self.password = 'lanimilbus' + def __init__(self, username=None, password=None): + if all((username, password)): + self.username = username + self.password = password + else: + self.username = 'subliminal' + self.password = 'lanimilbus' + self.session = None def initialize(self): diff --git a/views/settings.tpl b/views/settings.tpl index ffaa0d9e1..f282b843c 100644 --- a/views/settings.tpl +++ b/views/settings.tpl @@ -1594,6 +1594,35 @@ +