mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
!wip
This commit is contained in:
parent
65d1672d2b
commit
e95ca1523d
8 changed files with 35 additions and 3 deletions
|
@ -13,6 +13,7 @@ namespace Ombi.Core.Engine.Interfaces
|
|||
Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies();
|
||||
Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies();
|
||||
Task<IEnumerable<SearchMovieViewModel>> NowPlayingMovies();
|
||||
Task<int> GetTvDbId(int theMovieDbId);
|
||||
int ResultLimit { get; set; }
|
||||
}
|
||||
}
|
|
@ -46,6 +46,12 @@ namespace Ombi.Core.Engine.V2
|
|||
return await ProcessSingleMovie(movieInfo);
|
||||
}
|
||||
|
||||
public async Task<int> GetTvDbId(int theMovieDbId)
|
||||
{
|
||||
var result = await MovieApi.GetTvExternals(theMovieDbId);
|
||||
return result.tvdb_id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get similar movies to the id passed in
|
||||
/// </summary>
|
||||
|
|
|
@ -13,7 +13,7 @@ import { YoutubeTrailerComponent } from "./youtube-trailer.component";
|
|||
|
||||
const routes: Routes = [
|
||||
{ path: "movie/:movieDbId", component: MovieDetailsComponent },
|
||||
{ path: "tv/:tvdbId", component: TvDetailsComponent },
|
||||
{ path: "tv/:tvdbId/:search", component: TvDetailsComponent },
|
||||
];
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
|
|
@ -14,6 +14,7 @@ import { EpisodeRequestComponent } from "../../shared/episode-request/episode-re
|
|||
})
|
||||
export class TvDetailsComponent {
|
||||
public tv: ISearchTvResultV2;
|
||||
public fromSearch: boolean;
|
||||
private tvdbId: number;
|
||||
|
||||
constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
|
||||
|
@ -21,12 +22,19 @@ export class TvDetailsComponent {
|
|||
public dialog: MatDialog, public messageService: MessageService) {
|
||||
this.route.params.subscribe((params: any) => {
|
||||
this.tvdbId = params.tvdbId;
|
||||
this.fromSearch = params.search;
|
||||
|
||||
this.load();
|
||||
});
|
||||
}
|
||||
|
||||
public async load() {
|
||||
if(this.fromSearch) {
|
||||
this.tv = await this.searchService.getTvInfoWithMovieDbId(this.tvdbId);
|
||||
this.tvdbId = this.tv.id;
|
||||
} else {
|
||||
this.tv = await this.searchService.getTvInfo(this.tvdbId);
|
||||
}
|
||||
const tvBanner = await this.imageService.getTvBanner(this.tvdbId).toPromise();
|
||||
this.tv.background = this.sanitizer.bypassSecurityTrustStyle("url(" + tvBanner + ")");
|
||||
}
|
||||
|
|
|
@ -56,6 +56,9 @@ export class NavSearchComponent {
|
|||
if (event.item.media_type == "movie") {
|
||||
this.router.navigate([`details/movie/${event.item.id}`]);
|
||||
return;
|
||||
} else if (event.item.media_type == "tv") {
|
||||
this.router.navigate([`details/tv/${event.item.id}/true`]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,7 @@ export class SearchV2Service extends ServiceHelpers {
|
|||
public getTvInfo(tvdbid: number): Promise<ISearchTvResultV2> {
|
||||
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/${tvdbid}`, { headers: this.headers }).toPromise();
|
||||
}
|
||||
public getTvInfoWithMovieDbId(theMovieDbId: number): Promise<ISearchTvResultV2> {
|
||||
return this.http.get<ISearchTvResultV2>(`${this.url}/Tv/moviedb/${theMovieDbId}`, { headers: this.headers }).toPromise();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,9 +42,9 @@ export class EpisodeRequestComponent implements OnInit {
|
|||
this.series.seasonRequests.forEach((season) => {
|
||||
const seasonsViewModel = <ISeasonsViewModel>{ seasonNumber: season.seasonNumber, episodes: [] };
|
||||
season.episodes.forEach(ep => {
|
||||
ep.requested = true;
|
||||
if (!this.series.latestSeason || !this.series.requestAll || !this.series.firstSeason) {
|
||||
if (ep.selected) {
|
||||
ep.requested = true;
|
||||
seasonsViewModel.episodes.push({ episodeNumber: ep.episodeNumber });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,17 @@ namespace Ombi.Controllers.V2
|
|||
return await _tvEngineV2.GetShowInformation(tvdbid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns details for a single show
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tv/moviedb/{moviedbid}")]
|
||||
public async Task<SearchFullInfoTvShowViewModel> GetTvInfoByMovieId(int moviedbid)
|
||||
{
|
||||
var tvDbId = await _movieEngineV2.GetTvDbId(moviedbid);
|
||||
return await _tvEngineV2.GetShowInformation(tvDbId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns similar movies to the movie id passed in
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue