fixes #795 - Support reading Xbmc nfo's

This commit is contained in:
Luke Pulverenti 2014-06-29 23:04:50 -04:00
parent 6c602e1ad7
commit 0114319d87
7 changed files with 140 additions and 0 deletions

View File

@ -14,6 +14,7 @@
<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="metadataxbmc.html" data-role="button">${TabXbmcMetadata}</a>
<a href="metadataadvanced.html" data-role="button">${TabOther}</a>
</div>

View File

@ -14,6 +14,7 @@
<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="metadataxbmc.html" data-role="button">${TabXbmcMetadata}</a>
<a href="#" data-role="button" class="ui-btn-active">${TabOther}</a>
</div>

View File

@ -14,6 +14,7 @@
<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="metadataxbmc.html" data-role="button">${TabXbmcMetadata}</a>
<a href="metadataadvanced.html" data-role="button">${TabOther}</a>
</div>

View File

@ -14,6 +14,7 @@
<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="metadataxbmc.html" data-role="button">${TabXbmcMetadata}</a>
<a href="metadataadvanced.html" data-role="button">${TabOther}</a>
</div>

View File

@ -14,6 +14,7 @@
<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="metadataxbmc.html" data-role="button">${TabXbmcMetadata}</a>
<a href="metadataadvanced.html" data-role="button">${TabOther}</a>
</div>

View File

@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<head>
<title>${TitleMetadata}</title>
</head>
<body>
<div id="metadataXbmcPage" 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="metadatachapters.html" data-role="button">${TabChapters}</a>
<a href="metadatasubtitles.html" data-role="button">${TabSubtitles}</a>
<a href="#" class="ui-btn-active" data-role="button">${TabXbmcMetadata}</a>
<a href="metadataadvanced.html" data-role="button">${TabOther}</a>
</div>
<form class="metadataXbmcForm">
<p>${HeaderXbmcMetadataHelp}</p>
<br />
<ul class="ulForm" data-role="listview">
<li>
<label for="selectUser">${LabelXbmcMetadataUser}</label>
<select name="selectUser" id="selectUser" data-mini="true">
</select>
<div class="fieldDescription">${LabelXbmcMetadataUserHelp}</div>
</li>
<li>
<label for="selectReleaseDateFormat">${LabelXbmcMetadataDateFormat}</label>
<select name="selectReleaseDateFormat" id="selectReleaseDateFormat" data-mini="true">
<option value="yyyy-MM-dd">yyyy-MM-dd</option>
</select>
<div class="fieldDescription">${LabelXbmcMetadataDateFormatHelp}</div>
</li>
<li>
<label for="chkSaveImagePaths">${LabelXbmcMetadataSaveImagePaths}</label>
<input id="chkSaveImagePaths" type="checkbox" data-mini="true" />
<div class="fieldDescription">${LabelXbmcMetadataSaveImagePathsHelp}</div>
</li>
<li>
<label for="chkEnablePathSubstitution">${LabelXbmcMetadataEnablePathSubstitution}</label>
<input id="chkEnablePathSubstitution" type="checkbox" data-mini="true" />
<div class="fieldDescription">
<div>${LabelXbmcMetadataEnablePathSubstitutionHelp}</div>
<div style="margin-top: .5em;"><a href="librarypathmapping.html">${LabelXbmcMetadataEnablePathSubstitutionHelp2}</a></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">
$('.metadataXbmcForm').off('submit', XbmcMetadataPage.onSubmit).on('submit', XbmcMetadataPage.onSubmit);
</script>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
(function ($, document, window) {
var metadataKey = "xbmcmetadata";
function loadPage(page, config, users) {
var html = '<option value="" selected="selected"></option>';
html += users.map(function (user) {
return '<option value="' + user.Id + '">' + user.Name + '</option>';
}).join('');
$('#selectUser', page).html(html).val(config.UserId || '').selectmenu('refresh');
$('#selectReleaseDateFormat', page).val(config.ReleaseDateFormat).selectmenu('refresh');
$('#chkSaveImagePaths', page).checked(config.SaveImagePathsInNfo).checkboxradio('refresh');
$('#chkEnablePathSubstitution', page).checked(config.EnablePathSubstitution).checkboxradio('refresh');
Dashboard.hideLoadingMsg();
}
$(document).on('pageshow', "#metadataXbmcPage", function () {
Dashboard.showLoadingMsg();
var page = this;
var promise1 = ApiClient.getUsers();
var promise2 = ApiClient.getNamedConfiguration(metadataKey);
$.when(promise1, promise2).done(function (response1, response2) {
loadPage(page, response2[0], response1[0]);
});
});
window.XbmcMetadataPage = {
onSubmit: function () {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration(metadataKey).done(function (config) {
config.UserId = $('#selectUser', form).val() || null;
config.ReleaseDateFormat = $('#selectReleaseDateFormat', form).val();
config.SaveImagePathsInNfo = $('#chkSaveImagePaths', form).checked();
config.EnablePathSubstitution = $('#chkEnablePathSubstitution', form).checked();
ApiClient.updateNamedConfiguration(metadataKey, config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
};
})(jQuery, document, window);