1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

add new chapter provider feature

This commit is contained in:
Luke Pulverenti 2014-06-09 15:16:14 -04:00
parent ce1763c192
commit c98448df25
10 changed files with 260 additions and 30 deletions

View file

@ -12,6 +12,7 @@
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="#" data-role="button" class="ui-btn-active">${TabBasics}</a>
<a href="metadataimages.html" data-role="button">${TabAdvanced}</a>
<a href="metadatachapters.html" data-role="button">${TabChapters}</a>
<a href="metadatasubtitles.html" data-role="button">${TabSubtitles}</a>
<a href="metadataadvanced.html" data-role="button">${TabOther}</a>
</div>

View file

@ -12,27 +12,12 @@
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="metadata.html" data-role="button">${TabBasics}</a>
<a href="metadataimages.html" data-role="button">${TabAdvanced}</a>
<a href="metadatachapters.html" data-role="button">${TabChapters}</a>
<a href="metadatasubtitles.html" data-role="button">${TabSubtitles}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabOther}</a>
</div>
<form id="advancedMetadataConfigurationForm">
<ul data-role="listview" class="ulForm">
<li>
<label>${HeaderExtractChapterImagesFor}</label>
<div data-role="controlgroup">
<input type="checkbox" data-mini="true" id="chkChaptersMovies" />
<label for="chkChaptersMovies">${OptionMovies}</label>
<input type="checkbox" data-mini="true" id="chkChaptersEpisodes" />
<label for="chkChaptersEpisodes">${OptionEpisodes}</label>
<input type="checkbox" data-mini="true" id="chkChaptersOtherVideos" />
<label for="chkChaptersOtherVideos">${OptionOtherVideos}</label>
<div class="fieldDescription">${ExtractChapterImagesHelp}</div>
</div>
</li>
</ul>
<h2>${HeaderAutomaticUpdates}</h2>
<ul data-role="listview" class="ulForm">

View file

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<title>${TitleMetadata}</title>
</head>
<body>
<div id="chapterMetadataConfigurationPage" data-role="page" class="page type-interior metadataConfigurationPage">
<div data-role="content">
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="metadata.html" data-role="button">${TabBasics}</a>
<a href="metadataimages.html" data-role="button">${TabAdvanced}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabChapters}</a>
<a href="metadatasubtitles.html" data-role="button">${TabSubtitles}</a>
<a href="metadataadvanced.html" data-role="button">${TabOther}</a>
</div>
<form class="metadataChaptersForm">
<p>${HeaderChapterDownloadingHelp}</p>
<div class="chapterDownloadSettings" style="display: none;">
<fieldset data-role="controlgroup">
<legend>${HeaderDownloadChaptersFor}</legend>
<input type="checkbox" data-mini="true" id="chkDownloadChapterMovies" />
<label for="chkDownloadChapterMovies">${OptionMovies}</label>
<input type="checkbox" data-mini="true" id="chkDownloadChapterEpisodes" />
<label for="chkDownloadChapterEpisodes">${OptionEpisodes}</label>
</fieldset>
<br />
<div class="chapterFetchers">
</div>
<br />
<br />
</div>
<div class="noChapterProviders" style="display: none; color: green;">
<p>${MessageNoChapterProviders}</p>
<br />
</div>
<ul data-role="listview" class="ulForm">
<li>
<label>${HeaderExtractChapterImagesFor}</label>
<div data-role="controlgroup">
<input type="checkbox" data-mini="true" id="chkChaptersMovies" />
<label for="chkChaptersMovies">${OptionMovies}</label>
<input type="checkbox" data-mini="true" id="chkChaptersEpisodes" />
<label for="chkChaptersEpisodes">${OptionEpisodes}</label>
<input type="checkbox" data-mini="true" id="chkChaptersOtherVideos" />
<label for="chkChaptersOtherVideos">${OptionOtherVideos}</label>
<div class="fieldDescription">${ExtractChapterImagesHelp}</div>
</div>
</li>
</ul>
<br />
<ul data-role="listview" class="ulForm">
<li>
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
${ButtonSave}
</button>
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete" data-mini="true">
${ButtonCancel}
</button>
</li>
</ul>
</form>
</div>
</div>
<script type="text/javascript">
$('.metadataChaptersForm').off('submit', MetadataChaptersPage.onSubmit).on('submit', MetadataChaptersPage.onSubmit);
</script>
</div>
</body>
</html>

View file

@ -12,6 +12,7 @@
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true" style="margin-bottom: 20px!important;">
<a href="metadata.html" data-role="button">${TabBasics}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabAdvanced}</a>
<a href="metadatachapters.html" data-role="button">${TabChapters}</a>
<a href="metadatasubtitles.html" data-role="button">${TabSubtitles}</a>
<a href="metadataadvanced.html" data-role="button">${TabOther}</a>
</div>

View file

@ -12,6 +12,7 @@
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="metadata.html" data-role="button">${TabBasics}</a>
<a href="metadataimages.html" data-role="button">${TabAdvanced}</a>
<a href="metadatachapters.html" data-role="button">${TabChapters}</a>
<a href="#" class="ui-btn-active" data-role="button">${TabSubtitles}</a>
<a href="metadataadvanced.html" data-role="button">${TabOther}</a>
</div>

View file

@ -4,7 +4,7 @@
function deleteRecording() {
Dashboard.confirm(Globalize.transate('MessageConfirmRecordingDeletion'), Globalize.transate('HeaderConfirmRecordingDeletion'), function (result) {
Dashboard.confirm(Globalize.translate('MessageConfirmRecordingDeletion'), Globalize.translate('HeaderConfirmRecordingDeletion'), function (result) {
if (result) {
@ -12,7 +12,7 @@
ApiClient.deleteLiveTvRecording(currentItem.Id).done(function () {
Dashboard.alert(Globalize.transate('MessageRecordingDeleted'));
Dashboard.alert(Globalize.translate('MessageRecordingDeleted'));
Dashboard.navigate('livetvrecordings.html');
});

View file

@ -257,12 +257,13 @@
return false;
}
if (videoStream && videoStream.Profile == 'High') {
var extension = (mediaSource.Container || '').toLowerCase();
// m4v's with high profile failing in chrome
if (videoStream && videoStream.Profile == 'High' && extension == 'm4v') {
return false;
}
var extension = (mediaSource.Container || '').toLowerCase();
if (extension == 'm4v') {
return $.browser.chrome;
}

View file

@ -15,10 +15,6 @@
load: function (page, config) {
$('#chkChaptersMovies', page).checked(config.EnableMovieChapterImageExtraction).checkboxradio("refresh");
$('#chkChaptersEpisodes', page).checked(config.EnableEpisodeChapterImageExtraction).checkboxradio("refresh");
$('#chkChaptersOtherVideos', page).checked(config.EnableOtherVideoChapterImageExtraction).checkboxradio("refresh");
$('#chkEnableTmdbPersonUpdates', page).checked(config.EnableTmdbUpdates).checkboxradio("refresh");
$('#chkEnableTvdbUpdates', page).checked(config.EnableTvDbUpdates).checkboxradio("refresh");
$('#chkEnableFanartUpdates', page).checked(config.EnableFanArtUpdates).checkboxradio("refresh");
@ -33,10 +29,6 @@
ApiClient.getServerConfiguration().done(function (config) {
config.EnableMovieChapterImageExtraction = $('#chkChaptersMovies', form).checked();
config.EnableEpisodeChapterImageExtraction = $('#chkChaptersEpisodes', form).checked();
config.EnableOtherVideoChapterImageExtraction = $('#chkChaptersOtherVideos', form).checked();
config.EnableTvDbUpdates = $('#chkEnableTvdbUpdates', form).checked();
config.EnableTmdbUpdates = $('#chkEnableTmdbPersonUpdates', form).checked();
config.EnableFanArtUpdates = $('#chkEnableFanartUpdates', form).checked();

View file

@ -0,0 +1,168 @@
(function ($, document, window) {
function loadPage(page, config, providers) {
if (providers.length) {
$('.noChapterProviders', page).hide();
$('.chapterDownloadSettings', page).show();
} else {
$('.noChapterProviders', page).show();
$('.chapterDownloadSettings', page).hide();
}
$('#chkChaptersMovies', page).checked(config.ChapterOptions.EnableMovieChapterImageExtraction).checkboxradio("refresh");
$('#chkChaptersEpisodes', page).checked(config.ChapterOptions.EnableEpisodeChapterImageExtraction).checkboxradio("refresh");
$('#chkChaptersOtherVideos', page).checked(config.ChapterOptions.EnableOtherVideoChapterImageExtraction).checkboxradio("refresh");
$('#chkDownloadChapterMovies', page).checked(config.ChapterOptions.DownloadMovieChapters).checkboxradio("refresh");
$('#chkDownloadChapterEpisodes', page).checked(config.ChapterOptions.DownloadEpisodeChapters).checkboxradio("refresh");
renderChapterFetchers(page, config, providers);
Dashboard.hideLoadingMsg();
}
function renderChapterFetchers(page, config, plugins) {
var html = '';
if (!plugins.length) {
$('.chapterFetchers', page).html(html).hide().trigger('create');
return;
}
var i, length, plugin, id;
html += '<div class="ui-controlgroup-label" style="margin-bottom:0;padding-left:2px;">';
html += Globalize.translate('LabelChapterDownloaders');
html += '</div>';
html += '<div style="display:inline-block;width: 75%;vertical-align:top;">';
html += '<div data-role="controlgroup" class="chapterFetcherGroup">';
for (i = 0, length = plugins.length; i < length; i++) {
plugin = plugins[i];
id = 'chkChapterFetcher' + i;
var isChecked = config.ChapterOptions.DisabledFetchers.indexOf(plugin.Name) == -1 ? ' checked="checked"' : '';
html += '<input class="chkChapterFetcher" type="checkbox" name="' + id + '" id="' + id + '" data-pluginname="' + plugin.Name + '" data-mini="true"' + isChecked + '>';
html += '<label for="' + id + '">' + plugin.Name + '</label>';
}
html += '</div>';
html += '</div>';
if (plugins.length > 1) {
html += '<div style="display:inline-block;vertical-align:top;margin-left:5px;">';
for (i = 0, length = plugins.length; i < length; i++) {
html += '<div style="margin:6px 0;">';
if (i == 0) {
html += '<button data-inline="true" disabled="disabled" class="btnUp" data-pluginindex="' + i + '" type="button" data-icon="arrow-u" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Up</button>';
html += '<button data-inline="true" class="btnDown" data-pluginindex="' + i + '" type="button" data-icon="arrow-d" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Down</button>';
} else if (i == (plugins.length - 1)) {
html += '<button data-inline="true" class="btnUp" data-pluginindex="' + i + '" type="button" data-icon="arrow-u" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Up</button>';
html += '<button data-inline="true" disabled="disabled" class="btnDown" data-pluginindex="' + i + '" type="button" data-icon="arrow-d" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Down</button>';
}
else {
html += '<button data-inline="true" class="btnUp" data-pluginindex="' + i + '" type="button" data-icon="arrow-u" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Up</button>';
html += '<button data-inline="true" class="btnDown" data-pluginindex="' + i + '" type="button" data-icon="arrow-d" data-mini="true" data-iconpos="notext" style="margin: 0 1px;">Down</button>';
}
html += '</div>';
}
}
html += '</div>';
html += '<div class="fieldDescription">' + Globalize.translate('LabelChapterDownloadersHelp') + '</div>';
var elem = $('.chapterFetchers', page).html(html).show().trigger('create');
$('.btnDown', elem).on('click', function () {
var index = parseInt(this.getAttribute('data-pluginindex'));
var elemToMove = $('.chapterFetcherGroup .ui-checkbox', page)[index];
var insertAfter = $(elemToMove).next('.ui-checkbox')[0];
elemToMove.parentNode.removeChild(elemToMove);
$(elemToMove).insertAfter(insertAfter);
$('.chapterFetcherGroup', page).controlgroup('destroy').controlgroup();
});
$('.btnUp', elem).on('click', function () {
var index = parseInt(this.getAttribute('data-pluginindex'));
var elemToMove = $('.chapterFetcherGroup .ui-checkbox', page)[index];
var insertBefore = $(elemToMove).prev('.ui-checkbox')[0];
elemToMove.parentNode.removeChild(elemToMove);
$(elemToMove).insertBefore(insertBefore);
$('.chapterFetcherGroup', page).controlgroup('destroy').controlgroup();
});
}
$(document).on('pageshow', "#chapterMetadataConfigurationPage", function () {
Dashboard.showLoadingMsg();
var page = this;
var promise1 = ApiClient.getServerConfiguration();
var promise2 = $.getJSON(ApiClient.getUrl("Providers/Chapters"));
$.when(promise1, promise2).done(function (response1, response2) {
loadPage(page, response1[0], response2[0]);
});
});
function metadataChaptersPage() {
var self = this;
self.onSubmit = function () {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getServerConfiguration().done(function (config) {
config.ChapterOptions.EnableMovieChapterImageExtraction = $('#chkChaptersMovies', form).checked();
config.ChapterOptions.EnableEpisodeChapterImageExtraction = $('#chkChaptersEpisodes', form).checked();
config.ChapterOptions.EnableOtherVideoChapterImageExtraction = $('#chkChaptersOtherVideos', form).checked();
config.ChapterOptions.DownloadMovieChapters = $('#chkDownloadChapterMovies', form).checked();
config.ChapterOptions.DownloadEpisodeChapters = $('#chkDownloadChapterEpisodes', form).checked();
config.ChapterOptions.DisabledFetchers = $('.chkChapterFetcher:not(:checked)', form).get().map(function (c) {
return c.getAttribute('data-pluginname');
});
config.ChapterOptions.FetcherOrder = $('.chkChapterFetcher', form).get().map(function (c) {
return c.getAttribute('data-pluginname');
});
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
};
}
window.MetadataChaptersPage = new metadataChaptersPage();
})(jQuery, document, window);

View file

@ -14,7 +14,7 @@
// After saving chapter task, now save server config
ApiClient.getServerConfiguration().done(function (config) {
config.EnableMovieChapterImageExtraction = $('#chkMovies', page).checked();
config.ChapterOptions.EnableMovieChapterImageExtraction = $('#chkMovies', page).checked();
config.EnableUPnP = $('#chkEnableUpnp', page).checked();