mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Added a bunch of categories for tv search similar to what we have for movies.
This commit is contained in:
parent
7cbea541ce
commit
9886c40499
14 changed files with 641 additions and 249 deletions
|
@ -72,6 +72,25 @@ $(function () {
|
|||
moviesInTheaters();
|
||||
});
|
||||
|
||||
// TV DropDown
|
||||
$('#popularShows').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
popularShows();
|
||||
});
|
||||
|
||||
$('#trendingShows').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
trendingTv();
|
||||
});
|
||||
$('#mostWatchedShows').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
mostwatchedTv();
|
||||
});
|
||||
$('#anticipatedShows').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
anticipatedTv();
|
||||
});
|
||||
|
||||
// Type in TV search
|
||||
$("#tvSearchContent").on("input", function () {
|
||||
if (searchTimer) {
|
||||
|
@ -293,6 +312,23 @@ $(function () {
|
|||
getMovies(url);
|
||||
}
|
||||
|
||||
function popularShows() {
|
||||
var url = createBaseUrl(base, '/search/tv/popular');
|
||||
getTvShows(url, true);
|
||||
}
|
||||
function anticipatedTv() {
|
||||
var url = createBaseUrl(base, '/search/tv/anticipated');
|
||||
getTvShows(url, true);
|
||||
}
|
||||
function trendingTv() {
|
||||
var url = createBaseUrl(base, '/search/tv/trending');
|
||||
getTvShows(url, true);
|
||||
}
|
||||
function mostwatchedTv() {
|
||||
var url = createBaseUrl(base, '/search/tv/mostwatched');
|
||||
getTvShows(url, true);
|
||||
}
|
||||
|
||||
function getMovies(url) {
|
||||
resetMovies();
|
||||
|
||||
|
@ -323,10 +359,10 @@ $(function () {
|
|||
var query = $("#tvSearchContent").val();
|
||||
|
||||
var url = createBaseUrl(base, '/search/tv/');
|
||||
query ? getTvShows(url + query) : resetTvShows();
|
||||
query ? getTvShows(url + query, false) : resetTvShows();
|
||||
}
|
||||
|
||||
function getTvShows(url) {
|
||||
function getTvShows(url, loadImage) {
|
||||
resetTvShows();
|
||||
|
||||
$('#tvSearchButton').attr("class", "fa fa-spinner fa-spin");
|
||||
|
@ -338,7 +374,9 @@ $(function () {
|
|||
$("#tvList").append(html);
|
||||
|
||||
checkNetflix(context.title, context.id);
|
||||
|
||||
if (loadImage) {
|
||||
getTvPoster(result.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
@ -406,6 +444,16 @@ $(function () {
|
|||
});
|
||||
};
|
||||
|
||||
function getTvPoster(theTvDbId) {
|
||||
|
||||
var url = createBaseUrl(base, '/search/tv/poster/');
|
||||
$.ajax(url + theTvDbId).success(function (result) {
|
||||
if (result) {
|
||||
$('#' + theTvDbId + "imgDiv").html(" <img class='img-responsive' src='" + result + "' width='150' alt='poster'>");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function buildMovieContext(result) {
|
||||
var date = new Date(result.releaseDate);
|
||||
var year = date.getFullYear();
|
||||
|
@ -432,6 +480,7 @@ $(function () {
|
|||
var date = new Date(result.firstAired);
|
||||
var year = date.getFullYear();
|
||||
var context = {
|
||||
status : result.status,
|
||||
posterPath: result.banner,
|
||||
id: result.id,
|
||||
title: result.seriesName,
|
||||
|
@ -448,7 +497,9 @@ $(function () {
|
|||
tvPartialAvailable: result.tvPartialAvailable,
|
||||
disableTvRequestsByEpisode: result.disableTvRequestsByEpisode,
|
||||
disableTvRequestsBySeason: result.disableTvRequestsBySeason,
|
||||
enableTvRequestsForOnlySeries: result.enableTvRequestsForOnlySeries
|
||||
enableTvRequestsForOnlySeries: result.enableTvRequestsForOnlySeries,
|
||||
trailer: result.trailer,
|
||||
homepage: result.homepage
|
||||
};
|
||||
|
||||
return context;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue