1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

rework media versions to be based on original item id

This commit is contained in:
Luke Pulverenti 2014-03-21 23:35:03 -04:00
parent fd0c1ec8ae
commit 7a9d65a367
10 changed files with 95 additions and 104 deletions

View file

@ -207,19 +207,29 @@
function getItemCellsHtml(item, headercells) {
var primaryVersion = (item.MediaVersions || []).filter(function (v) {
return v.IsPrimaryVersion;
})[0] || {};
var mediaStreams = primaryVersion.MediaStreams || [];
var videoStream = mediaStreams.filter(function (s) {
return s.Type == 'Video';
})[0];
var audioStream = mediaStreams.filter(function (s) {
return s.Type == 'Audio';
})[0];
return headercells.map(function (cell) {
var html = '';
html += '<td>';
var stream;
var primaryVersion = (item.MediaVersions || []).filter(function(v) {
return v.IsPrimaryVersion;
})[0] || {};
var mediaStreams = primaryVersion.MediaStreams || [];
switch (cell.type || cell.name) {
case 'Album Artist':
@ -264,52 +274,30 @@
}
case 'Audio':
{
stream = mediaStreams.filter(function (s) {
if (audioStream) {
return s.Type == 'Audio';
})[0];
if (stream) {
var name = (stream.Codec || '').toUpperCase();
html += name == 'DCA' ? (stream.Profile || '').toUpperCase() : name;
var name = (audioStream.Codec || '').toUpperCase();
html += name == 'DCA' ? (audioStream.Profile || '').toUpperCase() : name;
}
break;
}
case 'Video':
{
stream = mediaStreams.filter(function (s) {
return s.Type == 'Video';
})[0];
if (stream) {
html += (stream.Codec || '').toUpperCase();
if (videoStream) {
html += (videoStream.Codec || '').toUpperCase();
}
break;
}
case 'Resolution':
{
stream = mediaStreams.filter(function (s) {
return s.Type == 'Video';
})[0];
if (stream && stream.Width) {
html += stream.Width + "*" + (stream.Height || "-");
if (videoStream && videoStream.Width) {
html += videoStream.Width + "*" + (videoStream.Height || "-");
}
break;
}
case 'Embedded Image':
{
if (mediaStreams.filter(function (s) {
return s.Type == 'Video';
}).length) {
if (videoStream) {
html += '<div class="libraryReportIndicator clearLibraryReportIndicator"><div class="ui-icon-check ui-btn-icon-notext"></div></div>';
}
break;