fixes #914 - Add option to save metadata hidden

This commit is contained in:
Luke Pulverenti 2014-09-06 00:21:23 -04:00
parent 950fc7ee7a
commit 56d7a4b41f
8 changed files with 178 additions and 19 deletions

View File

@ -419,6 +419,14 @@
}
@media all and (min-width: 1920px) {
.squareCard {
width: 9.0909090909090909090909090909091%;
}
}
@media all and (min-width: 1920px) {
.portraitCard {

View File

@ -219,6 +219,18 @@
</div>
</div>
<div data-role="collapsible">
<h2>${HeaderXmlSettings}</h2>
<div>
<h2>
<span style="vertical-align:middle;">${HeaderXmlDocumentAttributes}</span>
<button class="btnAddXmlDocumentAttribute" data-icon="plus" data-iconpos="notext" data-inline="true" type="button" style="vertical-align:middle;margin-left:.25em;">${ButtonAdd}</button>
</h2>
<div class="xmlDocumentAttributeList"></div>
<div class="fieldDescription">${XmlDocumentAttributeListHelp}</div>
<br />
</div>
</div>
</div>
<div class="tabContent tabIdentification">
@ -642,6 +654,37 @@
</form>
</div>
</div>
<div data-role="popup" id="xmlAttributePopup" class="popup">
<div class="ui-bar-a" style="text-align: center; padding: 0 20px;">
<h3>${HeaderXmlDocumentAttribute}</h3>
</div>
<div data-role="content">
<form class="xmlAttributeForm">
<div style="margin: 1em 0;">
<label for="txtXmlAttributeName">${LabelName}</label>
<input type="text" id="txtXmlAttributeName" data-mini="true" required="required" />
</div>
<div style="margin: 1em 0;">
<label for="txtXmlAttributeValue">${LabelValue}</label>
<input type="text" id="txtXmlAttributeValue" data-mini="true" required="required" />
</div>
<p>
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
${ButtonOk}
</button>
<button type="button" data-icon="delete" onclick="$(this).parents('.popup').popup('close');" data-mini="true">
${ButtonCancel}
</button>
</p>
</form>
</div>
</div>
<script type="text/javascript">
$('.dlnaProfileForm').off('submit', DlnaProfilePage.onSubmit).on('submit', DlnaProfilePage.onSubmit);
@ -651,6 +694,7 @@
$('.codecProfileForm').off('submit', DlnaProfilePage.onCodecProfileFormSubmit).on('submit', DlnaProfilePage.onCodecProfileFormSubmit);
$('.editResponseProfileForm').off('submit', DlnaProfilePage.onResponseProfileFormSubmit).on('submit', DlnaProfilePage.onResponseProfileFormSubmit);
$('.identificationHeaderForm').off('submit', DlnaProfilePage.onIdentificationHeaderFormSubmit).on('submit', DlnaProfilePage.onIdentificationHeaderFormSubmit);
$('.xmlAttributeForm').off('submit', DlnaProfilePage.onXmlAttributeFormSubmit).on('submit', DlnaProfilePage.onXmlAttributeFormSubmit);
</script>
</div>
</body>

View File

@ -28,6 +28,10 @@
<button id="btnSelectMetadataPath" type="button" data-icon="search" data-iconpos="notext" data-inline="true">${ButtonSelectDirectory}</button>
<div class="fieldDescription">${LabelMetadataPathHelp}</div>
</li>
<li>
<label for="chkSaveMetadataHidden">${OptionSaveMetadataAsHidden}</label>
<input type="checkbox" id="chkSaveMetadataHidden" data-mini="true" />
</li>
</ul>
<div data-role="collapsible">

View File

@ -45,6 +45,8 @@
$('#chkEnableAlbumArtInDidl', page).checked(profile.EnableAlbumArtInDidl).checkboxradio('refresh');
renderXmlDocumentAttributes(page, profile.XmlRootAttributes || []);
var idInfo = profile.Identification || {};
renderIdentificationHeaders(page, idInfo.Headers || []);
@ -173,6 +175,73 @@
$('#identificationHeaderPopup', page).popup('close');
}
function renderXmlDocumentAttributes(page, attribute) {
var index = 0;
var html = '<ul data-role="listview" data-inset="true" data-split-icon="delete">' + attribute.map(function (h) {
var li = '<li>';
li += '<a href="#">';
li += '<div style="font-weight:normal;">' + h.Name + ' = ' + (h.Value || '') + '</div>';
li += '</a>';
li += '<a class="btnDeleteXmlAttribute" href="#" data-index="' + index + '"></a>';
li += '</li>';
index++;
return li;
}).join('') + '</ul>';
var elem = $('.xmlDocumentAttributeList', page).html(html).trigger('create');
$('.btnDeleteXmlAttribute', elem).on('click', function () {
var itemIndex = parseInt(this.getAttribute('data-index'));
currentProfile.XmlRootAttributes.splice(itemIndex, 1);
renderXmlDocumentAttributes(page, currentProfile.XmlRootAttributes);
});
}
function editXmlDocumentAttribute(page, attribute) {
isSubProfileNew = attribute == null;
attribute = attribute || {};
currentSubProfile = attribute;
var popup = $('#xmlAttributePopup', page);
$('#txtXmlAttributeName', popup).val(attribute.Name || '');
$('#txtXmlAttributeValue', popup).val(attribute.Value || '');
popup.popup('open');
}
function saveXmlDocumentAttribute(page) {
currentSubProfile.Name = $('#txtXmlAttributeName', page).val();
currentSubProfile.Value = $('#txtXmlAttributeValue', page).val();
if (isSubProfileNew) {
currentProfile.XmlRootAttributes.push(currentSubProfile);
}
renderXmlDocumentAttributes(page, currentProfile.XmlRootAttributes);
currentSubProfile = null;
$('#xmlAttributePopup', page).popup('close');
}
function renderSubProfiles(page, profile) {
renderDirectPlayProfiles(page, profile.DirectPlayProfiles);
@ -907,6 +976,11 @@
editIdentificationHeader(page);
});
$('.btnAddXmlDocumentAttribute', page).on('click', function () {
editXmlDocumentAttribute(page);
});
}).on('pageshow', "#dlnaProfilePage", function () {
var page = this;
@ -991,6 +1065,16 @@
saveIdentificationHeader(page);
return false;
},
onXmlAttributeFormSubmit: function () {
var form = this;
var page = $(form).parents('.page');
saveXmlDocumentAttribute(page);
return false;
}
};

View File

@ -148,49 +148,49 @@
if (item.MovieCount) {
html += '<input type="radio" name="ibnItems" id="radioMovies" class="context-movies" value="on" data-mini="true">';
html += '<input type="radio" name="ibnItems" id="radioMovies" class="context-movies" value="on">';
html += '<label for="radioMovies">'+Globalize.translate('TabMovies')+'</label>';
}
if (item.SeriesCount) {
html += '<input type="radio" name="ibnItems" id="radioShows" class="context-tv" value="on" data-mini="true">';
html += '<input type="radio" name="ibnItems" id="radioShows" class="context-tv" value="on">';
html += '<label for="radioShows">'+Globalize.translate('TabSeries')+'</label>';
}
if (item.EpisodeCount) {
html += '<input type="radio" name="ibnItems" id="radioEpisodes" class="context-tv" value="on" data-mini="true">';
html += '<input type="radio" name="ibnItems" id="radioEpisodes" class="context-tv" value="on">';
html += '<label for="radioEpisodes">'+Globalize.translate('TabEpisodes')+'</label>';
}
if (item.TrailerCount) {
html += '<input type="radio" name="ibnItems" id="radioTrailers" class="context-movies" value="on" data-mini="true">';
html += '<input type="radio" name="ibnItems" id="radioTrailers" class="context-movies" value="on">';
html += '<label for="radioTrailers">'+Globalize.translate('TabTrailers')+'</label>';
}
if (item.GameCount) {
html += '<input type="radio" name="ibnItems" id="radioGames" class="context-games" value="on" data-mini="true">';
html += '<input type="radio" name="ibnItems" id="radioGames" class="context-games" value="on">';
html += '<label for="radioGames">'+Globalize.translate('TabGames')+'</label>';
}
if (item.AlbumCount) {
html += '<input type="radio" name="ibnItems" id="radioAlbums" class="context-music" value="on" data-mini="true">';
html += '<input type="radio" name="ibnItems" id="radioAlbums" class="context-music" value="on">';
html += '<label for="radioAlbums">'+Globalize.translate('TabAlbums')+'</label>';
}
if (item.SongCount) {
html += '<input type="radio" name="ibnItems" id="radioSongs" class="context-music" value="on" data-mini="true">';
html += '<input type="radio" name="ibnItems" id="radioSongs" class="context-music" value="on">';
html += '<label for="radioSongs">'+Globalize.translate('TabSongs')+'</label>';
}
if (item.MusicVideoCount) {
html += '<input type="radio" name="ibnItems" id="radioMusicVideos" class="context-music" value="on" data-mini="true">';
html += '<input type="radio" name="ibnItems" id="radioMusicVideos" class="context-music" value="on">';
html += '<label for="radioMusicVideos">'+Globalize.translate('TabMusicVideos')+'</label>';
}

View File

@ -1275,23 +1275,23 @@
html += '</div>';
}
if (version.Size) {
if (version.Container) {
html += '<div><span class="mediaInfoLabel">Container</span><span class="mediaInfoAttribute">' + version.Container + '</span></div>';
}
var size = (version.Size / (1024 * 1024)).toFixed(0);
html += '<div><span class="mediaInfoLabel">Size</span><span class="mediaInfoAttribute">' + size + ' MB</span></div>';
if (version.Formats && version.Formats.length) {
//html += '<div><span class="mediaInfoLabel">Format</span><span class="mediaInfoAttribute">' + version.Formats.join(',') + '</span></div>';
}
if (version.Path) {
html += '<div style="max-width:600px;overflow:hidden;"><span class="mediaInfoLabel">Path</span><span class="mediaInfoAttribute">' + version.Path + '</span></div>';
}
if (version.Container) {
//html += '<div><span class="mediaInfoLabel">Container</span><span class="mediaInfoAttribute">' + version.Container + '</span></div>';
}
if (version.Size) {
if (version.Formats && version.Formats.length) {
//html += '<div><span class="mediaInfoLabel">Format</span><span class="mediaInfoAttribute">' + version.Formats.join(',') + '</span></div>';
var size = (version.Size / (1024 * 1024)).toFixed(0);
html += '<div><span class="mediaInfoLabel">Size</span><span class="mediaInfoAttribute">' + size + ' MB</span></div>';
}
return html;

View File

@ -112,9 +112,8 @@
if (MediaController.canPlay(item)) {
var resumePosition = (item.UserData || {}).PlaybackPositionTicks || 0;
var onPlayClick = 'LibraryBrowser.showPlayMenu(this, \'' + item.Id + '\', \'' + item.Type + '\', ' + item.IsFolder + ', \'' + item.MediaType + '\', ' + resumePosition + ');return false;';
html += '<button type="button" data-mini="true" data-inline="true" data-icon="play" data-iconpos="notext" title="' + Globalize.translate('ButtonPlay') + '" onclick="' + onPlayClick + '" style="' + buttonMargin + '">' + Globalize.translate('ButtonPlay') + '</button>';
html += '<button type="button" class="btnPlayItem" data-itemid="' + item.Id + '" data-itemtype="' + item.Type + '" data-isfolder="' + item.IsFolder + '" data-mediatype="' + item.MediaType + '" data-resumeposition="' + resumePosition + '" data-mini="true" data-inline="true" data-icon="play" data-iconpos="notext" title="' + Globalize.translate('ButtonPlay') + '" style="' + buttonMargin + '">' + Globalize.translate('ButtonPlay') + '</button>';
buttonCount++;
}
@ -152,6 +151,21 @@
return false;
}
function onPlayItemButtonClick() {
var id = this.getAttribute('data-itemid');
var type = this.getAttribute('data-itemtype');
var isFolder = this.getAttribute('data-isfolder') == 'true';
var mediaType = this.getAttribute('data-mediatype');
var resumePosition = parseInt(this.getAttribute('data-resumeposition'));
closeContextMenu();
LibraryBrowser.showPlayMenu(this, id, type, isFolder, mediaType, resumePosition);
return false;
}
function onMoreButtonClick() {
var card = $(this).parents('.card')[0];
@ -549,6 +563,7 @@
innerElem.html(getOverlayHtml(item, user, elem, commands)).trigger('create');
$('.btnPlayItem', innerElem).on('click', onPlayItemButtonClick);
$('.btnPlayTrailer', innerElem).on('click', onTrailerButtonClick);
$('.btnMoreCommands', innerElem).on('click', onMoreButtonClick);
});

View File

@ -2,6 +2,8 @@
function loadAdvancedConfig(page, config) {
$('#chkSaveMetadataHidden', page).checked(config.SaveMetadataHidden).checkboxradio("refresh");
$('#chkEnableTmdbPersonUpdates', page).checked(config.EnableTmdbUpdates).checkboxradio("refresh");
$('#chkEnableTvdbUpdates', page).checked(config.EnableTvDbUpdates).checkboxradio("refresh");
$('#chkEnableFanartUpdates', page).checked(config.EnableFanArtUpdates).checkboxradio("refresh");
@ -174,6 +176,8 @@
ApiClient.getServerConfiguration().done(function (config) {
config.SaveMetadataHidden = $('#chkSaveMetadataHidden', form).checked();
config.EnableTvDbUpdates = $('#chkEnableTvdbUpdates', form).checked();
config.EnableTmdbUpdates = $('#chkEnableTmdbPersonUpdates', form).checked();
config.EnableFanArtUpdates = $('#chkEnableFanartUpdates', form).checked();