1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/bower_components/emby-webcomponents/playback/nowplayinghelper.js

40 lines
1.9 KiB
JavaScript
Raw Normal View History

2018-10-23 01:05:09 +03:00
define([], function() {
"use strict";
function getNowPlayingNames(nowPlayingItem, includeNonNameInfo) {
var topItem = nowPlayingItem,
bottomItem = null,
topText = nowPlayingItem.Name;
nowPlayingItem.AlbumId && "Audio" === nowPlayingItem.MediaType && (topItem = {
Id: nowPlayingItem.AlbumId,
Name: nowPlayingItem.Album,
Type: "MusicAlbum",
IsFolder: !0
}), "Video" === nowPlayingItem.MediaType && (null != nowPlayingItem.IndexNumber && (topText = nowPlayingItem.IndexNumber + " - " + topText), null != nowPlayingItem.ParentIndexNumber && (topText = nowPlayingItem.ParentIndexNumber + "." + topText));
var bottomText = "";
nowPlayingItem.ArtistItems && nowPlayingItem.ArtistItems.length ? (bottomItem = {
Id: nowPlayingItem.ArtistItems[0].Id,
Name: nowPlayingItem.ArtistItems[0].Name,
Type: "MusicArtist",
IsFolder: !0
}, bottomText = nowPlayingItem.ArtistItems.map(function(a) {
return a.Name
}).join(", ")) : nowPlayingItem.Artists && nowPlayingItem.Artists.length ? bottomText = nowPlayingItem.Artists.join(", ") : nowPlayingItem.SeriesName || nowPlayingItem.Album ? (bottomText = topText, topText = nowPlayingItem.SeriesName || nowPlayingItem.Album, bottomItem = topItem, topItem = nowPlayingItem.SeriesId ? {
Id: nowPlayingItem.SeriesId,
Name: nowPlayingItem.SeriesName,
Type: "Series",
IsFolder: !0
} : null) : nowPlayingItem.ProductionYear && !1 !== includeNonNameInfo && (bottomText = nowPlayingItem.ProductionYear);
var list = [];
return list.push({
text: topText,
item: topItem
}), bottomText && list.push({
text: bottomText,
item: bottomItem
}), list
}
return {
getNowPlayingNames: getNowPlayingNames
}
});