mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Collections done!
This commit is contained in:
parent
6fc9db003e
commit
3fbbf74c1b
6 changed files with 55 additions and 25 deletions
|
@ -58,10 +58,9 @@ namespace Ombi.Api.TheMovieDb
|
|||
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);
|
||||
var request = new Request($"/collection/{collectionId}", 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);
|
||||
}
|
||||
|
|
|
@ -61,8 +61,6 @@ export class AppComponent implements OnInit {
|
|||
public ngOnInit() {
|
||||
const theme = localStorage.getItem("theme");
|
||||
this.onSetTheme(theme);
|
||||
this.user = this.authService.claims();
|
||||
this.isAdmin = this.authService.hasRole("admin");
|
||||
|
||||
this.settingsService.getCustomization().subscribe(x => {
|
||||
this.customizationSettings = x;
|
||||
|
@ -88,10 +86,11 @@ export class AppComponent implements OnInit {
|
|||
this.currentUrl = event.url;
|
||||
if (event instanceof NavigationStart) {
|
||||
this.user = this.authService.claims();
|
||||
this.isAdmin = this.authService.hasRole("admin");
|
||||
this.showNav = this.authService.loggedIn();
|
||||
|
||||
// tslint:disable-next-line:no-string-literal
|
||||
if (this.user !== null && this.user.name && !this.checkedForUpdate && this.user.roles["Admin"]) {
|
||||
if (this.user !== null && this.user.name && !this.checkedForUpdate && this.isAdmin) {
|
||||
this.checkedForUpdate = true;
|
||||
this.jobService.getCachedUpdate().subscribe(x => {
|
||||
this.updateAvailable = x;
|
||||
|
@ -111,10 +110,6 @@ export class AppComponent implements OnInit {
|
|||
return "user";
|
||||
}
|
||||
|
||||
public hasRole(role: string): boolean {
|
||||
return this.user.roles.some(r => r === role);
|
||||
}
|
||||
|
||||
public openMobileApp(event: any) {
|
||||
event.preventDefault();
|
||||
if (!this.customizationSettings.applicationUrl) {
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
<div class="small-middle-container">
|
||||
<div class="small-middle-container" *ngIf="collection">
|
||||
|
||||
<div class="row justify-content-md-center top-spacing">
|
||||
<div class="btn-group" role="group" aria-label="Basic example">
|
||||
<button type="button" (click)="popular()" [attr.color]="popularActive ? 'accent' : 'primary'"
|
||||
[ngClass]="popularActive ? 'mat-accent' : 'mat-primary'" mat-raised-button
|
||||
class="btn grow" >{{'Discovery.PopularTab' | translate}}</button>
|
||||
<button type="button" (click)="trending()"
|
||||
[attr.color]="trendingActive ? 'accent' : 'primary'"
|
||||
[ngClass]="trendingActive ? 'mat-accent' : 'mat-primary'"
|
||||
mat-raised-button class="btn grow" color="primary">{{'Discovery.TrendingTab' | translate}}</button>
|
||||
<button type="button" (click)="upcoming()"
|
||||
[attr.color]="upcomingActive ? 'accent' : 'primary'"
|
||||
[ngClass]="upcomingActive ? 'mat-accent' : 'mat-primary'"
|
||||
mat-raised-button class="btn grow" color="primary">{{'Discovery.UpcomingTab' | translate}}</button>
|
||||
</div>
|
||||
<h3 class="row">{{collection.name}}</h3>
|
||||
<p class="row">{{collection.overview}}</p>
|
||||
</div>
|
||||
<div *ngIf="loadingFlag" class="row justify-content-md-center top-spacing loading-spinner">
|
||||
<mat-spinner [color]="'accent'"></mat-spinner>
|
||||
|
|
|
@ -2,6 +2,8 @@ import { Component, OnInit } from "@angular/core";
|
|||
import { ActivatedRoute } from "@angular/router";
|
||||
import { SearchV2Service } from "../../services";
|
||||
import { IMovieCollectionsViewModel } from "../../interfaces/ISearchTvResultV2";
|
||||
import { IDiscoverCardResult } from "../interfaces";
|
||||
import { RequestType } from "../../interfaces";
|
||||
|
||||
@Component({
|
||||
templateUrl: "./discover-collections.component.html",
|
||||
|
@ -11,6 +13,9 @@ export class DiscoverCollectionsComponent implements OnInit {
|
|||
|
||||
public collectionId: number;
|
||||
public collection: IMovieCollectionsViewModel;
|
||||
public loadingFlag: boolean;
|
||||
|
||||
public discoverResults: IDiscoverCardResult[] = [];
|
||||
|
||||
constructor(private searchService: SearchV2Service, private route: ActivatedRoute) {
|
||||
this.route.params.subscribe((params: any) => {
|
||||
|
@ -19,6 +24,34 @@ export class DiscoverCollectionsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public async ngOnInit() {
|
||||
this.collection = await this.searchService.getMovieCollections(this.collectionId);
|
||||
this.loadingFlag = true;
|
||||
this.collection = await this.searchService.getMovieCollections(this.collectionId);
|
||||
this.createModel();
|
||||
}
|
||||
|
||||
private createModel() {
|
||||
this.finishLoading();
|
||||
this.collection.collection.forEach(m => {
|
||||
this.discoverResults.push({
|
||||
available: m.available,
|
||||
posterPath: `https://image.tmdb.org/t/p/w300/${m.posterPath}`,
|
||||
requested: m.requested,
|
||||
title: m.title,
|
||||
type: RequestType.movie,
|
||||
id: m.id,
|
||||
url: `http://www.imdb.com/title/${m.imdbId}/`,
|
||||
rating: 0,
|
||||
overview: m.overview,
|
||||
approved: m.approved
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private loading() {
|
||||
this.loadingFlag = true;
|
||||
}
|
||||
|
||||
private finishLoading() {
|
||||
this.loadingFlag = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
<button (click)="approve()" mat-raised-button class="btn-spacing" color="accent">
|
||||
<i class="fa fa-plus"></i> {{ 'Common.Approve' | translate }}
|
||||
</button>
|
||||
<button *ngIf="!movie.available" (click)="markAvailable()" mat-raised-button class="btn-spacing" color="accent">
|
||||
<i class="fa fa-plus"></i> {{ 'Requests.MarkAvailable' | translate }}
|
||||
</button>
|
||||
|
||||
<button *ngIf="hasRequest && !movieRequest.denied" mat-raised-button class="btn-spacing" color="warn" (click)="deny()">
|
||||
<i class="fa fa-times"></i> {{
|
||||
|
@ -64,7 +67,7 @@
|
|||
<div class="row">
|
||||
|
||||
<div class="col-12 col-md-2">
|
||||
<button *ngIf="movie.belongsToCollection" [routerLink]="/discover/{{movie.belongsToCollection.id}" mat-raised-button class="spacing-below full-width mat-elevation-z8">{{movie.belongsToCollection.name}}</button>
|
||||
<button *ngIf="movie.belongsToCollection" [routerLink]="'/discover/collection/' + movie.belongsToCollection.id" mat-raised-button class="spacing-below full-width mat-elevation-z8">{{movie.belongsToCollection.name}}</button>
|
||||
|
||||
<mat-card class="mat-elevation-z8">
|
||||
<mat-card-content class="medium-font">
|
||||
|
|
|
@ -109,6 +109,16 @@ export class MovieDetailsComponent {
|
|||
}
|
||||
}
|
||||
|
||||
public async markAvailable() {
|
||||
const result = await this.requestService.markMovieAvailable({id: this.movieRequest.id}).toPromise();
|
||||
if (result.result) {
|
||||
this.movie.available = true;
|
||||
this.messageService.send(result.message, "Ok");
|
||||
} else {
|
||||
this.messageService.send(result.errorMessage, "Ok");
|
||||
}
|
||||
}
|
||||
|
||||
private setQualityOverrides(): void {
|
||||
if (this.radarrProfiles) {
|
||||
const profile = this.radarrProfiles.filter((p) => {
|
||||
|
@ -119,6 +129,7 @@ export class MovieDetailsComponent {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private setRootFolderOverrides(): void {
|
||||
if (this.radarrRootFolders) {
|
||||
const path = this.radarrRootFolders.filter((folder) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue