diff --git a/dashboard-ui/itemdetails.html b/dashboard-ui/itemdetails.html
index fe3e036ed0..42f3f85ee2 100644
--- a/dashboard-ui/itemdetails.html
+++ b/dashboard-ui/itemdetails.html
@@ -42,6 +42,7 @@
Suggested
Next up
+
Upcoming
Shows
Episodes
Genres
diff --git a/dashboard-ui/scripts/episodes.js b/dashboard-ui/scripts/episodes.js
index 037b4a4f1c..30bfb25ce9 100644
--- a/dashboard-ui/scripts/episodes.js
+++ b/dashboard-ui/scripts/episodes.js
@@ -130,18 +130,6 @@
$('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater);
}
- 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;
@@ -246,7 +234,7 @@
query.LocationTypes = this.checked || futureChecked ? "virtual" : null;
query.HasPremiereDate = this.checked || futureChecked ? true : null;
- query.MaxPremiereDate = this.checked ? getDateFormat(new Date()) : null;
+ query.MaxPremiereDate = this.checked ? LibraryBrowser.getDateParamValue(new Date()) : null;
reloadItems(page);
});
@@ -257,7 +245,7 @@
query.LocationTypes = this.checked || missingChecked ? "virtual" : null;
query.HasPremiereDate = this.checked || missingChecked ? true : null;
- query.MinPremiereDate = this.checked ? getDateFormat(new Date()) : null;
+ query.MinPremiereDate = this.checked ? LibraryBrowser.getDateParamValue(new Date()) : null;
reloadItems(page);
});
diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js
index 10bcb7f8a6..0d1fe8eede 100644
--- a/dashboard-ui/scripts/librarybrowser.js
+++ b/dashboard-ui/scripts/librarybrowser.js
@@ -46,10 +46,21 @@
localStorage.setItem(key + '_' + Dashboard.getCurrentUserId(), JSON.stringify(values));
},
+ getDateParamValue: function (date) {
+
+ function formatDigit(i) {
+ return i < 10 ? "0" + i : i;
+ }
+
+ var d = date;
+
+ return "" + d.getFullYear() + formatDigit(d.getMonth() + 1) + formatDigit(d.getDate()) + formatDigit(d.getHours()) + formatDigit(d.getMinutes()) + formatDigit(d.getSeconds());
+ },
+
getPosterDetailViewHtml: function (options) {
var items = options.items;
- var currentYear;
+ var currentIndexValue;
if (!options.shape) {
options.shape = options.preferBackdrop ? "backdrop" : "poster";
@@ -66,10 +77,10 @@
if (options.timeline) {
var year = item.ProductionYear || "Unknown Year";
- if (year != currentYear) {
+ if (year != currentIndexValue) {
html += '';
- currentYear = year;
+ currentIndexValue = year;
}
}
@@ -643,6 +654,7 @@
getPosterViewHtml: function (options) {
var items = options.items;
+ var currentIndexValue;
options.shape = options.shape || "portrait";
@@ -654,6 +666,29 @@
var item = items[i];
+ var futureDateText;
+
+ if (item.PremiereDate) {
+ try {
+
+ futureDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(item.PremiereDate), true);
+
+ } catch (err) {
+
+ }
+ }
+
+ if (options.showPremiereDateIndex && futureDateText) {
+
+ var val = futureDateText || "Unknown Date";
+
+ if (val != currentIndexValue) {
+
+ html += '';
+ currentIndexValue = val;
+ }
+ }
+
var imgUrl = null;
var background = null;
var width = null;
@@ -668,7 +703,37 @@
tag: item.BackdropImageTags[0]
});
- } else if (item.ImageTags && item.ImageTags.Primary) {
+ }
+ else if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) {
+
+ imgUrl = ApiClient.getImageUrl(item, {
+ type: "Thumb",
+ height: 198,
+ width: 352,
+ tag: item.ImageTags.Thumb
+ });
+
+ }
+ else if (options.preferThumb && item.SeriesThumbImageTag) {
+
+ imgUrl = ApiClient.getImageUrl(item.SeriesId, {
+ type: "Thumb",
+ height: 198,
+ width: 352,
+ tag: item.SeriesThumbImageTag
+ });
+
+ }
+ else if (options.preferThumb && item.ParentThumbItemId) {
+
+ imgUrl = ApiClient.getThumbImageUrl(item, {
+ type: "Thumb",
+ height: 198,
+ width: 352
+ });
+
+ }
+ else if (item.ImageTags && item.ImageTags.Primary) {
height = 300;
width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
@@ -703,6 +768,35 @@
tag: item.BackdropImageTags[0]
});
+ }
+ else if (item.ImageTags && item.ImageTags.Thumb) {
+
+ imgUrl = ApiClient.getImageUrl(item, {
+ type: "Thumb",
+ height: 198,
+ width: 352,
+ tag: item.ImageTags.Thumb
+ });
+
+ }
+ else if (item.SeriesThumbImageTag) {
+
+ imgUrl = ApiClient.getImageUrl(item.SeriesId, {
+ type: "Thumb",
+ height: 198,
+ width: 352,
+ tag: item.SeriesThumbImageTag
+ });
+
+ }
+ else if (item.ParentThumbItemId) {
+
+ imgUrl = ApiClient.getThumbImageUrl(item, {
+ type: "Thumb",
+ height: 198,
+ width: 352
+ });
+
}
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
@@ -786,6 +880,22 @@
html += "
";
}
+ if (options.showPremiereDate && item.PremiereDate) {
+
+ try {
+
+ var date = parseISO8601Date(item.PremiereDate);
+
+ html += "
";
+ html += LibraryBrowser.getPremiereDateText(item, date);
+ html += "
";
+
+ } catch (err) {
+
+ }
+
+ }
+
if (options.showProgressBar) {
html += "
";
@@ -794,7 +904,9 @@
}
if (item.LocationType == "Offline" || item.LocationType == "Virtual") {
- html += LibraryBrowser.getOfflineIndicatorHtml(item);
+ if (options.showLocationTypeIndicator !== false) {
+ html += LibraryBrowser.getOfflineIndicatorHtml(item);
+ }
} else if (options.showNewIndicator !== false) {
html += LibraryBrowser.getNewIndicatorHtml(item);
}
@@ -806,6 +918,71 @@
return html;
},
+ isSameDay: function (date1, date2) {
+
+ return date1.getFullYear() == date2.getFullYear() && date1.getDate() == date2.getDate();
+
+ },
+
+ getFutureDateText: function (date, includeDayNamesInFuture) {
+
+ var weekday = [];
+ weekday[0] = "Sunday";
+ weekday[1] = "Monday";
+ weekday[2] = "Tuesday";
+ weekday[3] = "Wednesday";
+ weekday[4] = "Thursday";
+ weekday[5] = "Friday";
+ weekday[6] = "Saturday";
+
+ var currentDate = new Date();
+
+ var day;
+
+ if (LibraryBrowser.isSameDay(date, currentDate)) {
+ return "Today";
+ }
+
+ currentDate.setDate(currentDate.getDate() + 1);
+ if (LibraryBrowser.isSameDay(date, currentDate)) {
+ return "Tomorrow";
+ }
+
+ var todayDayOfWeek = new Date().getDay();
+ currentDate.setDate(currentDate.getDate() + 1);
+
+ while (currentDate.getDay() > todayDayOfWeek) {
+
+ currentDate.setDate(currentDate.getDate() + 1);
+
+ if (LibraryBrowser.isSameDay(date, currentDate)) {
+
+ return weekday[currentDate.getDay()];
+ }
+ }
+
+ if (includeDayNamesInFuture) {
+ return weekday[date.getDay()] + " " + date.toLocaleDateString();
+ }
+
+ return date.toLocaleDateString();
+ },
+
+ getPremiereDateText: function (item, date) {
+
+ var day = LibraryBrowser.getFutureDateText(date);
+
+ if (item.SeriesStudio) {
+ day += " on " + item.SeriesStudio;
+ }
+
+ if (item.AirTime) {
+ day += " at " + item.AirTime;
+ }
+
+ return day;
+ },
+
getPosterViewDisplayName: function (item) {
var name = item.Name;
diff --git a/dashboard-ui/scripts/tvrecommended.js b/dashboard-ui/scripts/tvrecommended.js
index 44daabecdc..9dd4b2a2ea 100644
--- a/dashboard-ui/scripts/tvrecommended.js
+++ b/dashboard-ui/scripts/tvrecommended.js
@@ -37,7 +37,8 @@
Filters: "IsResumable",
Limit: 8,
Recursive: true,
- Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData"
+ Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData",
+ ExcludeLocationTypes: "Virtual"
};
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
diff --git a/dashboard-ui/scripts/tvupcoming.js b/dashboard-ui/scripts/tvupcoming.js
new file mode 100644
index 0000000000..bc9c9e2163
--- /dev/null
+++ b/dashboard-ui/scripts/tvupcoming.js
@@ -0,0 +1,42 @@
+(function ($, document) {
+
+ $(document).on('pagebeforeshow', "#tvUpcomingPage", function () {
+
+ var page = this;
+
+ var options = {
+
+ SortBy: "PremiereDate,AirTime",
+ SortOrder: "Ascending",
+ IncludeItemTypes: "Episode",
+ Limit: 40,
+ Recursive: true,
+ Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData",
+ HasPremiereDate: true,
+ MinPremiereDate: LibraryBrowser.getDateParamValue(new Date())
+ };
+
+ ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
+
+ if (!result.Items.length) {
+ $('#upcomingItems', page).html("Nothing here. To utilize this feature, please enable future episodes in the dashboard metadata configuration.");
+ return;
+ }
+ $('#upcomingItems', page).html(LibraryBrowser.getPosterViewHtml({
+ items: result.Items,
+ useAverageAspectRatio: true,
+ showLocationTypeIndicator: false,
+ showNewIndicator: false,
+ shape: "backdrop",
+ showTitle: true,
+ showParentTitle: true,
+ showPremiereDate: true,
+ showPremiereDateIndex: true,
+ preferThumb: true
+ }));
+
+ });
+ });
+
+
+})(jQuery, document);
\ No newline at end of file
diff --git a/dashboard-ui/tvgenres.html b/dashboard-ui/tvgenres.html
index 159391f408..67ab35642c 100644
--- a/dashboard-ui/tvgenres.html
+++ b/dashboard-ui/tvgenres.html
@@ -8,6 +8,7 @@
Suggested
Next up
+
Upcoming
Shows
Episodes
Genres
diff --git a/dashboard-ui/tvnextup.html b/dashboard-ui/tvnextup.html
index d0514ff54b..f67ba3b722 100644
--- a/dashboard-ui/tvnextup.html
+++ b/dashboard-ui/tvnextup.html
@@ -8,6 +8,7 @@
Suggested
Next up
+
Upcoming
Shows
Episodes
Genres
diff --git a/dashboard-ui/tvpeople.html b/dashboard-ui/tvpeople.html
index aa650d7392..26aea9e3f9 100644
--- a/dashboard-ui/tvpeople.html
+++ b/dashboard-ui/tvpeople.html
@@ -8,6 +8,7 @@
Suggested
Next up
+
Upcoming
Shows
Episodes
Genres
diff --git a/dashboard-ui/tvrecommended.html b/dashboard-ui/tvrecommended.html
index fb6feee06e..af23b08391 100644
--- a/dashboard-ui/tvrecommended.html
+++ b/dashboard-ui/tvrecommended.html
@@ -8,6 +8,7 @@
Suggested
Next up
+
Upcoming
Shows
Episodes
Genres
diff --git a/dashboard-ui/tvshows.html b/dashboard-ui/tvshows.html
index 536ace8cdd..ab78f977ce 100644
--- a/dashboard-ui/tvshows.html
+++ b/dashboard-ui/tvshows.html
@@ -8,6 +8,7 @@
Suggested
Next up
+
Upcoming
Shows
Episodes
Genres
diff --git a/dashboard-ui/tvstudios.html b/dashboard-ui/tvstudios.html
index 65265c149a..113c8487e3 100644
--- a/dashboard-ui/tvstudios.html
+++ b/dashboard-ui/tvstudios.html
@@ -8,6 +8,7 @@
Suggested
Next up
+
Upcoming
Shows
Episodes
Genres
diff --git a/dashboard-ui/tvupcoming.html b/dashboard-ui/tvupcoming.html
new file mode 100644
index 0000000000..38ba294abc
--- /dev/null
+++ b/dashboard-ui/tvupcoming.html
@@ -0,0 +1,30 @@
+
+
+
+
Media Browser
+
+
+
+
+
diff --git a/packages.config b/packages.config
index f0ac36bc53..9c48b38095 100644
--- a/packages.config
+++ b/packages.config
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file