Unminify using 1.5.323
Repo with tag: https://github.com/MediaBrowser/emby-webcomponents/tree/1.5.323
This commit is contained in:
parent
4678528d00
commit
de6ac33ec1
289 changed files with 78483 additions and 54701 deletions
|
@ -1,248 +1,658 @@
|
|||
define(["datetime", "globalize", "appRouter", "itemHelper", "indicators", "material-icons", "css!./mediainfo.css", "programStyles", "emby-linkbutton"], function(datetime, globalize, appRouter, itemHelper, indicators) {
|
||||
"use strict";
|
||||
define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'material-icons', 'css!./mediainfo.css', 'programStyles', 'emby-linkbutton'], function (datetime, globalize, appRouter, itemHelper, indicators) {
|
||||
'use strict';
|
||||
|
||||
function getTimerIndicator(item) {
|
||||
|
||||
var status;
|
||||
if ("SeriesTimer" === item.Type) return '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon"></i>';
|
||||
if (item.TimerId || item.SeriesTimerId) status = item.Status || "Cancelled";
|
||||
else {
|
||||
if ("Timer" !== item.Type) return "";
|
||||
status = item.Status
|
||||
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
return '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon"></i>';
|
||||
}
|
||||
return item.SeriesTimerId ? "Cancelled" !== status ? '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon"></i>' : '<i class="md-icon mediaInfoItem mediaInfoIconItem"></i>' : '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon"></i>'
|
||||
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 '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon"></i>';
|
||||
}
|
||||
|
||||
return '<i class="md-icon mediaInfoItem mediaInfoIconItem"></i>';
|
||||
}
|
||||
|
||||
return '<i class="md-icon mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon"></i>';
|
||||
}
|
||||
|
||||
function getProgramInfoHtml(item, options) {
|
||||
var text, date, html = "",
|
||||
miscInfo = [];
|
||||
if (item.StartDate && !1 !== options.programTime) try {
|
||||
text = "", date = datetime.parseISO8601Date(item.StartDate), !1 !== options.startDate && (text += datetime.toLocaleDateString(date, {
|
||||
weekday: "short",
|
||||
month: "short",
|
||||
day: "numeric"
|
||||
})), text += " " + datetime.getDisplayTime(date), item.EndDate && (date = datetime.parseISO8601Date(item.EndDate), text += " - " + datetime.getDisplayTime(date)), miscInfo.push(text)
|
||||
} catch (e) {
|
||||
console.log("Error parsing date: " + item.StartDate)
|
||||
var html = '';
|
||||
|
||||
var miscInfo = [];
|
||||
var text, date;
|
||||
|
||||
if (item.StartDate && options.programTime !== false) {
|
||||
|
||||
try {
|
||||
|
||||
text = '';
|
||||
|
||||
date = datetime.parseISO8601Date(item.StartDate);
|
||||
|
||||
if (options.startDate !== false) {
|
||||
text += datetime.toLocaleDateString(date, { weekday: 'short', month: 'short', day: 'numeric' });
|
||||
}
|
||||
|
||||
text += ' ' + datetime.getDisplayTime(date);
|
||||
|
||||
if (item.EndDate) {
|
||||
date = datetime.parseISO8601Date(item.EndDate);
|
||||
text += ' - ' + datetime.getDisplayTime(date);
|
||||
}
|
||||
|
||||
miscInfo.push(text);
|
||||
}
|
||||
catch (e) {
|
||||
console.log("Error parsing date: " + item.StartDate);
|
||||
}
|
||||
}
|
||||
if (item.ChannelNumber && miscInfo.push("CH " + item.ChannelNumber), item.ChannelName && (options.interactive && item.ChannelId ? miscInfo.push({
|
||||
html: '<a is="emby-linkbutton" class="button-flat mediaInfoItem" href="' + appRouter.getRouteUrl({
|
||||
ServerId: item.ServerId,
|
||||
Type: "TvChannel",
|
||||
Name: item.ChannelName,
|
||||
Id: item.ChannelId
|
||||
}) + '">' + item.ChannelName + "</a>"
|
||||
}) : miscInfo.push(item.ChannelName)), !1 !== options.timerIndicator) {
|
||||
|
||||
if (item.ChannelNumber) {
|
||||
miscInfo.push('CH ' + item.ChannelNumber);
|
||||
}
|
||||
|
||||
if (item.ChannelName) {
|
||||
|
||||
if (options.interactive && item.ChannelId) {
|
||||
miscInfo.push({
|
||||
html: '<a is="emby-linkbutton" class="button-flat mediaInfoItem" href="' + appRouter.getRouteUrl({
|
||||
|
||||
ServerId: item.ServerId,
|
||||
Type: 'TvChannel',
|
||||
Name: item.ChannelName,
|
||||
Id: item.ChannelId
|
||||
|
||||
}) + '">' + item.ChannelName + '</a>'
|
||||
});
|
||||
} else {
|
||||
miscInfo.push(item.ChannelName);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.timerIndicator !== false) {
|
||||
var timerHtml = getTimerIndicator(item);
|
||||
timerHtml && miscInfo.push({
|
||||
html: timerHtml
|
||||
})
|
||||
if (timerHtml) {
|
||||
miscInfo.push({
|
||||
html: timerHtml
|
||||
});
|
||||
}
|
||||
}
|
||||
return html += miscInfo.map(function(m) {
|
||||
return getMediaInfoItem(m)
|
||||
}).join("")
|
||||
|
||||
html += miscInfo.map(function (m) {
|
||||
return getMediaInfoItem(m);
|
||||
}).join('');
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function getMediaInfoHtml(item, options) {
|
||||
var html = "",
|
||||
miscInfo = [];
|
||||
var html = '';
|
||||
|
||||
var miscInfo = [];
|
||||
options = options || {};
|
||||
var text, date, minutes, count, showFolderRuntime = "MusicAlbum" === item.Type || "MusicArtist" === item.MediaType || "Playlist" === item.MediaType || "MusicGenre" === item.MediaType;
|
||||
if (showFolderRuntime ? (count = item.SongCount || item.ChildCount, count && miscInfo.push(globalize.translate("sharedcomponents#TrackCount", count)), item.RunTimeTicks && miscInfo.push(datetime.getDisplayRunningTime(item.RunTimeTicks))) : "PhotoAlbum" !== item.Type && "BoxSet" !== item.Type || (count = item.ChildCount) && miscInfo.push(globalize.translate("sharedcomponents#ItemCount", count)), ("Episode" === item.Type || "Photo" === item.MediaType) && !1 !== options.originalAirDate && item.PremiereDate) try {
|
||||
date = datetime.parseISO8601Date(item.PremiereDate), text = datetime.toLocaleDateString(date), miscInfo.push(text)
|
||||
} catch (e) {
|
||||
console.log("Error parsing date: " + item.PremiereDate)
|
||||
}
|
||||
if ("SeriesTimer" === item.Type && (item.RecordAnyTime ? miscInfo.push(globalize.translate("sharedcomponents#Anytime")) : miscInfo.push(datetime.getDisplayTime(item.StartDate)), item.RecordAnyChannel ? miscInfo.push(globalize.translate("sharedcomponents#AllChannels")) : miscInfo.push(item.ChannelName || globalize.translate("sharedcomponents#OneChannel"))), item.StartDate && "Program" !== item.Type && "SeriesTimer" !== item.Type) try {
|
||||
date = datetime.parseISO8601Date(item.StartDate), text = datetime.toLocaleDateString(date), miscInfo.push(text), "Recording" !== item.Type && (text = datetime.getDisplayTime(date), miscInfo.push(text))
|
||||
} catch (e) {
|
||||
console.log("Error parsing date: " + item.StartDate)
|
||||
}
|
||||
if (!1 !== options.year && item.ProductionYear && "Series" === item.Type)
|
||||
if ("Continuing" === item.Status) miscInfo.push(globalize.translate("sharedcomponents#SeriesYearToPresent", item.ProductionYear));
|
||||
else if (item.ProductionYear) {
|
||||
if (text = item.ProductionYear, item.EndDate) try {
|
||||
var endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
|
||||
endYear !== item.ProductionYear && (text += "-" + datetime.parseISO8601Date(item.EndDate).getFullYear())
|
||||
} catch (e) {
|
||||
console.log("Error parsing date: " + item.EndDate)
|
||||
var text, date, minutes;
|
||||
var count;
|
||||
|
||||
var showFolderRuntime = item.Type === "MusicAlbum" || item.MediaType === 'MusicArtist' || item.MediaType === 'Playlist' || item.MediaType === 'MusicGenre';
|
||||
|
||||
if (showFolderRuntime) {
|
||||
|
||||
count = item.SongCount || item.ChildCount;
|
||||
|
||||
if (count) {
|
||||
|
||||
miscInfo.push(globalize.translate('sharedcomponents#TrackCount', count));
|
||||
}
|
||||
|
||||
if (item.RunTimeTicks) {
|
||||
miscInfo.push(datetime.getDisplayRunningTime(item.RunTimeTicks));
|
||||
}
|
||||
miscInfo.push(text)
|
||||
}
|
||||
if ("Program" === item.Type)
|
||||
if (!1 !== options.programIndicator && (item.IsLive ? miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem liveTvProgram">' + globalize.translate("sharedcomponents#Live") + "</div>"
|
||||
}) : item.IsPremiere ? miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem premiereTvProgram">' + globalize.translate("sharedcomponents#Premiere") + "</div>"
|
||||
}) : item.IsSeries && !item.IsRepeat ? miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem newTvProgram">' + globalize.translate("sharedcomponents#AttributeNew") + "</div>"
|
||||
}) : item.IsSeries && item.IsRepeat && miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem repeatTvProgram">' + globalize.translate("sharedcomponents#Repeat") + "</div>"
|
||||
})), (item.IsSeries || item.EpisodeTitle) && !1 !== options.episodeTitle)(text = itemHelper.getDisplayName(item, {
|
||||
includeIndexNumber: options.episodeTitleIndexNumber
|
||||
})) && miscInfo.push(text);
|
||||
else if (item.IsMovie && item.ProductionYear && !1 !== options.originalAirDate) miscInfo.push(item.ProductionYear);
|
||||
else if (item.PremiereDate && !1 !== options.originalAirDate) try {
|
||||
date = datetime.parseISO8601Date(item.PremiereDate), text = globalize.translate("sharedcomponents#OriginalAirDateValue", datetime.toLocaleDateString(date)), miscInfo.push(text)
|
||||
} catch (e) {
|
||||
console.log("Error parsing date: " + item.PremiereDate)
|
||||
} else item.ProductionYear && miscInfo.push(item.ProductionYear);
|
||||
if (!1 !== options.year && "Series" !== item.Type && "Episode" !== item.Type && "Person" !== item.Type && "Photo" !== item.MediaType && "Program" !== item.Type && "Season" !== item.Type)
|
||||
if (item.ProductionYear) miscInfo.push(item.ProductionYear);
|
||||
else if (item.PremiereDate) try {
|
||||
text = datetime.parseISO8601Date(item.PremiereDate).getFullYear(), miscInfo.push(text)
|
||||
} catch (e) {
|
||||
console.log("Error parsing date: " + item.PremiereDate)
|
||||
|
||||
else if (item.Type === "PhotoAlbum" || item.Type === "BoxSet") {
|
||||
|
||||
count = item.ChildCount;
|
||||
|
||||
if (count) {
|
||||
|
||||
miscInfo.push(globalize.translate('sharedcomponents#ItemCount', count));
|
||||
}
|
||||
}
|
||||
if (item.RunTimeTicks && "Series" !== item.Type && "Program" !== item.Type && !showFolderRuntime && !1 !== options.runtime && ("Audio" === item.Type ? miscInfo.push(datetime.getDisplayRunningTime(item.RunTimeTicks)) : (minutes = item.RunTimeTicks / 6e8, minutes = minutes || 1, miscInfo.push(Math.round(minutes) + " mins"))), item.OfficialRating && "Season" !== item.Type && "Episode" !== item.Type && miscInfo.push({
|
||||
|
||||
if ((item.Type === "Episode" || item.MediaType === 'Photo') && options.originalAirDate !== false) {
|
||||
|
||||
if (item.PremiereDate) {
|
||||
|
||||
try {
|
||||
date = datetime.parseISO8601Date(item.PremiereDate);
|
||||
|
||||
text = datetime.toLocaleDateString(date);
|
||||
miscInfo.push(text);
|
||||
}
|
||||
catch (e) {
|
||||
console.log("Error parsing date: " + item.PremiereDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
if (item.RecordAnyTime) {
|
||||
|
||||
miscInfo.push(globalize.translate('sharedcomponents#Anytime'));
|
||||
} else {
|
||||
miscInfo.push(datetime.getDisplayTime(item.StartDate));
|
||||
}
|
||||
|
||||
if (item.RecordAnyChannel) {
|
||||
miscInfo.push(globalize.translate('sharedcomponents#AllChannels'));
|
||||
}
|
||||
else {
|
||||
miscInfo.push(item.ChannelName || globalize.translate('sharedcomponents#OneChannel'));
|
||||
}
|
||||
}
|
||||
|
||||
if (item.StartDate && item.Type !== 'Program' && item.Type !== 'SeriesTimer') {
|
||||
|
||||
try {
|
||||
date = datetime.parseISO8601Date(item.StartDate);
|
||||
|
||||
text = datetime.toLocaleDateString(date);
|
||||
miscInfo.push(text);
|
||||
|
||||
if (item.Type !== "Recording") {
|
||||
text = datetime.getDisplayTime(date);
|
||||
miscInfo.push(text);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.log("Error parsing date: " + item.StartDate);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.year !== false && item.ProductionYear && item.Type === "Series") {
|
||||
|
||||
if (item.Status === "Continuing") {
|
||||
miscInfo.push(globalize.translate('sharedcomponents#SeriesYearToPresent', item.ProductionYear));
|
||||
|
||||
}
|
||||
else if (item.ProductionYear) {
|
||||
|
||||
text = item.ProductionYear;
|
||||
|
||||
if (item.EndDate) {
|
||||
|
||||
try {
|
||||
|
||||
var endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
|
||||
|
||||
if (endYear !== item.ProductionYear) {
|
||||
text += "-" + datetime.parseISO8601Date(item.EndDate).getFullYear();
|
||||
}
|
||||
|
||||
}
|
||||
catch (e) {
|
||||
console.log("Error parsing date: " + item.EndDate);
|
||||
}
|
||||
}
|
||||
|
||||
miscInfo.push(text);
|
||||
}
|
||||
}
|
||||
|
||||
if (item.Type === 'Program') {
|
||||
|
||||
if (options.programIndicator !== false) {
|
||||
if (item.IsLive) {
|
||||
miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem liveTvProgram">' + globalize.translate('sharedcomponents#Live') + '</div>'
|
||||
});
|
||||
}
|
||||
else if (item.IsPremiere) {
|
||||
miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem premiereTvProgram">' + globalize.translate('sharedcomponents#Premiere') + '</div>'
|
||||
});
|
||||
}
|
||||
else if (item.IsSeries && !item.IsRepeat) {
|
||||
miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem newTvProgram">' + globalize.translate('sharedcomponents#AttributeNew') + '</div>'
|
||||
});
|
||||
}
|
||||
else if (item.IsSeries && item.IsRepeat) {
|
||||
miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem repeatTvProgram">' + globalize.translate('sharedcomponents#Repeat') + '</div>'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ((item.IsSeries || item.EpisodeTitle) && options.episodeTitle !== false) {
|
||||
|
||||
text = itemHelper.getDisplayName(item, {
|
||||
includeIndexNumber: options.episodeTitleIndexNumber
|
||||
});
|
||||
|
||||
if (text) {
|
||||
miscInfo.push(text);
|
||||
}
|
||||
}
|
||||
|
||||
else if (item.IsMovie && item.ProductionYear && options.originalAirDate !== false) {
|
||||
miscInfo.push(item.ProductionYear);
|
||||
}
|
||||
|
||||
else if (item.PremiereDate && options.originalAirDate !== false) {
|
||||
|
||||
try {
|
||||
date = datetime.parseISO8601Date(item.PremiereDate);
|
||||
text = globalize.translate('sharedcomponents#OriginalAirDateValue', datetime.toLocaleDateString(date));
|
||||
miscInfo.push(text);
|
||||
}
|
||||
catch (e) {
|
||||
console.log("Error parsing date: " + item.PremiereDate);
|
||||
}
|
||||
} else if (item.ProductionYear) {
|
||||
miscInfo.push(item.ProductionYear);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.year !== false) {
|
||||
if (item.Type !== "Series" && item.Type !== "Episode" && item.Type !== "Person" && item.MediaType !== 'Photo' && item.Type !== 'Program' && item.Type !== 'Season') {
|
||||
|
||||
if (item.ProductionYear) {
|
||||
|
||||
miscInfo.push(item.ProductionYear);
|
||||
}
|
||||
else if (item.PremiereDate) {
|
||||
|
||||
try {
|
||||
text = datetime.parseISO8601Date(item.PremiereDate).getFullYear();
|
||||
miscInfo.push(text);
|
||||
}
|
||||
catch (e) {
|
||||
console.log("Error parsing date: " + item.PremiereDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (item.RunTimeTicks && item.Type !== "Series" && item.Type !== 'Program' && !showFolderRuntime && options.runtime !== false) {
|
||||
|
||||
if (item.Type === "Audio") {
|
||||
|
||||
miscInfo.push(datetime.getDisplayRunningTime(item.RunTimeTicks));
|
||||
|
||||
} else {
|
||||
minutes = item.RunTimeTicks / 600000000;
|
||||
|
||||
minutes = minutes || 1;
|
||||
|
||||
miscInfo.push(Math.round(minutes) + " mins");
|
||||
}
|
||||
}
|
||||
|
||||
if (item.OfficialRating && item.Type !== "Season" && item.Type !== "Episode") {
|
||||
miscInfo.push({
|
||||
text: item.OfficialRating,
|
||||
cssClass: "mediaInfoOfficialRating"
|
||||
}), item.Video3DFormat && miscInfo.push("3D"), "Photo" === item.MediaType && item.Width && item.Height && miscInfo.push(item.Width + "x" + item.Height), !1 !== options.container && "Audio" === item.Type && item.Container && miscInfo.push(item.Container), html += miscInfo.map(function(m) {
|
||||
return getMediaInfoItem(m)
|
||||
}).join(""), html += getStarIconsHtml(item), item.HasSubtitles && !1 !== options.subtitles && (html += '<div class="mediaInfoItem mediaInfoText closedCaptionMediaInfoText">CC</div>'), item.CriticRating && !1 !== options.criticRating && (item.CriticRating >= 60 ? html += '<div class="mediaInfoItem mediaInfoCriticRating mediaInfoCriticRatingFresh">' + item.CriticRating + "</div>" : html += '<div class="mediaInfoItem mediaInfoCriticRating mediaInfoCriticRatingRotten">' + item.CriticRating + "</div>"), !1 !== options.endsAt) {
|
||||
var endsAt = getEndsAt(item);
|
||||
endsAt && (html += getMediaInfoItem(endsAt, "endsAt"))
|
||||
cssClass: 'mediaInfoOfficialRating'
|
||||
});
|
||||
}
|
||||
return html += indicators.getMissingIndicator(item)
|
||||
|
||||
if (item.Video3DFormat) {
|
||||
miscInfo.push("3D");
|
||||
}
|
||||
|
||||
if (item.MediaType === 'Photo' && item.Width && item.Height) {
|
||||
miscInfo.push(item.Width + "x" + item.Height);
|
||||
}
|
||||
|
||||
if (options.container !== false && item.Type === 'Audio' && item.Container) {
|
||||
miscInfo.push(item.Container);
|
||||
}
|
||||
|
||||
html += miscInfo.map(function (m) {
|
||||
return getMediaInfoItem(m);
|
||||
}).join('');
|
||||
|
||||
html += getStarIconsHtml(item);
|
||||
|
||||
if (item.HasSubtitles && options.subtitles !== false) {
|
||||
html += '<div class="mediaInfoItem mediaInfoText closedCaptionMediaInfoText">CC</div>';
|
||||
}
|
||||
|
||||
if (item.CriticRating && options.criticRating !== false) {
|
||||
|
||||
if (item.CriticRating >= 60) {
|
||||
html += '<div class="mediaInfoItem mediaInfoCriticRating mediaInfoCriticRatingFresh">' + item.CriticRating + '</div>';
|
||||
} else {
|
||||
html += '<div class="mediaInfoItem mediaInfoCriticRating mediaInfoCriticRatingRotten">' + item.CriticRating + '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (options.endsAt !== false) {
|
||||
|
||||
var endsAt = getEndsAt(item);
|
||||
if (endsAt) {
|
||||
html += getMediaInfoItem(endsAt, 'endsAt');
|
||||
}
|
||||
}
|
||||
|
||||
html += indicators.getMissingIndicator(item);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function getEndsAt(item) {
|
||||
if ("Video" === item.MediaType && item.RunTimeTicks && !item.StartDate) {
|
||||
var endDate = (new Date).getTime() + item.RunTimeTicks / 1e4;
|
||||
endDate = new Date(endDate);
|
||||
var displayTime = datetime.getDisplayTime(endDate);
|
||||
return globalize.translate("sharedcomponents#EndsAtValue", displayTime)
|
||||
|
||||
if (item.MediaType === 'Video' && item.RunTimeTicks) {
|
||||
|
||||
if (!item.StartDate) {
|
||||
var endDate = new Date().getTime() + (item.RunTimeTicks / 10000);
|
||||
endDate = new Date(endDate);
|
||||
|
||||
var displayTime = datetime.getDisplayTime(endDate);
|
||||
return globalize.translate('sharedcomponents#EndsAtValue', displayTime);
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getEndsAtFromPosition(runtimeTicks, positionTicks, includeText) {
|
||||
var endDate = (new Date).getTime() + (runtimeTicks - (positionTicks || 0)) / 1e4;
|
||||
|
||||
var endDate = new Date().getTime() + ((runtimeTicks - (positionTicks || 0)) / 10000);
|
||||
endDate = new Date(endDate);
|
||||
|
||||
var displayTime = datetime.getDisplayTime(endDate);
|
||||
return !1 === includeText ? displayTime : globalize.translate("sharedcomponents#EndsAtValue", displayTime)
|
||||
|
||||
if (includeText === false) {
|
||||
return displayTime;
|
||||
}
|
||||
return globalize.translate('sharedcomponents#EndsAtValue', displayTime);
|
||||
}
|
||||
|
||||
function getMediaInfoItem(m, cssClass) {
|
||||
cssClass = cssClass ? cssClass + " mediaInfoItem" : "mediaInfoItem";
|
||||
|
||||
cssClass = cssClass ? (cssClass + ' mediaInfoItem') : 'mediaInfoItem';
|
||||
var mediaInfoText = m;
|
||||
if ("string" != typeof m && "number" != typeof m) {
|
||||
if (m.html) return m.html;
|
||||
mediaInfoText = m.text, cssClass += " " + m.cssClass
|
||||
|
||||
if (typeof (m) !== 'string' && typeof (m) !== 'number') {
|
||||
|
||||
if (m.html) {
|
||||
return m.html;
|
||||
}
|
||||
mediaInfoText = m.text;
|
||||
cssClass += ' ' + m.cssClass;
|
||||
}
|
||||
return '<div class="' + cssClass + '">' + mediaInfoText + "</div>"
|
||||
return '<div class="' + cssClass + '">' + mediaInfoText + '</div>';
|
||||
}
|
||||
|
||||
function getStarIconsHtml(item) {
|
||||
var html = "",
|
||||
rating = item.CommunityRating;
|
||||
return rating && (html += '<div class="starRatingContainer mediaInfoItem">', html += '<i class="md-icon starIcon"></i>', html += rating, html += "</div>"), html
|
||||
|
||||
var html = '';
|
||||
|
||||
var rating = item.CommunityRating;
|
||||
|
||||
if (rating) {
|
||||
html += '<div class="starRatingContainer mediaInfoItem">';
|
||||
|
||||
html += '<i class="md-icon starIcon"></i>';
|
||||
html += rating;
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function dynamicEndTime(elem, item) {
|
||||
var interval = setInterval(function() {
|
||||
if (!document.body.contains(elem)) return void clearInterval(interval);
|
||||
elem.innerHTML = getEndsAt(item)
|
||||
}, 6e4)
|
||||
|
||||
var interval = setInterval(function () {
|
||||
|
||||
if (!document.body.contains(elem)) {
|
||||
|
||||
clearInterval(interval);
|
||||
return;
|
||||
}
|
||||
|
||||
elem.innerHTML = getEndsAt(item);
|
||||
|
||||
}, 60000);
|
||||
}
|
||||
|
||||
function fillPrimaryMediaInfo(elem, item, options) {
|
||||
var html = getPrimaryMediaInfoHtml(item, options);
|
||||
elem.innerHTML = html, afterFill(elem, item, options)
|
||||
|
||||
elem.innerHTML = html;
|
||||
afterFill(elem, item, options);
|
||||
}
|
||||
|
||||
function fillSecondaryMediaInfo(elem, item, options) {
|
||||
var html = getSecondaryMediaInfoHtml(item, options);
|
||||
elem.innerHTML = html, afterFill(elem, item, options)
|
||||
|
||||
elem.innerHTML = html;
|
||||
afterFill(elem, item, options);
|
||||
}
|
||||
|
||||
function afterFill(elem, item, options) {
|
||||
if (!1 !== options.endsAt) {
|
||||
var endsAtElem = elem.querySelector(".endsAt");
|
||||
endsAtElem && dynamicEndTime(endsAtElem, item)
|
||||
|
||||
if (options.endsAt !== false) {
|
||||
var endsAtElem = elem.querySelector('.endsAt');
|
||||
if (endsAtElem) {
|
||||
dynamicEndTime(endsAtElem, item);
|
||||
}
|
||||
}
|
||||
|
||||
var lnkChannel = elem.querySelector('.lnkChannel');
|
||||
if (lnkChannel) {
|
||||
lnkChannel.addEventListener('click', onChannelLinkClick);
|
||||
}
|
||||
var lnkChannel = elem.querySelector(".lnkChannel");
|
||||
lnkChannel && lnkChannel.addEventListener("click", onChannelLinkClick)
|
||||
}
|
||||
|
||||
function onChannelLinkClick(e) {
|
||||
var channelId = this.getAttribute("data-id"),
|
||||
serverId = this.getAttribute("data-serverid");
|
||||
return appRouter.showItem(channelId, serverId), e.preventDefault(), !1
|
||||
|
||||
var channelId = this.getAttribute('data-id');
|
||||
var serverId = this.getAttribute('data-serverid');
|
||||
|
||||
appRouter.showItem(channelId, serverId);
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function getPrimaryMediaInfoHtml(item, options) {
|
||||
return options = options || {}, null == options.interactive && (options.interactive = !1), getMediaInfoHtml(item, options)
|
||||
|
||||
options = options || {};
|
||||
if (options.interactive == null) {
|
||||
options.interactive = false;
|
||||
}
|
||||
|
||||
return getMediaInfoHtml(item, options);
|
||||
}
|
||||
|
||||
function getSecondaryMediaInfoHtml(item, options) {
|
||||
return options = options || {}, null == options.interactive && (options.interactive = !1), "Program" === item.Type ? getProgramInfoHtml(item, options) : ""
|
||||
|
||||
options = options || {};
|
||||
if (options.interactive == null) {
|
||||
options.interactive = false;
|
||||
}
|
||||
if (item.Type === 'Program') {
|
||||
return getProgramInfoHtml(item, options);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function getResolutionText(i) {
|
||||
var width = i.Width,
|
||||
height = i.Height;
|
||||
|
||||
var width = i.Width;
|
||||
var height = i.Height;
|
||||
|
||||
if (width && height) {
|
||||
if (width >= 3800 || height >= 2e3) return "4K";
|
||||
if (width >= 2500 || height >= 1400) return i.IsInterlaced ? "1440i" : "1440P";
|
||||
if (width >= 1800 || height >= 1e3) return i.IsInterlaced ? "1080i" : "1080P";
|
||||
if (width >= 1200 || height >= 700) return i.IsInterlaced ? "720i" : "720P";
|
||||
if (width >= 700 || height >= 400) return i.IsInterlaced ? "480i" : "480P"
|
||||
|
||||
if (width >= 3800 || height >= 2000) {
|
||||
return '4K';
|
||||
}
|
||||
if (width >= 2500 || height >= 1400) {
|
||||
if (i.IsInterlaced) {
|
||||
return '1440i';
|
||||
}
|
||||
return '1440P';
|
||||
}
|
||||
if (width >= 1800 || height >= 1000) {
|
||||
if (i.IsInterlaced) {
|
||||
return '1080i';
|
||||
}
|
||||
return '1080P';
|
||||
}
|
||||
if (width >= 1200 || height >= 700) {
|
||||
if (i.IsInterlaced) {
|
||||
return '720i';
|
||||
}
|
||||
return '720P';
|
||||
}
|
||||
if (width >= 700 || height >= 400) {
|
||||
|
||||
if (i.IsInterlaced) {
|
||||
return '480i';
|
||||
}
|
||||
return '480P';
|
||||
}
|
||||
|
||||
}
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
function getAudioStreamForDisplay(item) {
|
||||
if (!item.MediaSources) return null;
|
||||
|
||||
if (!item.MediaSources) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var mediaSource = item.MediaSources[0];
|
||||
return mediaSource ? (mediaSource.MediaStreams || []).filter(function(i) {
|
||||
return "Audio" === i.Type && (i.Index === mediaSource.DefaultAudioStreamIndex || null == mediaSource.DefaultAudioStreamIndex)
|
||||
})[0] : null
|
||||
if (!mediaSource) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (mediaSource.MediaStreams || []).filter(function (i) {
|
||||
return i.Type === 'Audio' && (i.Index === mediaSource.DefaultAudioStreamIndex || mediaSource.DefaultAudioStreamIndex == null);
|
||||
})[0];
|
||||
}
|
||||
|
||||
function getMediaInfoStats(item, options) {
|
||||
|
||||
options = options || {};
|
||||
var list = [],
|
||||
mediaSource = (item.MediaSources || [])[0] || {},
|
||||
videoStream = (mediaSource.MediaStreams || []).filter(function(i) {
|
||||
return "Video" === i.Type
|
||||
})[0] || {},
|
||||
audioStream = getAudioStreamForDisplay(item) || {};
|
||||
"Dvd" === item.VideoType && list.push({
|
||||
type: "mediainfo",
|
||||
text: "Dvd"
|
||||
}), "BluRay" === item.VideoType && list.push({
|
||||
type: "mediainfo",
|
||||
text: "BluRay"
|
||||
});
|
||||
var resolutionText = getResolutionText(videoStream);
|
||||
resolutionText && list.push({
|
||||
type: "mediainfo",
|
||||
text: resolutionText
|
||||
}), videoStream.Codec && list.push({
|
||||
type: "mediainfo",
|
||||
text: videoStream.Codec
|
||||
});
|
||||
var channelText, channels = audioStream.Channels;
|
||||
8 === channels ? channelText = "7.1" : 7 === channels ? channelText = "6.1" : 6 === channels ? channelText = "5.1" : 2 === channels && (channelText = "2.0"), channelText && list.push({
|
||||
type: "mediainfo",
|
||||
text: channelText
|
||||
});
|
||||
var audioCodec = (audioStream.Codec || "").toLowerCase();
|
||||
if ("dca" !== audioCodec && "dts" !== audioCodec || !audioStream.Profile ? audioStream.Codec && list.push({
|
||||
type: "mediainfo",
|
||||
text: audioStream.Codec
|
||||
}) : list.push({
|
||||
type: "mediainfo",
|
||||
text: audioStream.Profile
|
||||
}), item.DateCreated && itemHelper.enableDateAddedDisplay(item)) {
|
||||
var dateCreated = datetime.parseISO8601Date(item.DateCreated);
|
||||
|
||||
var list = [];
|
||||
|
||||
var mediaSource = (item.MediaSources || [])[0] || {};
|
||||
|
||||
var videoStream = (mediaSource.MediaStreams || []).filter(function (i) {
|
||||
return i.Type === 'Video';
|
||||
})[0] || {};
|
||||
var audioStream = getAudioStreamForDisplay(item) || {};
|
||||
|
||||
if (item.VideoType === 'Dvd') {
|
||||
list.push({
|
||||
type: "added",
|
||||
text: globalize.translate("sharedcomponents#AddedOnValue", datetime.toLocaleDateString(dateCreated) + " " + datetime.getDisplayTime(dateCreated))
|
||||
})
|
||||
type: 'mediainfo',
|
||||
text: 'Dvd'
|
||||
});
|
||||
}
|
||||
return list
|
||||
|
||||
if (item.VideoType === 'BluRay') {
|
||||
list.push({
|
||||
type: 'mediainfo',
|
||||
text: 'BluRay'
|
||||
});
|
||||
}
|
||||
|
||||
//if (mediaSource.Container) {
|
||||
// html += '<div class="mediaInfoIcon mediaInfoText">' + mediaSource.Container + '</div>';
|
||||
//}
|
||||
|
||||
var resolutionText = getResolutionText(videoStream);
|
||||
if (resolutionText) {
|
||||
list.push({
|
||||
type: 'mediainfo',
|
||||
text: resolutionText
|
||||
});
|
||||
}
|
||||
|
||||
if (videoStream.Codec) {
|
||||
list.push({
|
||||
type: 'mediainfo',
|
||||
text: videoStream.Codec
|
||||
});
|
||||
}
|
||||
|
||||
var channels = audioStream.Channels;
|
||||
var channelText;
|
||||
|
||||
if (channels === 8) {
|
||||
|
||||
channelText = '7.1';
|
||||
|
||||
} else if (channels === 7) {
|
||||
|
||||
channelText = '6.1';
|
||||
|
||||
} else if (channels === 6) {
|
||||
|
||||
channelText = '5.1';
|
||||
|
||||
} else if (channels === 2) {
|
||||
|
||||
channelText = '2.0';
|
||||
}
|
||||
|
||||
if (channelText) {
|
||||
list.push({
|
||||
type: 'mediainfo',
|
||||
text: channelText
|
||||
});
|
||||
}
|
||||
|
||||
var audioCodec = (audioStream.Codec || '').toLowerCase();
|
||||
|
||||
if ((audioCodec === 'dca' || audioCodec === 'dts') && audioStream.Profile) {
|
||||
list.push({
|
||||
type: 'mediainfo',
|
||||
text: audioStream.Profile
|
||||
});
|
||||
} else if (audioStream.Codec) {
|
||||
list.push({
|
||||
type: 'mediainfo',
|
||||
text: audioStream.Codec
|
||||
});
|
||||
}
|
||||
|
||||
if (item.DateCreated && itemHelper.enableDateAddedDisplay(item)) {
|
||||
|
||||
var dateCreated = datetime.parseISO8601Date(item.DateCreated);
|
||||
|
||||
list.push({
|
||||
type: 'added',
|
||||
text: globalize.translate('sharedcomponents#AddedOnValue', datetime.toLocaleDateString(dateCreated) + ' ' + datetime.getDisplayTime(dateCreated))
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
return {
|
||||
getMediaInfoHtml: getPrimaryMediaInfoHtml,
|
||||
fill: fillPrimaryMediaInfo,
|
||||
|
@ -254,5 +664,5 @@ define(["datetime", "globalize", "appRouter", "itemHelper", "indicators", "mater
|
|||
fillSecondaryMediaInfo: fillSecondaryMediaInfo,
|
||||
getMediaInfoStats: getMediaInfoStats,
|
||||
getResolutionText: getResolutionText
|
||||
}
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue