Merge pull request #136 from cvium/readd_opensubtitles

Re-add OpenSubtitles configuration page
This commit is contained in:
Joshua M. Boniface 2019-02-18 14:58:09 -05:00 committed by GitHub
commit abf2149027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 0 deletions

27
src/opensubtitles.html Normal file
View File

@ -0,0 +1,27 @@
<div id="openSubtitlesPage" data-role="page" class="page type-interior metadataConfigurationPage" data-require="scripts/opensubtitles,emby-input,emby-button,emby-linkbutton">
<div>
<div class="content-primary">
<form class="metadataSubtitlesForm">
<div style="height:0; overflow: hidden;"><input type="text" name="fakeusernameremembered" tabindex="-1" /><input type="password" name="fakepasswordremembered" tabindex="-1" /></div>
<div style="display: none;">
<input type="text" id="PreventChromeAutocomplete" name="PreventChromeAutocomplete" autocomplete="address-level4" />
</div>
<br />
<div class="inputContainer">
<input is="emby-input" type="text" id="txtOpenSubtitleUsername" autocomplete="off" label="${LabelOpenSubtitlesUsername}" />
<div class="fieldDescription">
<a is="emby-linkbutton" class="button-link" target="_blank" href="http://www.opensubtitles.org/">${ButtonRegister}</a>
</div>
</div>
<div class="inputContainer">
<input is="emby-input" type="password" id="txtOpenSubtitlePassword" autocomplete="off" label="${LabelOpenSubtitlesPassword}" />
</div>
<div>
<button is="emby-button" type="submit" class="raised button-submit block"><span>${ButtonSave}</span></button>
</div>
<div class="fieldDescription">${SubtitleDownloadInstructions}</div>
</form>
</div>
</div>
</div>

View File

@ -297,6 +297,11 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
icon: "swap_horiz",
href: "encodingsettings.html",
pageIds: ["encodingSettingsPage"]
}, {
name: "Open Subtitles",
href: "opensubtitles.html",
pageIds: ["openSubtitlesPage"],
icon: "closed_caption"
}];
addPluginPagesToMainMenu(links, pluginItems, "server");
links.push({

View File

@ -0,0 +1,36 @@
define(["loading", "fnchecked", "emby-linkbutton", "emby-input", "emby-checkbox", "emby-button"], function (loading) {
"use strict";
function loadPage(page, config) {
page.querySelector("#txtOpenSubtitleUsername").value = config.OpenSubtitlesUsername;
page.querySelector("#txtOpenSubtitlePassword").value = config.OpenSubtitlesPasswordHash || "";
loading.hide();
}
function onSubmit(evt) {
evt.preventDefault();
loading.show();
var form = this;
ApiClient.getNamedConfiguration("subtitles").then(function (config) {
config.OpenSubtitlesUsername = form.querySelector("#txtOpenSubtitleUsername").value;
var newPassword = form.querySelector("#txtOpenSubtitlePassword").value;
if (newPassword) {
config.OpenSubtitlesPasswordHash = newPassword;
}
ApiClient.updateNamedConfiguration("subtitles", config).then(Dashboard.processServerConfigurationUpdateResult);
});
return false;
}
$(document).on("pageinit", "#openSubtitlesPage", function() {
$(".metadataSubtitlesForm").off("submit", onSubmit).on("submit", onSubmit)
}).on("pageshow", "#openSubtitlesPage", function() {
loading.show();
var page = this;
ApiClient.getNamedConfiguration("subtitles").then(function (response) {
loadPage(page, response);
});
});
});

View File

@ -512,6 +512,11 @@ var Dashboard = {
dependencies: [],
autoFocus: !1,
roles: "admin"
}), defineRoute({
path: "/opensubtitles.html",
dependencies: [],
autoFocus: !1,
roles: "admin"
}), defineRoute({
path: "/forgotpassword.html",
dependencies: ["emby-input", "emby-button"],

View File

@ -159,6 +159,7 @@
"ButtonReenable": "Re-enable",
"ButtonRefresh": "Refresh",
"ButtonRefreshGuideData": "Refresh Guide Data",
"ButtonRegister": "Register",
"ButtonReject": "Reject",
"ButtonRemote": "Remote",
"ButtonRemoteControl": "Remote Control",