Add credentials form; Fix incorrect imports

pull/437/head
Unknown 6 years ago
parent 8f8cd90699
commit db7b6158aa

@ -107,6 +107,10 @@ defaults = {
'deathbycaptcha': { 'deathbycaptcha': {
'username': '', 'username': '',
'password': '' 'password': ''
},
'napisy24': {
'username': '',
'password': ''
} }
} }

@ -109,7 +109,10 @@ def get_providers_auth():
'xsubs': {'username': settings.xsubs.username, 'xsubs': {'username': settings.xsubs.username,
'password': settings.xsubs.password, '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 return providers_auth

@ -391,6 +391,8 @@ def save_wizard():
settings.opensubtitles.skip_wrong_fps = text_type(settings_opensubtitles_skip_wrong_fps) settings.opensubtitles.skip_wrong_fps = text_type(settings_opensubtitles_skip_wrong_fps)
settings.xsubs.username = request.forms.get('settings_xsubs_username') settings.xsubs.username = request.forms.get('settings_xsubs_username')
settings.xsubs.password = request.forms.get('settings_xsubs_password') 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') settings_subliminal_languages = request.forms.getall('settings_subliminal_languages')
c.execute("UPDATE table_settings_languages SET enabled = 0") 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.opensubtitles.skip_wrong_fps = text_type(settings_opensubtitles_skip_wrong_fps)
settings.xsubs.username = request.forms.get('settings_xsubs_username') settings.xsubs.username = request.forms.get('settings_xsubs_username')
settings.xsubs.password = request.forms.get('settings_xsubs_password') 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') settings_subliminal_languages = request.forms.getall('settings_subliminal_languages')
c.execute("UPDATE table_settings_languages SET enabled = 0") c.execute("UPDATE table_settings_languages SET enabled = 0")

@ -6,10 +6,11 @@ from zipfile import ZipFile
from babelfish import Language from babelfish import Language
from requests import Session 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 import __short_version__
from subliminal.exceptions import AuthenticationError, ConfigurationError 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__) logger = logging.getLogger(__name__)
@ -44,13 +45,18 @@ class Napisy24Subtitle(Subtitle):
class Napisy24Provider(Provider): class Napisy24Provider(Provider):
'''Napisy24 Provider.''' '''Napisy24 Provider.'''
languages = {Language.fromalpha2(l) for l in ['pl']} languages = {Language(l) for l in ['pol']}
required_hash = 'opensubtitles' required_hash = 'opensubtitles'
api_url = 'http://napisy24.pl/run/CheckSubAgent.php' api_url = 'http://napisy24.pl/run/CheckSubAgent.php'
def __init__(self): def __init__(self, username=None, password=None):
self.username = 'subliminal' if all((username, password)):
self.password = 'lanimilbus' self.username = username
self.password = password
else:
self.username = 'subliminal'
self.password = 'lanimilbus'
self.session = None self.session = None
def initialize(self): def initialize(self):

@ -1594,6 +1594,35 @@
</div> </div>
</div> </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="middle aligned row">
<div class="right aligned four wide column"> <div class="right aligned four wide column">

@ -664,6 +664,35 @@
</div> </div>
</div> </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="middle aligned row">
<div class="right aligned four wide column"> <div class="right aligned four wide column">

Loading…
Cancel
Save