diff --git a/src/components/indicators/indicators.js b/src/components/indicators/indicators.js
index c1e9417914..739982ae37 100644
--- a/src/components/indicators/indicators.js
+++ b/src/components/indicators/indicators.js
@@ -1,183 +1,183 @@
- import datetime from 'datetime';
- import itemHelper from 'itemHelper';
- import 'emby-progressbar';
- import 'css!./indicators.css';
- import 'material-icons';
+import datetime from 'datetime';
+import itemHelper from 'itemHelper';
+import 'emby-progressbar';
+import 'css!./indicators.css';
+import 'material-icons';
- export function enableProgressIndicator(item) {
- if (item.MediaType === 'Video' && item.Type !== 'TvChannel') {
- return true;
- }
-
- if (item.Type === 'AudioBook' || item.Type === 'AudioPodcast') {
- return true;
- }
-
- return false;
+export function enableProgressIndicator(item) {
+ if (item.MediaType === 'Video' && item.Type !== 'TvChannel') {
+ return true;
}
- export function getProgressHtml(pct, options) {
- let containerClass = 'itemProgressBar';
- if(options && options.containerClass) {
- containerClass += ' ' + options.containerClass
- }
-
- return '
';
+ if (item.Type === 'AudioBook' || item.Type === 'AudioPodcast') {
+ return true;
}
- function getAutoTimeProgressHtml(pct, options, isRecording, start, end) {
- let containerClass = 'itemProgressBar';
- if(options && options.containerClass) {
- containerClass += ' ' + options.containerClass
- }
+ return false;
+}
- let foregroundClass = 'itemProgressBarForeground';
- if (isRecording) {
- foregroundClass += ' itemProgressBarForeground-recording';
- }
-
- return '';
+export function getProgressHtml(pct, options) {
+ let containerClass = 'itemProgressBar';
+ if(options && options.containerClass) {
+ containerClass += ' ' + options.containerClass
}
- export function getProgressBarHtml(item, options) {
- let pct;
- if (enableProgressIndicator(item) && item.Type !== 'Recording') {
- const userData = options && options.userData ? options.userData : item.UserData;
+ return '';
+}
- if (userData) {
- pct = userData.PlayedPercentage;
- if (pct && pct < 100) {
- return getProgressHtml(pct, options);
- }
+function getAutoTimeProgressHtml(pct, options, isRecording, start, end) {
+ let containerClass = 'itemProgressBar';
+ if(options && options.containerClass) {
+ containerClass += ' ' + options.containerClass
+ }
+
+ let foregroundClass = 'itemProgressBarForeground';
+ if (isRecording) {
+ foregroundClass += ' itemProgressBarForeground-recording';
+ }
+
+ return '';
+}
+
+export function getProgressBarHtml(item, options) {
+ let pct;
+ if (enableProgressIndicator(item) && item.Type !== 'Recording') {
+ const userData = options && options.userData ? options.userData : item.UserData;
+
+ if (userData) {
+ pct = userData.PlayedPercentage;
+ if (pct && pct < 100) {
+ return getProgressHtml(pct, options);
}
}
+ }
- if ((item.Type === 'Program' || item.Type === 'Timer' || item.Type === 'Recording') && item.StartDate && item.EndDate) {
- let startDate = 0;
- let endDate = 1;
+ if ((item.Type === 'Program' || item.Type === 'Timer' || item.Type === 'Recording') && item.StartDate && item.EndDate) {
+ let startDate = 0;
+ let endDate = 1;
+ try {
+ startDate = datetime.parseISO8601Date(item.StartDate).getTime();
+ endDate = datetime.parseISO8601Date(item.EndDate).getTime();
+ } catch (err) {
+ console.error(err);
+ }
+
+ const now = new Date().getTime();
+ const total = endDate - startDate;
+ pct = 100 * ((now - startDate) / total);
+
+ if (pct > 0 && pct < 100) {
+ const isRecording = item.Type === 'Timer' || item.Type === 'Recording' || item.TimerId;
+ return getAutoTimeProgressHtml(pct, options, isRecording, startDate, endDate);
+ }
+ }
+
+ return '';
+}
+
+export function enablePlayedIndicator(item) {
+ return itemHelper.canMarkPlayed(item);
+}
+
+export function getPlayedIndicatorHtml(item) {
+ if (enablePlayedIndicator(item)) {
+ let userData = item.UserData || {};
+ if (userData.UnplayedItemCount) {
+ return '' + userData.UnplayedItemCount + '
';
+ }
+
+ if (userData.PlayedPercentage && userData.PlayedPercentage >= 100 || (userData.Played)) {
+ return '
';
+ }
+ }
+
+ return '';
+}
+
+export function getChildCountIndicatorHtml(item, options) {
+ const minCount = options && options.minCount ? options.minCount : 0;
+
+ if (item.ChildCount && item.ChildCount > minCount) {
+ return '' + item.ChildCount + '
';
+ }
+
+ return '';
+}
+
+export function getTimerIndicator(item) {
+ let status;
+
+ if (item.Type === 'SeriesTimer') {
+ return '';
+ } else if (item.TimerId || item.SeriesTimerId) {
+ status = item.Status || 'Cancelled';
+ } else if (item.Type === 'Timer') {
+ status = item.Status;
+ } else {
+ return '';
+ }
+
+ if (item.SeriesTimerId) {
+ if (status !== 'Cancelled') {
+ return '';
+ }
+
+ return '';
+ }
+
+ return '';
+}
+
+export function getSyncIndicator(item) {
+ if (item.SyncPercent === 100) {
+ return '
';
+ } else if (item.SyncPercent != null) {
+ return '
';
+ }
+
+ return '';
+}
+
+export function getTypeIndicator(item) {
+ const iconT = {
+ 'Video' : 'videocam',
+ 'Folder' : 'folder',
+ 'PhotoAlbum' : 'photo_album',
+ 'Photo' : 'photo'
+ }
+
+ const icon = iconT[item.Type];
+ return icon ? '
' : '';
+}
+
+export function getMissingIndicator(item) {
+ if (item.Type === 'Episode' && item.LocationType === 'Virtual') {
+ if (item.PremiereDate) {
try {
- startDate = datetime.parseISO8601Date(item.StartDate).getTime();
- endDate = datetime.parseISO8601Date(item.EndDate).getTime();
+ const premiereDate = datetime.parseISO8601Date(item.PremiereDate).getTime();
+ if (premiereDate > new Date().getTime()) {
+ return 'Unaired
';
+ }
} catch (err) {
console.error(err);
}
-
- const now = new Date().getTime();
- const total = endDate - startDate;
- pct = 100 * ((now - startDate) / total);
-
- if (pct > 0 && pct < 100) {
- const isRecording = item.Type === 'Timer' || item.Type === 'Recording' || item.TimerId;
- return getAutoTimeProgressHtml(pct, options, isRecording, startDate, endDate);
- }
}
-
- return '';
+ return 'Missing
';
}
- export function enablePlayedIndicator(item) {
- return itemHelper.canMarkPlayed(item);
- }
+ return '';
+}
- export function getPlayedIndicatorHtml(item) {
- if (enablePlayedIndicator(item)) {
- let userData = item.UserData || {};
- if (userData.UnplayedItemCount) {
- return '' + userData.UnplayedItemCount + '
';
- }
-
- if (userData.PlayedPercentage && userData.PlayedPercentage >= 100 || (userData.Played)) {
- return '
';
- }
- }
-
- return '';
- }
-
- export function getChildCountIndicatorHtml(item, options) {
- const minCount = options && options.minCount ? options.minCount : 0;
-
- if (item.ChildCount && item.ChildCount > minCount) {
- return '' + item.ChildCount + '
';
- }
-
- return '';
- }
-
- export function getTimerIndicator(item) {
- let status;
-
- if (item.Type === 'SeriesTimer') {
- return '';
- } else if (item.TimerId || item.SeriesTimerId) {
- status = item.Status || 'Cancelled';
- } else if (item.Type === 'Timer') {
- status = item.Status;
- } else {
- return '';
- }
-
- if (item.SeriesTimerId) {
- if (status !== 'Cancelled') {
- return '';
- }
-
- return '';
- }
-
- return '';
- }
-
- export function getSyncIndicator(item) {
- if (item.SyncPercent === 100) {
- return '
';
- } else if (item.SyncPercent != null) {
- return '
';
- }
-
- return '';
- }
-
- export function getTypeIndicator(item) {
- const iconT = {
- 'Video' : 'videocam',
- 'Folder' : 'folder',
- 'PhotoAlbum' : 'photo_album',
- 'Photo' : 'photo'
- }
-
- const icon = iconT[item.Type];
- return icon ? '
' : '';
- }
-
- export function getMissingIndicator(item) {
- if (item.Type === 'Episode' && item.LocationType === 'Virtual') {
- if (item.PremiereDate) {
- try {
- const premiereDate = datetime.parseISO8601Date(item.PremiereDate).getTime();
- if (premiereDate > new Date().getTime()) {
- return 'Unaired
';
- }
- } catch (err) {
- console.error(err);
- }
- }
- return 'Missing
';
- }
-
- return '';
- }
-
- export default {
- getProgressHtml: getProgressHtml,
- getProgressBarHtml: getProgressBarHtml,
- getPlayedIndicatorHtml: getPlayedIndicatorHtml,
- getChildCountIndicatorHtml: getChildCountIndicatorHtml,
- enableProgressIndicator: enableProgressIndicator,
- getTimerIndicator: getTimerIndicator,
- enablePlayedIndicator: enablePlayedIndicator,
- getSyncIndicator: getSyncIndicator,
- getTypeIndicator: getTypeIndicator,
- getMissingIndicator: getMissingIndicator
- };
+export default {
+ getProgressHtml: getProgressHtml,
+ getProgressBarHtml: getProgressBarHtml,
+ getPlayedIndicatorHtml: getPlayedIndicatorHtml,
+ getChildCountIndicatorHtml: getChildCountIndicatorHtml,
+ enableProgressIndicator: enableProgressIndicator,
+ getTimerIndicator: getTimerIndicator,
+ enablePlayedIndicator: enablePlayedIndicator,
+ getSyncIndicator: getSyncIndicator,
+ getTypeIndicator: getTypeIndicator,
+ getMissingIndicator: getMissingIndicator
+};