From b23426bb93286d2bef333ebdd6ae205c589aa540 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 16 Oct 2013 19:35:11 -0400 Subject: [PATCH] fixes #592 - Add options to import missing and future episodes --- dashboard-ui/advancedmetadata.html | 1 + dashboard-ui/episodes.html | 6 ++ dashboard-ui/metadata.html | 6 +- dashboard-ui/metadataimages.html | 1 + dashboard-ui/metadatatv.html | 55 +++++++++++++++++++ dashboard-ui/scripts/Itemdetailpage.js | 2 +- dashboard-ui/scripts/episodes.js | 40 ++++++++++++-- dashboard-ui/scripts/librarybrowser.js | 6 +- .../scripts/metadataconfigurationpage.js | 2 - dashboard-ui/scripts/metadatatv.js | 52 ++++++++++++++++++ dashboard-ui/scripts/remotecontrol.js | 8 ++- dashboard-ui/scripts/tvnextup.js | 3 +- dashboard-ui/scripts/tvrecommended.js | 3 +- 13 files changed, 167 insertions(+), 18 deletions(-) create mode 100644 dashboard-ui/metadatatv.html create mode 100644 dashboard-ui/scripts/metadatatv.js diff --git a/dashboard-ui/advancedmetadata.html b/dashboard-ui/advancedmetadata.html index 252df7de7f..59bec15c36 100644 --- a/dashboard-ui/advancedmetadata.html +++ b/dashboard-ui/advancedmetadata.html @@ -11,6 +11,7 @@
diff --git a/dashboard-ui/episodes.html b/dashboard-ui/episodes.html index bd6302d193..ad43aebb46 100644 --- a/dashboard-ui/episodes.html +++ b/dashboard-ui/episodes.html @@ -108,6 +108,12 @@ + + + + + +
diff --git a/dashboard-ui/metadata.html b/dashboard-ui/metadata.html index 74fb779823..da14198d84 100644 --- a/dashboard-ui/metadata.html +++ b/dashboard-ui/metadata.html @@ -11,6 +11,7 @@
@@ -37,11 +38,6 @@ -
  • - - -
    If enabled, tv series and episodes will be updated automatically as they are updated on the tvdb.com.
    -
  • diff --git a/dashboard-ui/metadataimages.html b/dashboard-ui/metadataimages.html index 1bb2cd2f61..e1b2aa3629 100644 --- a/dashboard-ui/metadataimages.html +++ b/dashboard-ui/metadataimages.html @@ -11,6 +11,7 @@
    diff --git a/dashboard-ui/metadatatv.html b/dashboard-ui/metadatatv.html new file mode 100644 index 0000000000..2fdc32f459 --- /dev/null +++ b/dashboard-ui/metadatatv.html @@ -0,0 +1,55 @@ + + + + Metadata + + +
    + +
    + +
    + + +
    +
      +
    • + + +
      If enabled, tv series and episodes will be updated automatically as they are updated on the tvdb.com.
      +
    • +
    • + + +
      Display missing episodes as part of your library.
      +
    • +
    • + + +
      Display future episodes as part of your library. Automatic Tvdb updates are recommended to stay up to date with new metadata.
      +
    • +
    • + + +
    • +
    +
    +
    + +
    + + +
    + + diff --git a/dashboard-ui/scripts/Itemdetailpage.js b/dashboard-ui/scripts/Itemdetailpage.js index 4b184d1b93..6ddb8167e2 100644 --- a/dashboard-ui/scripts/Itemdetailpage.js +++ b/dashboard-ui/scripts/Itemdetailpage.js @@ -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(); diff --git a/dashboard-ui/scripts/episodes.js b/dashboard-ui/scripts/episodes.js index cf0b87737f..5687c5a19c 100644 --- a/dashboard-ui/scripts/episodes.js +++ b/dashboard-ui/scripts/episodes.js @@ -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); diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 97e9c61b9c..dd8327f123 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -842,6 +842,10 @@ }, getNewIndicatorHtml: function (item) { + if (item.LocationType == 'Virtual') { + return ''; + } + if (item.Type == "Season") { if (item.RecursiveUnplayedItemCount) { return '
    ' + item.RecursiveUnplayedItemCount + ' New
    '; @@ -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 + ':  '; diff --git a/dashboard-ui/scripts/metadataconfigurationpage.js b/dashboard-ui/scripts/metadataconfigurationpage.js index d1b206e598..53d07fd7b1 100644 --- a/dashboard-ui/scripts/metadataconfigurationpage.js +++ b/dashboard-ui/scripts/metadataconfigurationpage.js @@ -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(); diff --git a/dashboard-ui/scripts/metadatatv.js b/dashboard-ui/scripts/metadatatv.js new file mode 100644 index 0000000000..a56e962c9c --- /dev/null +++ b/dashboard-ui/scripts/metadatatv.js @@ -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); \ No newline at end of file diff --git a/dashboard-ui/scripts/remotecontrol.js b/dashboard-ui/scripts/remotecontrol.js index 74f3d2eda1..fdda2c6b1a 100644 --- a/dashboard-ui/scripts/remotecontrol.js +++ b/dashboard-ui/scripts/remotecontrol.js @@ -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 += ''; html += '