mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 11:38:32 -07:00
Added more API's for getting Keyword Results and Movie Collections
This commit is contained in:
parent
09144aa080
commit
dc570d2e2c
10 changed files with 171 additions and 42 deletions
|
@ -8,6 +8,7 @@ namespace Ombi.Core.Models.Search.V2
|
|||
public class MovieFullInfoViewModel : SearchViewModel
|
||||
{
|
||||
public bool Adult { get; set; }
|
||||
public CollectionsViewModel BelongsToCollection { get; set; }
|
||||
public string BackdropPath { get; set; }
|
||||
public string OriginalLanguage { get; set; }
|
||||
public int Budget { get; set; }
|
||||
|
@ -41,6 +42,13 @@ namespace Ombi.Core.Models.Search.V2
|
|||
public ExternalIds ExternalIds { get; set; }
|
||||
}
|
||||
|
||||
public class CollectionsViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string PosterPath { get; set; }
|
||||
public string BackdropPath { get; set; }
|
||||
}
|
||||
public class ExternalIds
|
||||
{
|
||||
public string ImdbId { get; set; }
|
||||
|
|
|
@ -86,6 +86,7 @@ namespace Ombi.Mapping.Profiles
|
|||
CreateMap<Ombi.Api.TheMovieDb.Models.FullMovieCast, Ombi.Core.Models.Search.V2.FullMovieCastViewModel>().ReverseMap();
|
||||
CreateMap<Ombi.Api.TheMovieDb.Models.FullMovieCrew, Ombi.Core.Models.Search.V2.FullMovieCrewViewModel>().ReverseMap();
|
||||
CreateMap<Ombi.Api.TheMovieDb.Models.ExternalIds, Ombi.Core.Models.Search.V2.ExternalIds>().ReverseMap();
|
||||
CreateMap<BelongsToCollection, Ombi.Core.Models.Search.V2.CollectionsViewModel>().ReverseMap();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,5 +23,7 @@ namespace Ombi.Api.TheMovieDb
|
|||
Task<ActorCredits> GetActorMovieCredits(int actorId, string langCode);
|
||||
Task<TheMovieDbContainer<MultiSearch>> MultiSearch(string searchTerm, string languageCode);
|
||||
Task<FullMovieInfo> GetFullMovieInfo(int movieId, string langCode);
|
||||
Task<TheMovieDbContainer<DiscoverMovies>> DiscoverMovies(string langCode, int keywordId);
|
||||
Task<Collections> GetCollection(string langCode, int collectionId);
|
||||
}
|
||||
}
|
|
@ -1,10 +1,16 @@
|
|||
namespace Ombi.TheMovieDbApi.Models
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Ombi.TheMovieDbApi.Models
|
||||
{
|
||||
public class BelongsToCollection
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public string backdrop_path { get; set; }
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
[JsonProperty("poster_path")]
|
||||
public string PosterPath { get; set; }
|
||||
[JsonProperty("backdrop_path")]
|
||||
public string BackdropPath { get; set; }
|
||||
}
|
||||
}
|
31
src/Ombi.TheMovieDbApi/Models/Collections.cs
Normal file
31
src/Ombi.TheMovieDbApi/Models/Collections.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
namespace Ombi.Api.TheMovieDb.Models
|
||||
{
|
||||
public class Collections
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string overview { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public string backdrop_path { get; set; }
|
||||
public Part[] parts { get; set; }
|
||||
}
|
||||
|
||||
public class Part
|
||||
{
|
||||
public bool adult { get; set; }
|
||||
public string backdrop_path { get; set; }
|
||||
public int[] genre_ids { get; set; }
|
||||
public int id { get; set; }
|
||||
public string original_language { get; set; }
|
||||
public string original_title { get; set; }
|
||||
public string overview { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public string release_date { get; set; }
|
||||
public string title { get; set; }
|
||||
public bool video { get; set; }
|
||||
public float vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
public float popularity { get; set; }
|
||||
}
|
||||
|
||||
}
|
21
src/Ombi.TheMovieDbApi/Models/DiscoverMovies.cs
Normal file
21
src/Ombi.TheMovieDbApi/Models/DiscoverMovies.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
namespace Ombi.Api.TheMovieDb.Models
|
||||
|
||||
public class DiscoverMovies
|
||||
{
|
||||
public int vote_count { get; set; }
|
||||
public int id { get; set; }
|
||||
public bool video { get; set; }
|
||||
public float vote_average { get; set; }
|
||||
public string title { get; set; }
|
||||
public float popularity { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public string original_language { get; set; }
|
||||
public string original_title { get; set; }
|
||||
public int[] genre_ids { get; set; }
|
||||
public string backdrop_path { get; set; }
|
||||
public bool adult { get; set; }
|
||||
public string overview { get; set; }
|
||||
public string release_date { get; set; }
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Ombi.TheMovieDbApi.Models;
|
||||
|
||||
|
@ -10,6 +10,8 @@ namespace Ombi.Api.TheMovieDb.Models
|
|||
public bool Adult { get; set; }
|
||||
[JsonProperty("backdrop_path")]
|
||||
public string BackdropPath { get; set; }
|
||||
[JsonProperty("belongs_to_collection")]
|
||||
public BelongsToCollection Collecion { get; set; }
|
||||
[JsonProperty("budget")]
|
||||
public int Budget { get; set; }
|
||||
[JsonProperty("genres")]
|
||||
|
@ -66,6 +68,20 @@ namespace Ombi.Api.TheMovieDb.Models
|
|||
public ReleaseDates ReleaseDates { get; set; }
|
||||
[JsonProperty("external_ids")]
|
||||
public ExternalIds ExternalIds { get; set; }
|
||||
[JsonProperty("keywords")]
|
||||
public Keywords Keywords { get; set; }
|
||||
}
|
||||
|
||||
public class Keywords
|
||||
{
|
||||
[JsonProperty("keywords")]
|
||||
public List<KeywordsValue> KeywordsValue { get; set; }
|
||||
}
|
||||
|
||||
public class KeywordsValue
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class Videos
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Net.Http;
|
|||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using Ombi.Api.TheMovieDb.Models;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.TheMovieDbApi.Models;
|
||||
|
||||
namespace Ombi.Api.TheMovieDb
|
||||
|
@ -38,12 +37,35 @@ namespace Ombi.Api.TheMovieDb
|
|||
var request = new Request($"movie/{movieId}", BaseUri, HttpMethod.Get);
|
||||
request.FullUri = request.FullUri.AddQueryParameter("api_key", ApiToken);
|
||||
request.FullUri = request.FullUri.AddQueryParameter("language", langCode);
|
||||
request.FullUri = request.FullUri.AddQueryParameter("append_to_response", "videos,credits,similar,recommendations,release_dates,external_ids");
|
||||
request.FullUri = request.FullUri.AddQueryParameter("append_to_response", "videos,credits,similar,recommendations,release_dates,external_ids,keywords");
|
||||
AddRetry(request);
|
||||
|
||||
return await Api.Request<FullMovieInfo>(request);
|
||||
}
|
||||
|
||||
public async Task<TheMovieDbContainer<DiscoverMovies>> DiscoverMovies(string langCode, int keywordId)
|
||||
{
|
||||
// https://developers.themoviedb.org/3/discover/movie-discover
|
||||
var request = new Request("discover/movie", BaseUri, HttpMethod.Get);
|
||||
request.FullUri = request.FullUri.AddQueryParameter("api_key", ApiToken);
|
||||
request.FullUri = request.FullUri.AddQueryParameter("language", langCode);
|
||||
request.FullUri = request.FullUri.AddQueryParameter("with_keyword", keywordId.ToString());
|
||||
request.FullUri = request.FullUri.AddQueryParameter("sort_by", "popularity.desc");
|
||||
|
||||
return await Api.Request<TheMovieDbContainer<DiscoverMovies>>(request);
|
||||
}
|
||||
|
||||
public async Task<Collections> GetCollection(string langCode, int collectionId)
|
||||
{
|
||||
// https://developers.themoviedb.org/3/discover/movie-discover
|
||||
var request = new Request("discover/movie", BaseUri, HttpMethod.Get);
|
||||
request.FullUri = request.FullUri.AddQueryParameter("api_key", ApiToken);
|
||||
request.FullUri = request.FullUri.AddQueryParameter("language", langCode);
|
||||
request.FullUri = request.FullUri.AddQueryParameter("collection_id", collectionId.ToString());
|
||||
|
||||
return await Api.Request<Collections> (request);
|
||||
}
|
||||
|
||||
public async Task<FindResult> Find(string externalId, ExternalSource source)
|
||||
{
|
||||
var request = new Request($"find/{externalId}", BaseUri, HttpMethod.Get);
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
subscribed: boolean;
|
||||
showSubscribe: boolean;
|
||||
externalIds: IExternalIds;
|
||||
keywords: IKeywords;
|
||||
collections: ICollectionsModel;
|
||||
|
||||
// for the UI
|
||||
requestProcessing: boolean;
|
||||
|
@ -46,6 +48,22 @@
|
|||
background: any;
|
||||
}
|
||||
|
||||
export interface ICollectionsModel {
|
||||
id: number;
|
||||
name: string;
|
||||
posterPath: string;
|
||||
backdropPath: string;
|
||||
}
|
||||
|
||||
export interface IKeywords {
|
||||
keywordsValue: IKeywordsValue[];
|
||||
}
|
||||
|
||||
export interface IKeywordsValue {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface IVideos {
|
||||
results: IVideoResult[];
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
<div class="container summary">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-10 offset-lg-2 col-md-8 offset-md-4 col-sm-7 offset-sm-5 col-6 offset-6">
|
||||
<div
|
||||
class="col-xl-12 col-lg-11 offset-lg-1 col-md-8 offset-md-4 col-sm-7 offset-sm-5 col-6 offset-6">
|
||||
<h1>{{movie.title}} <span *ngIf="movie.releaseDate" class="grey-text align-middle">({{movie.releaseDate
|
||||
| date:'yyyy'}})</span>
|
||||
</h1>
|
||||
|
@ -75,34 +76,42 @@
|
|||
<mat-card class="card-full mat-elevation-z8">
|
||||
<mat-card-content>
|
||||
<div>
|
||||
<small><strong>Theatrical Release:</strong>
|
||||
{{movie.releaseDate | date: 'mediumDate'}}</small></div>
|
||||
<span><strong>Theatrical Release:</strong>
|
||||
{{movie.releaseDate | date: 'mediumDate'}}</span></div>
|
||||
<div>
|
||||
<small *ngIf="movie.digitalReleaseDate"><strong>Digital Release:</strong>
|
||||
<span *ngIf="movie.digitalReleaseDate"><strong>Digital Release:</strong>
|
||||
{{movie.digitalReleaseDate | date:
|
||||
'mediumDate'}}</small>
|
||||
'mediumDate'}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<small *ngIf="movie.voteAverage"><strong>User Score:</strong> {{movie.voteAverage |
|
||||
number:'1.0-1'}}/10</small>
|
||||
<span *ngIf="movie.voteAverage"><strong>User Score:</strong> {{movie.voteAverage |
|
||||
number:'1.0-1'}}/10</span>
|
||||
</div>
|
||||
<div>
|
||||
<small *ngIf="movie.voteCount"><strong>Votes:</strong> {{movie.voteCount |
|
||||
thousandShort: 1}}</small>
|
||||
<span *ngIf="movie.voteCount"><strong>Votes:</strong> {{movie.voteCount |
|
||||
thousandShort: 1}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<small><strong>Status:</strong> {{movie.status}}</small>
|
||||
<span><strong>Status:</strong> {{movie.status}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<small><strong>Runtime:</strong> {{movie.runtime}} Minutes</small>
|
||||
<span><strong>Runtime:</strong> {{movie.runtime}} Minutes</span>
|
||||
</div>
|
||||
<div>
|
||||
<small *ngIf="movie.revenue"><strong>Revenue:</strong> {{movie.revenue | currency:
|
||||
'USD'}}</small>
|
||||
<span *ngIf="movie.revenue"><strong>Revenue:</strong> {{movie.revenue | currency:
|
||||
'USD'}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<small *ngIf="movie.budget"><strong>Budget:</strong>
|
||||
{{movie.budget | currency: 'USD'}}</small>
|
||||
<span *ngIf="movie.budget"><strong>Budget:</strong>
|
||||
{{movie.budget | currency: 'USD'}}</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span *ngIf="movie.genres"><strong>Genres:</strong>
|
||||
<span *ngFor="let genre of movie.genres">
|
||||
{{genre.name}} |
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
@ -110,14 +119,14 @@
|
|||
|
||||
|
||||
</div>
|
||||
<div class="col-12 col-md-7">
|
||||
<div class="col-12 col-md-9">
|
||||
<mat-card class="card-full mat-elevation-z8">
|
||||
<mat-card-content>
|
||||
{{movie.overview}}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="col-12 col-md-2 card-full">
|
||||
<!-- <div class="col-12 col-md-2 card-full">
|
||||
|
||||
<div><button mat-raised-button class="btn-green btn-spacing" *ngIf="movie.available"> {{
|
||||
'Common.Available' | translate }}</button></div>
|
||||
|
@ -146,18 +155,13 @@
|
|||
href="{{movie.embyUrl}}" target="_blank"><i class="fa fa-eye"></i> {{'Search.ViewOnEmby' |
|
||||
translate}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
<div class="row card-spacer">
|
||||
<div class="col-12 col-md-2">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row card-spacer">
|
||||
<div class="col-12 col-md-10">
|
||||
<div class="col-12 col-md-9 offset-md-3">
|
||||
<mat-accordion>
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
|
@ -226,25 +230,25 @@
|
|||
</div>
|
||||
|
||||
|
||||
<div class="col-12 col-md-2">
|
||||
<!-- <div class="col-12 col-md-2">
|
||||
<div *ngFor="let castIndex of [0,1,2,3,4]" class="row align-items-center cast-row ">
|
||||
<div class="col-4">
|
||||
<img src="https://image.tmdb.org/t/p/w300/{{movie.credits.cast[castIndex].profile_path}}"
|
||||
class="cast-profile-img mat-elevation-z8" />
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<div class="row cast-names">
|
||||
<div class="col-12">
|
||||
<div><small>{{movie.credits.cast[castIndex].character}}</small></div>
|
||||
</div>
|
||||
<div class="col-12 cast-name">
|
||||
<div><small>{{movie.credits.cast[castIndex].name}}</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cast-names">
|
||||
<div class="col-12">
|
||||
<div><small>{{movie.credits.cast[castIndex].character}}</small></div>
|
||||
</div>
|
||||
<div class="col-12 cast-name">
|
||||
<div><small>{{movie.credits.cast[castIndex].name}}</small></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue