You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/RequestPlex.Api/TheMovieDbApi.cs

59 lines
1.7 KiB

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TMDbLib.Client;
9 years ago
using TMDbLib.Objects.General;
using TMDbLib.Objects.Movies;
using TMDbLib.Objects.Search;
using TMDbLib.Objects.TvShows;
namespace RequestPlex.Api
{
public class TheMovieDbApi : MovieBase
{
9 years ago
public TheMovieDbApi()
{
Client = new TMDbClient(ApiKey);
}
9 years ago
public TMDbClient Client { get; set; }
public async Task<List<SearchMovie>> SearchMovie(string searchTerm)
{
9 years ago
var results = await Client.SearchMovie(searchTerm);
return results.Results;
}
[Obsolete("Should use TheTvDbApi for TV")]
public async Task<List<SearchTv>> SearchTv(string searchTerm)
{
9 years ago
var results = await Client.SearchTvShow(searchTerm);
return results.Results;
}
9 years ago
public async Task<List<MovieResult>> GetCurrentPlayingMovies()
{
var movies = await Client.GetMovieList(MovieListType.NowPlaying);
return movies.Results;
}
public async Task<List<MovieResult>> GetUpcomingMovies()
{
var movies = await Client.GetMovieList(MovieListType.Upcoming);
return movies.Results;
}
public async Task<Movie> GetMovieInformation(int tmdbId)
{
var movies = await Client.GetMovie(tmdbId);
return movies;
}
[Obsolete("Should use TheTvDbApi for TV")]
public async Task<TvShow> GetTvShowInformation(int tmdbId)
{
var show = await Client.GetTvShow(tmdbId);
return show;
}
}
}