mirror of
https://github.com/morpheus65535/bazarr
synced 2025-01-30 19:02:34 +00:00
Add credentials form; Fix incorrect imports
This commit is contained in:
parent
8f8cd90699
commit
db7b6158aa
6 changed files with 82 additions and 7 deletions
|
@ -107,6 +107,10 @@ defaults = {
|
|||
'deathbycaptcha': {
|
||||
'username': '',
|
||||
'password': ''
|
||||
},
|
||||
'napisy24': {
|
||||
'username': '',
|
||||
'password': ''
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -1594,6 +1594,35 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="napisy24_option" class="ui grid container">
|
||||
<div class="middle aligned row">
|
||||
<div class="right aligned six wide column">
|
||||
<label>Username</label>
|
||||
</div>
|
||||
<div class="six wide column">
|
||||
<div class="ui fluid input">
|
||||
<input name="settings_napisy24_username" type="text" value="{{settings.napisy24.username if settings.napisy24.username != None else ''}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapsed column">
|
||||
<div class="collapsed center aligned column">
|
||||
<div data-tooltip="The provided credentials must have api access. Leave empty to use the defaults." data-inverted="" class="ui basic icon">
|
||||
<i class="yellow warning circle large icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="middle aligned row">
|
||||
<div class="right aligned six wide column">
|
||||
<label>Password</label>
|
||||
</div>
|
||||
<div class="six wide column">
|
||||
<div class="ui fluid input">
|
||||
<input name="settings_napisy24_password" type="password" value="{{settings.napisy24.password if settings.napisy24.password != None else ''}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="middle aligned row">
|
||||
<div class="right aligned four wide column">
|
||||
|
|
|
@ -664,6 +664,35 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="napisy24_option" class="ui grid container">
|
||||
<div class="middle aligned row">
|
||||
<div class="right aligned six wide column">
|
||||
<label>Username</label>
|
||||
</div>
|
||||
<div class="six wide column">
|
||||
<div class="ui fluid input">
|
||||
<input name="settings_napisy24_username" type="text" value="{{settings.napisy24.username if settings.napisy24.username != None else ''}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapsed column">
|
||||
<div class="collapsed center aligned column">
|
||||
<div data-tooltip="The provided credentials must have api access. Leave empty to use the defaults." data-inverted="" class="ui basic icon">
|
||||
<i class="yellow warning circle large icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="middle aligned row">
|
||||
<div class="right aligned six wide column">
|
||||
<label>Password</label>
|
||||
</div>
|
||||
<div class="six wide column">
|
||||
<div class="ui fluid input">
|
||||
<input name="settings_napisy24_password" type="password" value="{{settings.napisy24.password if settings.napisy24.password != None else ''}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="middle aligned row">
|
||||
<div class="right aligned four wide column">
|
||||
|
|
Loading…
Reference in a new issue