pull/1425/head
tidusjar 7 years ago
parent 40fb27ebab
commit a278917dcd

@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Security.Principal; using System.Security.Principal;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoMapper;
using Hangfire; using Hangfire;
using Ombi.Api.TvMaze; using Ombi.Api.TvMaze;
using Ombi.Core.Models.Requests; using Ombi.Core.Models.Requests;
@ -17,13 +18,15 @@ namespace Ombi.Core.Engine
{ {
public class TvRequestEngine : BaseMediaEngine, ITvRequestEngine public class TvRequestEngine : BaseMediaEngine, ITvRequestEngine
{ {
public TvRequestEngine(ITvMazeApi tvApi, IRequestServiceMain requestService, IPrincipal user, INotificationService notificationService) : base(user, requestService) public TvRequestEngine(ITvMazeApi tvApi, IRequestServiceMain requestService, IPrincipal user, INotificationService notificationService, IMapper map) : base(user, requestService)
{ {
TvApi = tvApi; TvApi = tvApi;
NotificationService = notificationService; NotificationService = notificationService;
Mapper = map;
} }
private INotificationService NotificationService { get; } private INotificationService NotificationService { get; }
private ITvMazeApi TvApi { get; } private ITvMazeApi TvApi { get; }
private IMapper Mapper { get; }
public async Task<RequestEngineResult> RequestTvShow(SearchTvShowViewModel tv) public async Task<RequestEngineResult> RequestTvShow(SearchTvShowViewModel tv)
{ {
@ -166,6 +169,16 @@ namespace Ombi.Core.Engine
newRequest.SeasonRequests = episodeDifference; newRequest.SeasonRequests = episodeDifference;
} }
if (!existingRequest.HasChildRequests)
{
// So this is the first child request, we will want to convert the original request to a child
var originalRequest = Mapper.Map<TvRequestModel>(existingRequest);
existingRequest.ChildRequests.Add(originalRequest);
existingRequest.RequestedUsers.Clear();
existingRequest.Approved = false;
existingRequest.Available = false;
}
existingRequest.ChildRequests.Add(newRequest); existingRequest.ChildRequests.Add(newRequest);
TvRequestService.UpdateRequest(existingRequest); TvRequestService.UpdateRequest(existingRequest);

@ -27,7 +27,7 @@
"gulp-clean-css": "^3.0.4", "gulp-clean-css": "^3.0.4",
"gulp-filter": "^5.0.0", "gulp-filter": "^5.0.0",
"gulp-if": "^2.0.2", "gulp-if": "^2.0.2",
"gulp-rename": "^1.2.2", "gulp-rename": "^1.2.2",
"gulp-run": "^1.7.1", "gulp-run": "^1.7.1",
"gulp-sass": "^2.3.2", "gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^1.9.0", "gulp-sourcemaps": "^1.9.0",

@ -1,4 +1,4 @@
<p-growl [value]="notificationService.messages" [life]="1000"></p-growl> <p-growl [value]="notificationService.messages" ></p-growl>
<nav *ngIf="showNav" class="navbar navbar-default navbar-fixed-top"> <nav *ngIf="showNav" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid"> <div class="container-fluid">

@ -2,7 +2,7 @@
export interface ISearchTvResult { export interface ISearchTvResult {
id: number, id: number,
title: string, title: string, // used in the request
aliases: string[], aliases: string[],
banner: string, banner: string,
seriesId: number, seriesId: number,

@ -1,38 +1,38 @@
<div class="form-group"> <div class="form-group">
<div> <div>
<input type="text" class="form-control form-control-custom" placeholder="Search" (keyup)="search($event)"> <input type="text" class="form-control form-control-custom" placeholder="Search" (keyup)="search($event)">
</div> </div>
</div> </div>
<br/> <br />
<div infinite-scroll <div infinite-scroll
[infiniteScrollDistance]="1" [infiniteScrollDistance]="1"
[infiniteScrollThrottle]="100" [infiniteScrollThrottle]="100"
(scrolled)="loadMore()"> (scrolled)="loadMore()">
<div *ngFor="let request of tvRequests"> <div *ngFor="let request of tvRequests">
<div class="row"> <div class="row">
<div class="col-sm-2"> <div class="col-sm-2">
<img class="img-responsive" src="{{request.posterPath}}" alt="poster"> <img class="img-responsive" src="{{request.posterPath}}" alt="poster">
</div> </div>
<div class="col-sm-5 ">
<div>
<a href="http://www.imdb.com/title/{{request.imdbId}}/" target="_blank">
<h4 class="request-title">{{request.title}} ({{request.releaseDate | date: 'yyyy'}})</h4>
</a>
</div>
<br />
<div>
<span>Status: </span>
<span class="label label-success">{{request.status}}</span>
</div>
<div class="col-sm-5 ">
<div>
<a href="http://www.imdb.com/title/{{request.imdbId}}/" target="_blank">
<h4 class="request-title">{{request.title}} ({{request.releaseDate | date: 'yyyy'}})</h4>
</a>
</div>
<br />
<div>
<span>Status: </span>
<span class="label label-success">{{request.status}}</span>
</div>
<div *ngIf="!request.hasChildRequests">
<div> <div>
<span>Request status: </span> <span>Request status: </span>
<span *ngIf="request.available" class="label label-success">Available</span> <span *ngIf="request.available" class="label label-success">Available</span>
@ -49,7 +49,7 @@
<div>Release Date: {{request.releaseDate | date}}</div> <div>Release Date: {{request.releaseDate | date}}</div>
<br/> <br />
<!--{{#if_eq type "tv"}} <!--{{#if_eq type "tv"}}
{{#if episodes}} {{#if episodes}}
@ -74,129 +74,132 @@
@UI.Issues_Issue: <a href="@formAction/issues/{{issueId}}"><i class="fa fa-check"></i></a> @UI.Issues_Issue: <a href="@formAction/issues/{{issueId}}"><i class="fa fa-check"></i></a>
{{/if_eq}} {{/if_eq}}
</div>--> </div>-->
</div>
<!--Child Requests-->
<div *ngIf="request.hasChildRequests">
<button type="button" class="btn btn-sm btn-info-outline" data-toggle="collapse" [attr.data-target]="'#' + request.id +'childRequests'">Children</button>
<!--Child Requests--> <div id="{{request.id}}childRequests" class="collapse">
<div *ngIf="request.hasChildRequests">
<button type="button" class="btn btn-sm btn-info-outline" data-toggle="collapse" [attr.data-target]="'#' + request.id +'childRequests'">Children</button>
<div id="{{request.id}}childRequests" class="collapse">
<div *ngFor="let child of request.childRequests">
<hr/>
<div *ngIf="request.requestedUsers">Requested By: <span *ngFor="let user of request.requestedUsers">{{user}} </span></div>
<div>Seasons Requested: <span *ngFor="let s of request.seasonNumbersRequested">{{s}} </span> </div>
<div>
<span>Request status: </span>
<span *ngIf="request.available" class="label label-success">Available</span>
<span *ngIf="request.approved && !request.available" class="label label-info">Processing Request</span>
<span *ngIf="request.denied" class="label label-danger">Request Denied</span>
<span *ngIf="request.deniedReason" title="{{request.deniedReason}}"><i class="fa fa-info-circle"></i></span>
<span *ngIf="!request.approved && !request.availble && !request.denied" class="label label-warning">Pending Approval</span>
</div> <div *ngFor="let child of request.childRequests">
<hr/>
<div *ngIf="request.requestedUsers">Requested By: <span *ngFor="let user of request.requestedUsers">{{user}} </span>
</div>
<div>Seasons Requested: <span *ngFor="let s of request.seasonNumbersRequested">{{s}} </span>
</div> </div>
<div>
<span>Request status: </span>
<span *ngIf="request.available" class="label label-success">Available</span>
<span *ngIf="request.approved && !request.available" class="label label-info">Processing Request</span>
<span *ngIf="request.denied" class="label label-danger">Request Denied</span>
<span *ngIf="request.deniedReason" title="{{request.deniedReason}}"><i class="fa fa-info-circle"></i></span>
<span *ngIf="!request.approved && !request.availble && !request.denied" class="label label-warning">Pending Approval</span>
</div>
</div> </div>
</div>
</div>
</div> </div>
<div class="col-sm-3 col-sm-push-3">
<div *ngIf="isAdmin"> </div>
<div *ngIf="!request.approved"> <div class="col-sm-3 col-sm-push-3">
<form> <div *ngIf="isAdmin">
<input name="requestId" type="text" value="{{request.requestId}}" hidden="hidden" /> <div *ngIf="!request.approved">
<div *ngIf="request.hasQualities" class="btn-group btn-split"> <form>
<button type="button" (click)="approve(request)" class="btn btn-sm btn-success-outline approve"><i class="fa fa-plus"></i> Approve</button> <input name="requestId" type="text" value="{{request.requestId}}" hidden="hidden" />
<button type="button" class="btn btn-success-outline dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <div *ngIf="request.hasQualities" class="btn-group btn-split">
<span class="caret"></span> <button type="button" (click)="approve(request)" class="btn btn-sm btn-success-outline approve"><i class="fa fa-plus"></i> Approve</button>
<span class="sr-only">Toggle Dropdown</span> <button type="button" class="btn btn-success-outline dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
</button> <span class="caret"></span>
<!--<ul class="dropdown-menu"> <span class="sr-only">Toggle Dropdown</span>
{{#each qualities}} </button>
<li><a href="#" class="approve-with-quality" id="{{id}}">{{name}}</a></li> <!--<ul class="dropdown-menu">
{{/each}} {{#each qualities}}
</ul>--> <li><a href="#" class="approve-with-quality" id="{{id}}">{{name}}</a></li>
</div> {{/each}}
</ul>-->
</div>
<button *ngIf="!request.hasQualities" (click)="approve(request)" style="text-align: right" class="btn btn-sm btn-success-outline approve" type="submit"><i class="fa fa-plus"></i> Approve</button> <button *ngIf="!request.hasQualities" (click)="approve(request)" style="text-align: right" class="btn btn-sm btn-success-outline approve" type="submit"><i class="fa fa-plus"></i> Approve</button>
</form> </form>
<!--<form method="POST" action="@formAction/requests/changeRootFolder{{#if_eq type "tv"}}tv{{else}}movie{{/if_eq}}" id="changeFolder{{requestId}}">
<input name="requestId" type="text" value="{{requestId}}" hidden="hidden"/>
{{#if_eq hasRootFolders true}}
<div class="btn-group btn-split">
<button type="button" class="btn btn-sm btn-success-outline" id="changeRootFolderBtn{{requestId}}" custom-button="{{requestId}}">@*<i class="fa fa-plus"></i>*@ Change Root Folder</button>
<button type="button" class="btn btn-success-outline dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">@UI.Requests_ToggleDropdown</span>
</button>
<ul class="dropdown-menu">
{{#each rootFolders}}
<li><a href="#" class="change-root-folder" id="{{id}}" requestId="{{requestId}}">{{path}}</a></li>
{{/each}}
</ul>
</div>
{{/if_eq}}
</form>-->
<!--<form method="POST" action="@formAction/requests/changeRootFolder{{#if_eq type "tv"}}tv{{else}}movie{{/if_eq}}" id="changeFolder{{requestId}}">
<input name="requestId" type="text" value="{{requestId}}" hidden="hidden"/>
{{#if_eq hasRootFolders true}} <div *ngIf="!request.denied">
<form>
<input name="requestId" type="text" value="{{request.requestId}}" hidden="hidden" />
<input name="reason" type="text" hidden="hidden" />
<div class="btn-group btn-split"> <div class="btn-group btn-split">
<button type="button" class="btn btn-sm btn-success-outline" id="changeRootFolderBtn{{requestId}}" custom-button="{{requestId}}">@*<i class="fa fa-plus"></i>*@ Change Root Folder</button> <button type="button" (click)="deny(request)" class="btn btn-sm btn-danger-outline deny"><i class="fa fa-times"></i> Deny</button>
<button type="button" class="btn btn-success-outline dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button type="button" class="btn btn-danger-outline dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span> <span class="caret"></span>
<span class="sr-only">@UI.Requests_ToggleDropdown</span> <span class="sr-only">@UI.Requests_ToggleDropdown</span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{{#each rootFolders}} <li><a class="deny-with-reason" id="denyReason{{request.requestId}}" href="#" data-toggle="modal" data-target="#denyReasonModal">Deny with a reason</a></li>
<li><a href="#" class="change-root-folder" id="{{id}}" requestId="{{requestId}}">{{path}}</a></li>
{{/each}}
</ul> </ul>
</div> </div>
{{/if_eq}}
</form>-->
<div *ngIf="!request.denied">
<form>
<input name="requestId" type="text" value="{{request.requestId}}" hidden="hidden"/>
<input name="reason" type="text" hidden="hidden"/>
<div class="btn-group btn-split">
<button type="button" (click)="deny(request)" class="btn btn-sm btn-danger-outline deny"><i class="fa fa-times"></i> Deny</button>
<button type="button" class="btn btn-danger-outline dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">@UI.Requests_ToggleDropdown</span>
</button>
<ul class="dropdown-menu">
<li><a class="deny-with-reason" id="denyReason{{request.requestId}}" href="#" data-toggle="modal" data-target="#denyReasonModal">Deny with a reason</a></li>
</ul>
</div>
</form>
</div>
</div>
<form>
<button (click)="removeRequest(request)" style="text-align: right" class="btn btn-sm btn-danger-outline delete"><i class="fa fa-minus"></i> Remove</button>
</form>
<form>
<button *ngIf="request.available" (click)="changeAvailability(request, false)" style="text-align: right" value="false" class="btn btn-sm btn-info-outline change"><i class="fa fa-minus"></i> Mark Unavailable</button>
<button *ngIf="!request.available" (click)="changeAvailability(request, true)" style="text-align: right" value="true" class="btn btn-sm btn-success-outline change"><i class="fa fa-plus"></i> Mark Available</button>
</form> </form>
</div>
</div>
<form>
<button (click)="removeRequest(request)" style="text-align: right" class="btn btn-sm btn-danger-outline delete"><i class="fa fa-minus"></i> Remove</button>
</form>
<form>
<button *ngIf="request.available" (click)="changeAvailability(request, false)" style="text-align: right" value="false" class="btn btn-sm btn-info-outline change"><i class="fa fa-minus"></i> Mark Unavailable</button>
<button *ngIf="!request.available" (click)="changeAvailability(request, true)" style="text-align: right" value="true" class="btn btn-sm btn-success-outline change"><i class="fa fa-plus"></i> Mark Available</button>
</form>
</div>
</div>
<input name="requestId" type="text" value="{{request.requestId}}" hidden="hidden" />
<div class="dropdown">
<button id="{{request.requestId}}" class="btn btn-sm btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-plus"></i> Report Issue
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><a issue-select="0">@UI.Issues_WrongAudio</a></li>
<li><a issue-select="1">@UI.Issues_NoSubs</a></li>
<li><a issue-select="2">@UI.Issues_WrongContent</a></li>
<li><a issue-select="3">@UI.Issues_Playback</a></li>
<li><a issue-select="4" data-toggle="modal" data-target="#myModal">@UI.Issues_Other</a></li>
</ul>
</div>
<input name="requestId" type="text" value="{{request.requestId}}" hidden="hidden" />
<div class="dropdown">
<button id="{{request.requestId}}" class="btn btn-sm btn-primary-outline dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-plus"></i> Report Issue
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><a issue-select="0">@UI.Issues_WrongAudio</a></li>
<li><a issue-select="1">@UI.Issues_NoSubs</a></li>
<li><a issue-select="2">@UI.Issues_WrongContent</a></li>
<li><a issue-select="3">@UI.Issues_Playback</a></li>
<li><a issue-select="4" data-toggle="modal" data-target="#myModal">@UI.Issues_Other</a></li>
</ul>
</div> </div>
</div> </div>
<hr /> </div>
<hr />
</div>
</div> </div>
</div>

@ -53,7 +53,7 @@ export class SeriesInformationComponent implements OnInit, OnDestroy {
this.result = x as IRequestEngineResult; this.result = x as IRequestEngineResult;
if (this.result.requestAdded) { if (this.result.requestAdded) {
this.notificationService.success("Request Added", this.notificationService.success("Request Added",
`Request for ${this.series.seriesName} has been added successfully`); `Request for ${this.series.title} has been added successfully`);
} else { } else {
this.notificationService.warning("Request Added", this.result.message); this.notificationService.warning("Request Added", this.result.message);
} }

@ -44,7 +44,7 @@
<div> <div>
<a href="http://www.imdb.com/title/{{result.imdbId}}/" target="_blank"> <a href="http://www.imdb.com/title/{{result.imdbId}}/" target="_blank">
<h4>{{result.seriesName}} ({{result.firstAired}})</h4> <h4>{{result.title}} ({{result.firstAired}})</h4>
</a> </a>

@ -13,10 +13,12 @@ import { NotificationService } from '../services/notification.service';
import { ISearchTvResult } from '../interfaces/ISearchTvResult'; import { ISearchTvResult } from '../interfaces/ISearchTvResult';
import { IRequestEngineResult } from '../interfaces/IRequestEngineResult'; import { IRequestEngineResult } from '../interfaces/IRequestEngineResult';
import template from './tvsearch.component.html';
@Component({ @Component({
selector: 'tv-search', selector: 'tv-search',
moduleId: module.id, moduleId: module.id,
templateUrl: './tvsearch.component.html', template: template,
}) })
export class TvSearchComponent implements OnInit, OnDestroy { export class TvSearchComponent implements OnInit, OnDestroy {

Loading…
Cancel
Save