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

fixes #296 - Prevent non-movie videos from appearing in Movies view

This commit is contained in:
Luke Pulverenti 2013-05-27 21:59:26 -04:00
parent a3e75d5502
commit 8a7dffff51
16 changed files with 494 additions and 25 deletions

View file

@ -70,7 +70,7 @@
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "BoxSet") {
return "movies";
}
if (item.Type == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "Artist") {
if (item.Type == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist" || item.Type == "Artist" || item.Type == "MusicVideo") {
return "music";
}
if (item.MediaType == "Game") {
@ -87,6 +87,10 @@
$('#albumTabs', page).show();
}
if (item.Type == "MusicVideo") {
$('#musicVideoTabs', page).show();
}
if (item.Type == "Audio") {
$('#songTabs', page).show();
}
@ -435,7 +439,7 @@
function renderCriticReviews(page, item, limit) {
if (item.Type != "Movie" && item.Type != "Trailer") {
if (item.Type != "Movie" && item.Type != "Trailer" && item.Type != "MusicVideo") {
$('#criticReviewsCollapsible', page).hide();
return;
}

View file

@ -40,7 +40,7 @@
$('#fldEndDate', page).hide();
}
if (item.Type == "Movie" || item.MediaType == "Game" || item.MediaType == "Trailer") {
if (item.Type == "Movie" || item.MediaType == "Game" || item.MediaType == "Trailer" || item.Type == "MusicVideo") {
$('#fldBudget', page).show();
$('#fldRevenue', page).show();
} else {
@ -56,7 +56,7 @@
$('#fldGamesDb', page).hide();
}
if (item.Type == "Movie" || item.Type == "Trailer") {
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "MusicVideo") {
$('#fldCriticRating', page).show();
$('#fldCriticRatingSummary', page).show();
$('#fldRottenTomatoes', page).show();
@ -90,7 +90,7 @@
$('#fldAlbumArtist', page).hide();
}
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "Person" || item.Type == "Series" || item.Type == "Season" || item.Type == "Episode") {
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "Person" || item.Type == "Series" || item.Type == "Season" || item.Type == "Episode" || item.Type == "MusicVideo") {
$('#fldImdb', page).show();
} else {
$('#fldImdb', page).hide();

View file

@ -64,7 +64,7 @@
var vals = [item.Type, item.Id, item.Name];
var context = getParameterByName('context');
if (context) {
vals.push(vals);
}
@ -188,6 +188,12 @@
html += '<label for="radioSongs">Songs (' + result.SongCount + ')</label>';
}
if (result.MusicVideoCount) {
html += '<input type="radio" name="ibnMusicVideos" id="radioMusicVideos" value="on" data-mini="true">';
html += '<label for="radioMusicVideos">Music Videos (' + result.MusicVideoCount + ')</label>';
}
html += '</fieldset>';
var elem = $('#itemTabs', page).html(html).trigger('create');
@ -207,6 +213,18 @@
function bindRadioEvents(page) {
$("#radioMusicVideos", page).on("click", function () {
shape = "poster";
loadItems(page, {
MediaTypes: "",
IncludeItemTypes: "MusicVideo",
PersonTypes: "",
Artists: ""
});
});
$("#radioMovies", page).on("click", function () {
shape = "poster";
@ -398,15 +416,15 @@
}
if (query.IncludeItemTypes == "Audio") {
html += LibraryBrowser.getSongTableHtml(result.Items, {
showAlbum: true,
showArtist: true
});
} else {
html += LibraryBrowser.getPosterDetailViewHtml({
items: result.Items,
preferBackdrop: shape == "backdrop",

View file

@ -565,9 +565,9 @@
return html;
},
getPosterViewDisplayName: function(item) {
getPosterViewDisplayName: function (item) {
var name = item.Name;
if (item.Type == "Episode" && item.IndexNumber != null && item.ParentIndexNumber != null) {
@ -677,7 +677,7 @@
renderName: function (item, nameElem, linkToElement) {
var name = LibraryBrowser.getPosterViewDisplayName(item);
Dashboard.setPageTitle(name);
if (linkToElement) {
@ -740,13 +740,15 @@
var providerIds = item.ProviderIds || {};
if (providerIds.Imdb) {
if (item.Type == "Movie" || item.Type == "Episode" || item.Type == "Trailer")
links.push('<a class="textlink" href="http://www.imdb.com/title/' + providerIds.Imdb + '" target="_blank">IMDb</a>');
else if (item.Type == "Person")
if (item.Type == "Person") {
links.push('<a class="textlink" href="http://www.imdb.com/name/' + providerIds.Imdb + '" target="_blank">IMDb</a>');
}
else {
links.push('<a class="textlink" href="http://www.imdb.com/title/' + providerIds.Imdb + '" target="_blank">IMDb</a>');
}
}
if (providerIds.Tmdb) {
if (item.Type == "Movie" || item.Type == "Trailer")
if (item.Type == "Movie" || item.Type == "Trailer" || item.Type == "MusicVideo")
links.push('<a class="textlink" href="http://www.themoviedb.org/movie/' + providerIds.Tmdb + '" target="_blank">TheMovieDB</a>');
else if (item.Type == "BoxSet")
links.push('<a class="textlink" href="http://www.themoviedb.org/collection/' + providerIds.Tmdb + '" target="_blank">TheMovieDB</a>');
@ -879,7 +881,7 @@
}
}
if ((item.Type == "Movie" || item.Type == "Trailer") && item.CriticRating != null) {
if (item.CriticRating != null) {
if (item.CriticRating >= 60) {
html += '<div class="fresh rottentomatoesicon" title="fresh"></div>';

View file

@ -298,7 +298,7 @@
percent *= 100;
positionSlider.val(percent);
positionSlider.removeAttr('disabled');
}
} else {
@ -533,7 +533,7 @@
$('#qualityButton', nowPlayingBar).show();
if (item.MediaStreams.filter(function(i) {
if (item.MediaStreams.filter(function (i) {
return i.Type == "Audio";
}).length) {
$('#audioTracksButton', nowPlayingBar).show();
@ -851,10 +851,12 @@
}
html += "<div><a href='itemdetails.html?id=" + item.Id + "'><img class='nowPlayingBarImage ' alt='' title='' src='" + url + "' style='height:36px;display:inline-block;' /></a></div>";
if (item.Type == "Movie")
html += '<div class="nowPlayingText">' + name + '<br/>' + seriesName + '</div>';
else
if (item.SeriesName || item.Album) {
html += '<div class="nowPlayingText">' + seriesName + '<br/>' + name + '</div>';
} else {
html += '<div class="nowPlayingText">' + name + '<br/>' + seriesName + '</div>';
}
$('.nowPlayingMediaInfo', nowPlayingBar).html(html);
};
@ -1254,7 +1256,7 @@
var option = options[i];
var cssClass = "mediaFlyoutOption";
if (option.videoBitrate == currentVideoBitrate) {
cssClass += " selectedMediaFlyoutOption";
}

View file

@ -0,0 +1,264 @@
(function ($, document) {
var view = "Poster";
// The base query options
var query = {
SortBy: "SortName",
SortOrder: "Ascending",
IncludeItemTypes: "MusicVideo",
Recursive: true,
Fields: "UserData,DisplayMediaType,ItemCounts,DateCreated",
StartIndex: 0
};
function reloadItems(page) {
Dashboard.showLoadingMsg();
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
// Scroll back up so they can see the results from the beginning
$(document).scrollTop(0);
var html = '';
$('.listTopPaging', page).html(LibraryBrowser.getPagingHtml(query, result.TotalRecordCount, true)).trigger('create');
if (view == "Backdrop") {
html += LibraryBrowser.getPosterDetailViewHtml({
items: result.Items,
preferBackdrop: true,
context: "music",
shape: "backdrop"
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "Poster") {
html += LibraryBrowser.getPosterDetailViewHtml({
items: result.Items,
context: "music",
shape: "poster"
});
$('.itemsContainer', page).removeClass('timelineItemsContainer');
}
else if (view == "Timeline") {
html += LibraryBrowser.getPosterDetailViewHtml({
items: result.Items,
context: "music",
shape: "poster",
timeline: true
});
$('.itemsContainer', page).addClass('timelineItemsContainer');
}
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
$('#items', page).html(html).trigger('create');
$('.selectPage', page).on('change', function () {
query.StartIndex = (parseInt(this.value) - 1) * query.Limit;
reloadItems(page);
});
$('.btnNextPage', page).on('click', function () {
query.StartIndex += query.Limit;
reloadItems(page);
});
$('.btnPreviousPage', page).on('click', function () {
query.StartIndex -= query.Limit;
reloadItems(page);
});
$('.selectPageSize', page).on('change', function () {
query.Limit = parseInt(this.value);
query.StartIndex = 0;
reloadItems(page);
});
Dashboard.hideLoadingMsg();
});
}
$(document).on('pageinit', "#musicVideosPage", function () {
var page = this;
$('.radioSortBy', this).on('click', function () {
query.StartIndex = 0;
query.SortBy = this.getAttribute('data-sortby');
reloadItems(page);
});
$('.radioSortOrder', this).on('click', function () {
query.StartIndex = 0;
query.SortOrder = this.getAttribute('data-sortorder');
reloadItems(page);
});
$('.chkStandardFilter', this).on('change', function () {
var filterName = this.getAttribute('data-filter');
var filters = query.Filters || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName;
}
query.StartIndex = 0;
query.Filters = filters;
reloadItems(page);
});
$('.chkVideoTypeFilter', this).on('change', function () {
var filterName = this.getAttribute('data-filter');
var filters = query.VideoTypes || "";
filters = (',' + filters).replace(',' + filterName, '').substring(1);
if (this.checked) {
filters = filters ? (filters + ',' + filterName) : filterName;
}
query.StartIndex = 0;
query.VideoTypes = filters;
reloadItems(page);
});
$('#selectView', this).on('change', function () {
view = this.value;
if (view == "Timeline") {
query.SortBy = "PremiereDate";
query.StartIndex = 0;
$('#radioPremiereDate', page)[0].click();
} else {
reloadItems(page);
}
});
$('#chk3D', this).on('change', function () {
query.StartIndex = 0;
query.VideoFormats = this.checked ? this.getAttribute('data-filter') : null;
reloadItems(page);
});
$('#chkSubtitle', this).on('change', function () {
query.StartIndex = 0;
query.HasSubtitles = this.checked ? true : null;
reloadItems(page);
});
$('#chkTrailer', this).on('change', function () {
query.StartIndex = 0;
query.HasTrailer = this.checked ? true : null;
reloadItems(page);
});
$('#chkThemeSong', this).on('change', function () {
query.StartIndex = 0;
query.HasThemeSong = this.checked ? true : null;
reloadItems(page);
});
$('#chkThemeVideo', this).on('change', function () {
query.StartIndex = 0;
query.HasThemeVideo = this.checked ? true : null;
reloadItems(page);
});
$('.alphabetPicker', this).on('alphaselect', function (e, character) {
query.NameStartsWithOrGreater = character;
query.StartIndex = 0;
reloadItems(page);
}).on('alphaclear', function (e) {
query.NameStartsWithOrGreater = '';
reloadItems(page);
});
}).on('pagebeforeshow', "#musicVideosPage", function () {
var limit = LibraryBrowser.getDefaultPageSize();
// If the default page size has changed, the start index will have to be reset
if (limit != query.Limit) {
query.Limit = limit;
query.StartIndex = 0;
}
reloadItems(this);
}).on('pageshow', "#musicVideosPage", function () {
// Reset form values using the last used query
$('.radioSortBy', this).each(function () {
this.checked = query.SortBy == this.getAttribute('data-sortby');
}).checkboxradio('refresh');
$('.radioSortOrder', this).each(function () {
this.checked = query.SortOrder == this.getAttribute('data-sortorder');
}).checkboxradio('refresh');
$('.chkStandardFilter', this).each(function () {
var filters = "," + (query.Filters || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
}).checkboxradio('refresh');
$('.chkVideoTypeFilter', this).each(function () {
var filters = "," + (query.VideoTypes || "");
var filterName = this.getAttribute('data-filter');
this.checked = filters.indexOf(',' + filterName) != -1;
}).checkboxradio('refresh');
$('#selectView', this).val(view).selectmenu('refresh');
$('#chk3D', this).checked(query.VideoFormats == "Digital3D,Sbs3D").checkboxradio('refresh');
$('#chkSubtitle', this).checked(query.HasSubtitles == true).checkboxradio('refresh');
$('#chkTrailer', this).checked(query.HasTrailer == true).checkboxradio('refresh');
$('#chkThemeSong', this).checked(query.HasThemeSong == true).checkboxradio('refresh');
$('#chkThemeVideo', this).checked(query.HasThemeVideo == true).checkboxradio('refresh');
$('.alphabetPicker', this).alphaValue(query.NameStartsWithOrGreater);
});
})(jQuery, document);

View file

@ -160,6 +160,11 @@
html += '<div class="searchHintSecondaryText">Movie</div>';
}
else if (hint.Type == "MusicVideo") {
html += '<div class="searchHintSecondaryText">Music Video</div>';
}
else if (hint.Type == "Episode") {