mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Added issues for non requested iteams
This commit is contained in:
parent
bbf9c4ba51
commit
6d3571f0d2
15 changed files with 88 additions and 57 deletions
|
@ -24,5 +24,7 @@ namespace Ombi.Core.Engine.Interfaces
|
|||
Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies(int currentlyLoaded, int toLoad);
|
||||
Task<ActorCredits> GetMoviesByActor(int actorId, string langCode);
|
||||
int ResultLimit { get; set; }
|
||||
|
||||
Task<MovieFullInfoViewModel> GetMovieInfoByImdbId(string imdbId, CancellationToken requestAborted);
|
||||
}
|
||||
}
|
|
@ -352,5 +352,18 @@ namespace Ombi.Core.Engine.V2
|
|||
viewModel.Subscribed = sub != null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<MovieFullInfoViewModel> GetMovieInfoByImdbId(string imdbId, CancellationToken cancellationToken)
|
||||
{
|
||||
var langCode = await DefaultLanguageCode(null);
|
||||
var findResult = await Cache.GetOrAdd(nameof(GetMovieInfoByImdbId) + imdbId + langCode,
|
||||
async () => await MovieApi.Find(imdbId, ExternalSource.imdb_id), DateTime.Now.AddHours(12), cancellationToken);
|
||||
|
||||
var movie = findResult.movie_results.FirstOrDefault();
|
||||
var movieInfo = await Cache.GetOrAdd(nameof(GetMovieInfoByImdbId) + movie.id + langCode,
|
||||
async () => await MovieApi.GetFullMovieInfo(movie.id, cancellationToken, langCode), DateTime.Now.AddHours(12), cancellationToken);
|
||||
|
||||
return await ProcessSingleMovie(movieInfo);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -51,9 +51,9 @@
|
|||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef> </th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button *ngIf="element.requestType === 1" mat-raised-button color="accent" [routerLink]="'/details/movie/request/' + element.requestId">{{ 'Issues.Details' | translate}}</button>
|
||||
<button *ngIf="element.requestType === 0" mat-raised-button color="accent" [routerLink]="'/details/show/request/' + element.requestId">{{ 'Issues.Details' | translate}}</button>
|
||||
<button *ngIf="element.requestType === 2" mat-raised-button color="accent" [routerLink]="'/details/artist/request/' + element.requestId">{{ 'Issues.Details' | translate}}</button>
|
||||
<button *ngIf="element.requestType === 1" mat-raised-button color="accent" [routerLink]="'/details/movie/' + element.providerId">{{ 'Issues.Details' | translate}}</button>
|
||||
<button *ngIf="element.requestType === 0" mat-raised-button color="accent" [routerLink]="'/details/tv/' + element.providerId">{{ 'Issues.Details' | translate}}</button>
|
||||
<button *ngIf="element.requestType === 2" mat-raised-button color="accent" [routerLink]="'/details/artist/request/' + element.providerId">{{ 'Issues.Details' | translate}}</button>
|
||||
<!-- <button mat-raised-button color="warn" (click)="openOptions(element)" *ngIf="isAdmin"> {{ 'Requests.Options' | translate}}</button> -->
|
||||
</td>
|
||||
</ng-container>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
'MediaDetails.Denied' | translate }}</button>
|
||||
</span>
|
||||
|
||||
<button *ngIf="(hasRequest && movieRequest) || movie.available" mat-raised-button class="btn-spacing" color="danger" (click)="issue()">
|
||||
<button mat-raised-button class="btn-spacing" color="danger" (click)="issue()">
|
||||
<i class="fa fa-exclamation"></i> {{
|
||||
'Requests.ReportIssue' | translate }}</button>
|
||||
|
||||
|
@ -109,8 +109,8 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="issuesPanel" *ngIf="movie.requestId">
|
||||
<issues-panel [requestId]="movie.requestId" [isAdmin]="isAdmin"></issues-panel>
|
||||
<div class="issuesPanel">
|
||||
<issues-panel [providerId]="movie.imdbId" [isAdmin]="isAdmin"></issues-panel>
|
||||
</div>
|
||||
|
||||
<mat-accordion class=" mat-elevation-z8 spacing-below ">
|
||||
|
|
|
@ -24,55 +24,55 @@ export class MovieDetailsComponent {
|
|||
public showAdvanced: boolean; // Set on the UI
|
||||
|
||||
private theMovidDbId: number;
|
||||
private imdbId: string;
|
||||
|
||||
constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
|
||||
private sanitizer: DomSanitizer, private imageService: ImageService,
|
||||
public dialog: MatDialog, private requestService: RequestService,
|
||||
public messageService: MessageService, private auth: AuthService) {
|
||||
this.route.params.subscribe((params: any) => {
|
||||
|
||||
debugger;
|
||||
if (typeof params.movieDbId === 'string' || params.movieDbId instanceof String) {
|
||||
if (params.movieDbId.startsWith("tt")) {
|
||||
this.imdbId = params.movieDbId;
|
||||
}
|
||||
}
|
||||
this.theMovidDbId = params.movieDbId;
|
||||
if (params.requestId) {
|
||||
this.load(+params.requestId);
|
||||
} else {
|
||||
this.load(undefined);
|
||||
}
|
||||
|
||||
this.load();
|
||||
});
|
||||
}
|
||||
|
||||
public async load(requestId: number|undefined) {
|
||||
public async load() {
|
||||
|
||||
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||
|
||||
if (requestId) {
|
||||
var result = await this.searchService.getFullMovieDetailsByRequestId(requestId);
|
||||
this.theMovidDbId = result.id
|
||||
|
||||
this.movie = result;
|
||||
if (this.movie.requestId > 0) {
|
||||
// Load up this request
|
||||
this.hasRequest = true;
|
||||
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
|
||||
}
|
||||
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
|
||||
this.movie.background = this.sanitizer.bypassSecurityTrustStyle
|
||||
("url(" + x + ")");
|
||||
if (this.imdbId) {
|
||||
this.searchService.getMovieByImdbId(this.imdbId).subscribe(async x => {
|
||||
this.movie = x;
|
||||
if (this.movie.requestId > 0) {
|
||||
// Load up this request
|
||||
this.hasRequest = true;
|
||||
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
|
||||
}
|
||||
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
|
||||
this.movie.background = this.sanitizer.bypassSecurityTrustStyle
|
||||
("url(" + x + ")");
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.searchService.getFullMovieDetails(this.theMovidDbId).subscribe(async x => {
|
||||
this.movie = x;
|
||||
if (this.movie.requestId > 0) {
|
||||
// Load up this request
|
||||
this.hasRequest = true;
|
||||
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
|
||||
}
|
||||
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
|
||||
this.movie.background = this.sanitizer.bypassSecurityTrustStyle
|
||||
("url(" + x + ")");
|
||||
this.searchService.getFullMovieDetails(this.theMovidDbId).subscribe(async x => {
|
||||
this.movie = x;
|
||||
if (this.movie.requestId > 0) {
|
||||
// Load up this request
|
||||
this.hasRequest = true;
|
||||
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
|
||||
}
|
||||
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
|
||||
this.movie.background = this.sanitizer.bypassSecurityTrustStyle
|
||||
("url(" + x + ")");
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async request() {
|
||||
|
@ -109,7 +109,7 @@ export class MovieDetailsComponent {
|
|||
public async issue() {
|
||||
const dialogRef = this.dialog.open(NewIssueComponent, {
|
||||
width: '500px',
|
||||
data: {requestId: this.movieRequest ? this.movieRequest.id : null, requestType: RequestType.movie, imdbid: this.movie.imdbId, title: this.movie.title}
|
||||
data: {requestId: this.movieRequest ? this.movieRequest.id : null, requestType: RequestType.movie, providerId: this.movie.imdbId ? this.movie.imdbId : this.movie.id, title: this.movie.title}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ export interface IDenyDialogData {
|
|||
export interface IIssueDialogData {
|
||||
requestType: RequestType;
|
||||
requestId: number;
|
||||
imdbId: string;
|
||||
providerId: string;
|
||||
title: string;
|
||||
}
|
|
@ -10,7 +10,7 @@ import { TranslateService } from "@ngx-translate/core";
|
|||
})
|
||||
export class IssuesPanelComponent implements OnInit {
|
||||
|
||||
@Input() public requestId: number;
|
||||
@Input() public providerId: string;
|
||||
@Input() public isAdmin: boolean;
|
||||
|
||||
public issuesCount: number;
|
||||
|
@ -26,7 +26,7 @@ export class IssuesPanelComponent implements OnInit {
|
|||
}
|
||||
|
||||
public async ngOnInit() {
|
||||
this.issues = await this.issuesService.getIssuesByRequestId(this.requestId);
|
||||
this.issues = await this.issuesService.getIssuesByProviderId(this.providerId);
|
||||
this.issuesCount = this.issues.length;
|
||||
this.calculateOutstanding();
|
||||
this.settings = await this.settingsService.getIssueSettings().toPromise();
|
||||
|
|
|
@ -20,6 +20,7 @@ export class NewIssueComponent implements OnInit {
|
|||
private issueService: IssuesService,
|
||||
public messageService: MessageService,
|
||||
private translate: TranslateService) {
|
||||
debugger;
|
||||
this.issue = {
|
||||
subject: "",
|
||||
description: "",
|
||||
|
@ -32,7 +33,7 @@ export class NewIssueComponent implements OnInit {
|
|||
requestId: data.requestId,
|
||||
requestType: data.requestType,
|
||||
title: data.title,
|
||||
providerId: data.imdbId,
|
||||
providerId: data.providerId,
|
||||
userReported: undefined,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<button *ngIf="tv.partlyAvailable && !tv.fullyAvailable" mat-raised-button class="btn-spacing" color="accent" [disabled]>
|
||||
<i class="fa fa-check"></i> {{'Common.PartiallyAvailable' | translate }}</button>
|
||||
|
||||
<button *ngIf="(tvRequest)" mat-raised-button class="btn-spacing" color="danger" (click)="issue()">
|
||||
<button mat-raised-button class="btn-spacing" color="danger" (click)="issue()">
|
||||
<i class="fa fa-exclamation"></i> {{
|
||||
'Requests.ReportIssue' | translate }}</button>
|
||||
|
||||
|
@ -77,7 +77,7 @@
|
|||
|
||||
<div class="col-12 col-md-10" *ngIf="tvRequest">
|
||||
<div class="issuesPanel">
|
||||
<issues-panel [requestId]="tv.requestId" [isAdmin]="isAdmin"></issues-panel>
|
||||
<issues-panel [providerId]="tv.theTvDbId" [isAdmin]="isAdmin"></issues-panel>
|
||||
</div>
|
||||
<mat-accordion>
|
||||
<mat-expansion-panel>
|
||||
|
|
|
@ -23,7 +23,6 @@ export class TvDetailsComponent implements OnInit {
|
|||
public isAdmin: boolean;
|
||||
|
||||
private tvdbId: number;
|
||||
private requestIdFromQuery: number;
|
||||
|
||||
constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
|
||||
private sanitizer: DomSanitizer, private imageService: ImageService,
|
||||
|
@ -32,7 +31,6 @@ export class TvDetailsComponent implements OnInit {
|
|||
this.route.params.subscribe((params: any) => {
|
||||
this.tvdbId = params.tvdbId;
|
||||
this.fromSearch = params.search;
|
||||
this.requestIdFromQuery = +params.requestId; // Coming from the issues page
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,9 +44,6 @@ export class TvDetailsComponent implements OnInit {
|
|||
if (this.fromSearch) {
|
||||
this.tv = await this.searchService.getTvInfoWithMovieDbId(this.tvdbId);
|
||||
this.tvdbId = this.tv.id;
|
||||
} else if (this.requestIdFromQuery) {
|
||||
console.log("REQUESTID" + this.requestIdFromQuery)
|
||||
this.tv = await this.searchService.getTvInfoWithRequestId(this.requestIdFromQuery);
|
||||
} else {
|
||||
this.tv = await this.searchService.getTvInfo(this.tvdbId);
|
||||
}
|
||||
|
@ -68,7 +63,7 @@ export class TvDetailsComponent implements OnInit {
|
|||
public async issue() {
|
||||
const dialogRef = this.dialog.open(NewIssueComponent, {
|
||||
width: '500px',
|
||||
data: {requestId: this.tvRequest ? this.tv.requestId : null, requestType: RequestType.tvShow, imdbid: this.tv.theTvDbId, title: this.tv.title}
|
||||
data: {requestId: this.tvRequest ? this.tv.requestId : null, requestType: RequestType.tvShow, providerId: this.tv.theTvDbId, title: this.tv.title}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -12,16 +12,13 @@ import { PipeModule } from "../pipes/pipe.module";
|
|||
|
||||
import * as fromComponents from './components';
|
||||
import { AuthGuard } from "../auth/auth.guard";
|
||||
import { RequestServiceV2 } from "../services/requestV2.service";
|
||||
import { ArtistDetailsComponent } from "./components/artist/artist-details.component";
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: "movie/:movieDbId", component: MovieDetailsComponent, canActivate: [AuthGuard] },
|
||||
{ path: "movie/request/:requestId", component: MovieDetailsComponent, canActivate: [AuthGuard] },
|
||||
{ path: "tv/:tvdbId/:search", component: TvDetailsComponent, canActivate: [AuthGuard] },
|
||||
{ path: "tv/:tvdbId", component: TvDetailsComponent, canActivate: [AuthGuard] },
|
||||
{ path: "show/request/:requestId", component: TvDetailsComponent, canActivate: [AuthGuard] },
|
||||
{ path: "artist/:artistId", component: ArtistDetailsComponent, canActivate: [AuthGuard] },
|
||||
];
|
||||
@NgModule({
|
||||
|
|
|
@ -33,6 +33,10 @@ export class IssuesService extends ServiceHelpers {
|
|||
return this.http.get<IIssues[]>(`${this.url}request/${requestId}`, {headers: this.headers}).toPromise();
|
||||
}
|
||||
|
||||
public getIssuesByProviderId(providerId: string): Promise<IIssues[]> {
|
||||
return this.http.get<IIssues[]>(`${this.url}provider/${providerId}`, {headers: this.headers}).toPromise();
|
||||
}
|
||||
|
||||
public getIssuesPage(take: number, skip: number, status: IssueStatus): Observable<IIssues[]> {
|
||||
return this.http.get<IIssues[]>(`${this.url}${take}/${skip}/${status}`, {headers: this.headers});
|
||||
}
|
||||
|
|
|
@ -24,6 +24,10 @@ export class SearchV2Service extends ServiceHelpers {
|
|||
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/${theMovieDbId}`);
|
||||
}
|
||||
|
||||
public getMovieByImdbId(imdbId: string): Observable<ISearchMovieResultV2> {
|
||||
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/imdb/${imdbId}`);
|
||||
}
|
||||
|
||||
public getFullMovieDetailsByRequestId(requestId: number): Promise<ISearchMovieResultV2> {
|
||||
return this.http.get<ISearchMovieResultV2>(`${this.url}/Movie/request/${requestId}`).toPromise();
|
||||
}
|
||||
|
|
|
@ -178,6 +178,15 @@ namespace Ombi.Controllers.V1
|
|||
.Include(x => x.UserReported).ToListAsync());
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("provider/{id}")]
|
||||
public async Task<IActionResult> GetIssueByProviderId([FromRoute] string id)
|
||||
{
|
||||
return new OkObjectResult(await _issues.GetAll().Where(x => x.ProviderId == id)
|
||||
.Include(x => x.IssueCategory)
|
||||
.Include(x => x.UserReported).ToListAsync());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get's all the issue comments by id
|
||||
/// </summary>
|
||||
|
|
|
@ -61,6 +61,12 @@ namespace Ombi.Controllers.V2
|
|||
return await _movieEngineV2.GetFullMovieInformation(movieDbId, Request.HttpContext.RequestAborted);
|
||||
}
|
||||
|
||||
[HttpGet("movie/imdb/{imdbid}")]
|
||||
public async Task<MovieFullInfoViewModel> GetMovieInfoByImdbId(string imdbId)
|
||||
{
|
||||
return await _movieEngineV2.GetMovieInfoByImdbId(imdbId, Request.HttpContext.RequestAborted);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns details for a single movie
|
||||
/// </summary>
|
||||
|
@ -365,7 +371,7 @@ namespace Ombi.Controllers.V2
|
|||
[ProducesDefaultResponseType]
|
||||
public async Task<ActorCredits> GetMoviesByActor(int actorId)
|
||||
{
|
||||
return await _movieEngineV2.GetMoviesByActor(actorId, null);
|
||||
return await _movieEngineV2.GetMoviesByActor(actorId, null);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue