fixes #592 - Add options to import missing and future episodes

This commit is contained in:
Luke Pulverenti 2013-10-16 19:35:11 -04:00
parent 6d4e555bb8
commit b23426bb93
13 changed files with 167 additions and 18 deletions

View File

@ -11,6 +11,7 @@
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="metadata.html" data-role="button">Basics</a>
<a href="metadatatv.html" data-role="button">TV Settings</a>
<a href="metadataimages.html" data-role="button">Images</a>
<a href="advancedmetadata.html" data-role="button" class="ui-btn-active">Advanced</a>
</div>

View File

@ -108,6 +108,12 @@
<input type="checkbox" data-theme="c" name="chkSpecialFeature" id="chkSpecialFeature" data-mini="true">
<label for="chkSpecialFeature">Season 0</label>
<input type="checkbox" data-theme="c" name="chkFutureEpisode" id="chkFutureEpisode" data-mini="true">
<label for="chkFutureEpisode">Future Episode</label>
<input type="checkbox" data-theme="c" name="chkMissingEpisode" id="chkMissingEpisode" data-mini="true">
<label for="chkMissingEpisode">Missing Episode</label>
</fieldset>
<fieldset data-role="controlgroup">
<legend>

View File

@ -11,6 +11,7 @@
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="metadata.html" data-role="button" class="ui-btn-active">Basics</a>
<a href="metadatatv.html" data-role="button">TV Settings</a>
<a href="metadataimages.html" data-role="button">Images</a>
<a href="advancedmetadata.html" data-role="button">Advanced</a>
</div>
@ -37,11 +38,6 @@
<label for="selectCountry">Country: </label>
<select name="selectCountry" id="selectCountry"></select>
</li>
<li>
<input type="checkbox" id="chkEnableTvdbUpdates" name="chkEnableTvdbUpdates" />
<label for="chkEnableTvdbUpdates">Enable automatic tvdb updates</label>
<div class="fieldDescription">If enabled, tv series and episodes will be updated automatically as they are updated on the tvdb.com.</div>
</li>
<li>
<input type="checkbox" id="chkEnableTmdbPersonUpdates" name="chkEnableTmdbPersonUpdates" />
<label for="chkEnableTmdbPersonUpdates">Enable automatic tmdb updates</label>

View File

@ -11,6 +11,7 @@
<div class="content-primary">
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
<a href="metadata.html" data-role="button">Basics</a>
<a href="metadatatv.html" data-role="button">TV Settings</a>
<a href="metadataimages.html" data-role="button" class="ui-btn-active">Images</a>
<a href="advancedmetadata.html" data-role="button">Advanced</a>
</div>

View File

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<title>Metadata</title>
</head>
<body>
<div id="metadataTvPage" data-role="page" class="page type-interior">
<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">Basics</a>
<a href="metadatatv.html" data-role="button" class="ui-btn-active">TV Settings</a>
<a href="metadataimages.html" data-role="button">Images</a>
<a href="advancedmetadata.html" data-role="button">Advanced</a>
</div>
<form id="metadataTvForm">
<ul data-role="listview" class="ulForm">
<li>
<input type="checkbox" id="chkEnableTvdbUpdates" name="chkEnableTvdbUpdates" />
<label for="chkEnableTvdbUpdates">Enable automatic tvdb updates</label>
<div class="fieldDescription">If enabled, tv series and episodes will be updated automatically as they are updated on the tvdb.com.</div>
</li>
<li>
<input type="checkbox" id="chkCreateMissingEpisodes" name="chkCreateMissingEpisodes" />
<label for="chkCreateMissingEpisodes">Import missing epsiodes</label>
<div class="fieldDescription">Display missing episodes as part of your library.</div>
</li>
<li>
<input type="checkbox" id="chkCreateFutureEpisodes" name="chkCreateFutureEpisodes" />
<label for="chkCreateFutureEpisodes">Import future epsiodes</label>
<div class="fieldDescription">Display future episodes as part of your library. Automatic Tvdb updates are recommended to stay up to date with new metadata.</div>
</li>
<li>
<button type="submit" data-theme="b" data-icon="ok">
Save
</button>
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete">
Cancel
</button>
</li>
</ul>
</form>
</div>
</div>
<script type="text/javascript">
$('#metadataTvForm').on('submit', MetadataTVPage.onSubmit);
</script>
</div>
</body>
</html>

View File

@ -30,7 +30,7 @@
$('#offlineIndicator', page).hide();
}
if (MediaPlayer.canPlay(item) && item.LocationType !== "Offline") {
if (MediaPlayer.canPlay(item) && item.LocationType !== "Offline" && item.LocationType !== "Virtual") {
$('#playButtonContainer', page).show();
} else {
$('#playButtonContainer', page).hide();

View File

@ -12,8 +12,8 @@
Fields: "DateCreated,SeriesInfo",
StartIndex: 0
};
LibraryBrowser.loadSavedQueryValues('episodes', query);
LibraryBrowser.loadSavedQueryValues('episodes', query);
function reloadItems(page) {
@ -61,13 +61,25 @@
query.StartIndex = 0;
reloadItems(page);
});
LibraryBrowser.saveQueryValues('episodes', query);
LibraryBrowser.saveQueryValues('episodes', query);
Dashboard.hideLoadingMsg();
});
}
function formatDigit(i) {
return i < 10 ? "0" + i : i;
}
function getDateFormat(date) {
// yyyyMMddHHmmss
var d = date;
return "" + d.getFullYear() + formatDigit(d.getMonth() + 1) + formatDigit(d.getDate()) + formatDigit(d.getHours()) + formatDigit(d.getMinutes()) + formatDigit(d.getSeconds());
}
$(document).on('pageinit', "#episodesPage", function () {
var page = this;
@ -166,6 +178,24 @@
reloadItems(page);
});
$('#chkMissingEpisode', this).on('change', function () {
query.LocationTypes = this.checked ? "virtual" : null;
query.MaxPremiereDate = this.checked ? getDateFormat(new Date()) : null;
query.HasPremiereDate = this.checked ? true : null;
reloadItems(page);
});
$('#chkFutureEpisode', this).on('change', function () {
query.LocationTypes = this.checked ? "virtual" : null;
query.MinPremiereDate = this.checked ? getDateFormat(new Date()) : null;
query.HasPremiereDate = this.checked ? true : null;
reloadItems(page);
});
$('.alphabetPicker', this).on('alphaselect', function (e, character) {
query.NameStartsWithOrGreater = character;
@ -229,10 +259,10 @@
$('#chkSubtitle', this).checked(query.HasSubtitles == true).checkboxradio('refresh');
$('#chkTrailer', this).checked(query.HasTrailer == true).checkboxradio('refresh');
$('#chkSpecialFeature', this).checked(query.HasSpecialFeature == true).checkboxradio('refresh');
$('#chkThemeSong', this).checked(query.HasThemeSong == true).checkboxradio('refresh');
$('#chkThemeVideo', this).checked(query.HasThemeVideo == true).checkboxradio('refresh');
$('#chkSpecialFeature', this).checked(query.ParentIndexNumber == 0).checkboxradio('refresh');
$('#chkMissingEpisode', this).checked(query.LocationTypes == "virtual").checkboxradio('refresh');
$('.alphabetPicker', this).alphaValue(query.NameStartsWithOrGreater);

View File

@ -842,6 +842,10 @@
},
getNewIndicatorHtml: function (item) {
if (item.LocationType == 'Virtual') {
return '';
}
if (item.Type == "Season") {
if (item.RecursiveUnplayedItemCount) {
return '<div class="posterRibbon">' + item.RecursiveUnplayedItemCount + ' New</div>';
@ -1785,7 +1789,7 @@
renderStudios: function (elem, item, context) {
if (item.Studios && item.Studios.length) {
if (item.Studios && item.Studios.length && item.Type != "Series") {
var prefix = item.Studios.length > 1 ? "Studios" : "Studio";
var html = prefix + ':&nbsp;&nbsp;';

View File

@ -43,7 +43,6 @@
$('#selectLanguage', page).val(config.PreferredMetadataLanguage).selectmenu("refresh");
$('#selectCountry', page).val(config.MetadataCountryCode).selectmenu("refresh");
$('#chkEnableInternetProviders', page).checked(config.EnableInternetProviders).checkboxradio("refresh");
$('#chkEnableTvdbUpdates', page).checked(config.EnableTvDbUpdates).checkboxradio("refresh");
$('#chkEnableTmdbPersonUpdates', page).checked(config.EnableTmdbUpdates).checkboxradio("refresh");
Dashboard.hideLoadingMsg();
@ -89,7 +88,6 @@
ApiClient.getServerConfiguration().done(function (config) {
config.EnableTmdbUpdates = $('#chkEnableTmdbPersonUpdates', form).checked();
config.EnableTvDbUpdates = $('#chkEnableTvdbUpdates', form).checked();
config.EnableInternetProviders = $('#chkEnableInternetProviders', form).checked();
config.SaveLocalMeta = $('#chkSaveLocal', form).checked();
config.MetadataRefreshDays = $('#txtRefreshDays', form).val();

View File

@ -0,0 +1,52 @@
var MetadataTVPage = {
onPageShow: function () {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (result) {
MetadataTVPage.load(page, result);
});
},
load: function (page, config) {
var chkEnableTvdbUpdates = $('#chkEnableTvdbUpdates', page).checked(config.EnableTvDbUpdates).checkboxradio("refresh");
var chkCreateMissingEpisodes = $('#chkCreateMissingEpisodes', page).checked(config.CreateVirtualMissingEpisodes).checkboxradio("refresh");
var chkCreateFutureEpisodes = $('#chkCreateFutureEpisodes', page).checked(config.CreateVirtualFutureEpisodes).checkboxradio("refresh");
if (config.EnableInternetProviders) {
chkEnableTvdbUpdates.checkboxradio("enable");
chkCreateMissingEpisodes.checkboxradio("enable");
chkCreateFutureEpisodes.checkboxradio("enable");
} else {
chkEnableTvdbUpdates.checkboxradio("disable");
chkCreateMissingEpisodes.checkboxradio("disable");
chkCreateFutureEpisodes.checkboxradio("disable");
}
Dashboard.hideLoadingMsg();
},
onSubmit: function () {
var form = this;
Dashboard.showLoadingMsg();
ApiClient.getServerConfiguration().done(function (config) {
config.EnableTvDbUpdates = $('#chkEnableTvdbUpdates', form).checked();
config.CreateVirtualMissingEpisodes = $('#chkCreateMissingEpisodes', form).checked();
config.CreateVirtualFutureEpisodes = $('#chkCreateFutureEpisodes', form).checked();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
};
$(document).on('pageshow', "#metadataTvPage", MetadataTVPage.onPageShow);

View File

@ -288,7 +288,7 @@
browseButtonContainer.show();
if (item.Type != 'Person' && item.Type != 'Genre' && item.Type != 'Studio' && item.Type != 'GameGenre' && item.Type != 'MusicGenre') {
if (item.Type != 'Person' && item.Type != 'Genre' && item.Type != 'Studio' && item.Type != 'GameGenre' && item.Type != 'MusicGenre' && item.LocationType != 'Virtual') {
playButtonContainer.show();
queueButtonContainer.show();
}
@ -457,7 +457,11 @@
html += '<label for="selectCommand">Select command</label>';
html += '<select id="selectCommand" data-mini="true">';
html += '<option value="Play" selected>Play</label>';
if (item.LocationType == 'Virtual') {
html += '<option value="Play" selected>Browse</label>';
} else {
html += '<option value="Play" selected>Play</label>';
}
if (item.Chapters && item.Chapters.length) {
html += '<option value="PlayFromChapter">Play from scene</label>';

View File

@ -8,7 +8,8 @@
Limit: 24,
Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated",
UserId: Dashboard.getCurrentUserId()
UserId: Dashboard.getCurrentUserId(),
ExcludeLocationTypes: "Virtual"
};
ApiClient.getNextUpEpisodes(options).done(function (result) {

View File

@ -12,7 +12,8 @@
Limit: 8,
Recursive: true,
Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData",
Filters: "IsUnplayed"
Filters: "IsUnplayed",
ExcludeLocationTypes: "Virtual"
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {