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

add more data to media report

This commit is contained in:
Luke Pulverenti 2014-03-02 21:17:12 -05:00
parent c2b9b4e6d8
commit a2a9e6f2a3
3 changed files with 127 additions and 93 deletions

View file

@ -18,6 +18,23 @@
<div style="text-align: center;"> <div style="text-align: center;">
<div class="viewControls"> <div class="viewControls">
<div style="display: inline-block;">
<select data-mini="true" data-inline="true" id="selectView" name="selectView">
<option value="AdultVideo">Adult Videos</option>
<option value="MusicAlbum">Albums</option>
<option value="MusicArtist">Artists</option>
<option value="Book">Books</option>
<option value="BoxSet">Collections</option>
<option value="Episode">Episodes</option>
<option value="Game">Games</option>
<option value="Video">Home Videos</option>
<option value="Movie">Movies</option>
<option value="MusicVideo">Music Videos</option>
<option value="Trailer">Trailers</option>
<option value="Series">Series</option>
<option value="Audio">Songs</option>
</select>
</div>
<button data-mini="true" data-icon="filter" data-inline="true" onclick="$('#filterPanel', $(this).parents('.page')).panel( 'toggle' );">Filter</button> <button data-mini="true" data-icon="filter" data-inline="true" onclick="$('#filterPanel', $(this).parents('.page')).panel( 'toggle' );">Filter</button>
</div> </div>
<div class="listTopPaging"> <div class="listTopPaging">
@ -28,12 +45,14 @@
<thead> <thead>
<tr> <tr>
<th data-priority="1"></th> <th data-priority="1"></th>
<th data-priority="1">Parent</th> <th data-priority="1" class="thParent">Parent</th>
<th data-priority="1">Name</th> <th data-priority="1">Name</th>
<th data-priority="1">Type</th> <th data-priority="1">Date Added</th>
<th data-priority="1">Date/Year</th> <th data-priority="1">Release Date</th>
<th data-priority="1">Rating</th> <th data-priority="1">Rating</th>
<th data-priority="1">Runtime</th> <th data-priority="1">Runtime</th>
<th data-priority="1">Codecs</th>
<th data-priority="1" class="thSubtitles">Subtitles</th>
<th data-priority="1">Features</th> <th data-priority="1">Features</th>
</tr> </tr>
</thead> </thead>
@ -57,43 +76,6 @@
<label for="radioAdvancedFilters">Advanced</label> <label for="radioAdvancedFilters">Advanced</label>
</fieldset> </fieldset>
<div class="basicFilters"> <div class="basicFilters">
<fieldset data-role="controlgroup">
<legend>
<strong>Type:</strong>
</legend>
<input class="chkTypeFilter" type="checkbox" id="chkMovie" data-filter="Movie" data-mini="true">
<label for="chkMovie">Movie</label>
<input class="chkTypeFilter" type="checkbox" id="chkTrailerType" data-filter="Trailer" data-mini="true">
<label for="chkTrailerType">Trailer</label>
<input class="chkTypeFilter" type="checkbox" id="chkCollection" data-filter="BoxSet" data-mini="true">
<label for="chkCollection">Collection</label>
<input class="chkTypeFilter" type="checkbox" id="chkSeries" data-filter="Series" data-mini="true">
<label for="chkSeries">Series</label>
<input class="chkTypeFilter" type="checkbox" id="chkSeason" data-filter="Season" data-mini="true">
<label for="chkSeason">Season</label>
<input class="chkTypeFilter" type="checkbox" id="chkEpisode" data-filter="Episode" data-mini="true">
<label for="chkEpisode">Episode</label>
<input class="chkTypeFilter" type="checkbox" id="chkArtist" data-filter="MusicArtist" data-mini="true">
<label for="chkArtist">Artist</label>
<input class="chkTypeFilter" type="checkbox" id="chkAlbum" data-filter="MusicAlbum" data-mini="true">
<label for="chkAlbum">Album</label>
<input class="chkTypeFilter" type="checkbox" id="chkSong" data-filter="Audio" data-mini="true">
<label for="chkSong">Song</label>
<input class="chkTypeFilter" type="checkbox" id="chkBook" data-filter="Book" data-mini="true">
<label for="chkBook">Book</label>
<input class="chkTypeFilter" type="checkbox" id="chkGame" data-filter="Game" data-mini="true">
<label for="chkGame">Game</label>
</fieldset>
<fieldset data-role="controlgroup"> <fieldset data-role="controlgroup">
<legend> <legend>
<strong>Video Type:</strong> <strong>Video Type:</strong>

View file

@ -67,7 +67,7 @@
return { attr: { id: item.Id, rel: rel, itemtype: item.Type }, data: htmlName, state: state }; return { attr: { id: item.Id, rel: rel, itemtype: item.Type }, data: htmlName, state: state };
} }
function loadChildrenOfRootNode(callback, openItems) { function loadChildrenOfRootNode(page, callback, openItems, selectedId) {
var promise1 = $.getJSON(ApiClient.getUrl("Library/MediaFolders")); var promise1 = $.getJSON(ApiClient.getUrl("Library/MediaFolders"));
@ -110,6 +110,14 @@
callback(nodes); callback(nodes);
if (selectedId && nodes.filter(function (f) {
return f.attr.id == selectedId;
}).length) {
selectNode(page, selectedId);
}
}); });
} }
@ -135,7 +143,7 @@
if (node == '-1') { if (node == '-1') {
loadChildrenOfRootNode(callback, openItems); loadChildrenOfRootNode(page, callback, openItems, selectedId);
return; return;
} }

View file

@ -6,28 +6,24 @@
SortBy: "SeriesSortName,SortName", SortBy: "SeriesSortName,SortName",
SortOrder: "Ascending", SortOrder: "Ascending",
Recursive: true, Recursive: true,
Fields: "", Fields: "MediaStreams,DateCreated",
StartIndex: 0 StartIndex: 0,
IncludeItemTypes: "Movie"
}; };
function getFriendlyTypeName(type) { function getCodecName(stream) {
if (type == "MusicArtist") { var val = stream.Codec || '';
return "Artist"; val = val.toUpperCase();
}
if (type == "MusicAlbum") { if (val == 'DCA') {
return "Album"; return stream.Profile;
}
if (type == "Audio") {
return "Song";
}
if (type == "BoxSet") {
return "Collection";
}
return type;
} }
function getTableRowsHtml(items) { return val;
}
function getTableRowsHtml(items, includeParentInfo, includeSubtitles) {
var html = ''; var html = '';
@ -44,6 +40,7 @@
} }
html += '</td>'; html += '</td>';
if (includeParentInfo) {
html += '<td>'; html += '<td>';
if (item.SeriesName) { if (item.SeriesName) {
html += '<a href="itemdetails.html?id=' + item.SeriesId + '">' + item.SeriesName + '</a>'; html += '<a href="itemdetails.html?id=' + item.SeriesId + '">' + item.SeriesName + '</a>';
@ -58,13 +55,21 @@
html += '&nbsp;'; html += '&nbsp;';
} }
html += '</td>'; html += '</td>';
}
html += '<td>'; html += '<td>';
html += '<a href="' + LibraryBrowser.getHref(item) + '">' + LibraryBrowser.getPosterViewDisplayName(item, false, true) + '</a>'; html += '<a href="' + LibraryBrowser.getHref(item) + '">' + LibraryBrowser.getPosterViewDisplayName(item, false, true) + '</a>';
html += '</td>'; html += '</td>';
html += '<td>'; html += '<td>';
html += getFriendlyTypeName(item.Type); if (item.DateCreated) {
try {
html += parseISO8601Date(item.DateCreated, { toLocal: true }).toLocaleDateString();
}
catch (e) {
html += '&nbsp;';
}
}
html += '</td>'; html += '</td>';
html += '<td>'; html += '<td>';
@ -118,6 +123,32 @@
} }
html += '</td>'; html += '</td>';
html += '<td>';
html += (item.MediaStreams || []).filter(function(s) {
return s.Type != 'Subtitle';
}).map(getCodecName).filter(function (s) {
return s;
}).join('<br/>');
html += '</td>';
if (includeSubtitles) {
html += '<td>';
html += (item.MediaStreams || []).filter(function (s) {
return s.Type == 'Subtitle';
}).map(function (s) {
return (s.Language || 'Und') + ' - ' + s.Codec;
}).join('<br/>');
html += '</td>';
}
html += '<td>'; html += '<td>';
if (item.SpecialFeatureCount == 1) { if (item.SpecialFeatureCount == 1) {
@ -154,7 +185,36 @@
$('.listBottomPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount)).trigger('create'); $('.listBottomPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount)).trigger('create');
$('.resultBody', page).html(getTableRowsHtml(result.Items)).parents('.tblLibraryReport').table("refresh").trigger('create'); var includeParentInfo = query.IncludeItemTypes == "Audio" || query.IncludeItemTypes == "MusicAlbum" || query.IncludeItemTypes == "Episode" || query.IncludeItemTypes == "Book";
var includeSubtitles = query.IncludeItemTypes == "Movie" || query.IncludeItemTypes == "Trailer" || query.IncludeItemTypes == "Episode" || query.IncludeItemTypes == "AdultVideo" || query.IncludeItemTypes == "MusicVideo" || query.IncludeItemTypes == "Video";
if (includeParentInfo) {
var parentLabel = "Series";
if (query.IncludeItemTypes == "Audio") {
parentLabel = "Album";
}
else if (query.IncludeItemTypes == "MusicAlbum") {
parentLabel = "Artist";
}
$('.thParent', page).html(parentLabel).show();
} else {
$('.thParent', page).hide();
}
if (includeSubtitles) {
$('.thSubtitles', page).show();
} else {
$('.thSubtitles', page).hide();
}
var rowsHtml = getTableRowsHtml(result.Items, includeParentInfo, includeSubtitles);
$('.resultBody', page).html(rowsHtml).parents('.tblLibraryReport').table("refresh").trigger('create');
$('.btnNextPage', page).on('click', function () { $('.btnNextPage', page).on('click', function () {
query.StartIndex += query.Limit; query.StartIndex += query.Limit;
@ -186,14 +246,7 @@
function updateFilterControls(page) { function updateFilterControls(page) {
$('.chkTypeFilter', page).each(function () { $('#selectView').val(query.IncludeItemTypes).selectmenu('refresh');
var filters = "," + (query.IncludeItemTypes || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
}).checkboxradio('refresh');
$('.chkVideoTypeFilter', page).each(function () { $('.chkVideoTypeFilter', page).each(function () {
@ -255,19 +308,10 @@
} }
}); });
$('.chkTypeFilter', page).on('change', function () { $('#selectView', page).on('change', function () {
var filterName = this.getAttribute('data-filter');
var filters = query.IncludeItemTypes || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName;
}
query.StartIndex = 0; query.StartIndex = 0;
query.IncludeItemTypes = filters; query.IncludeItemTypes = this.value;
reloadItems(page); reloadItems(page);
}); });