Some series information stuff, changes the pace theme too.

pull/1425/head
Jamie.Rees 7 years ago
parent fa5efb6c66
commit 7064afb780

@ -59,14 +59,33 @@ namespace Ombi.Core.Engine
foreach (var e in episodes)
{
var season = mapped.SeasonRequests.FirstOrDefault(x => x.SeasonNumber == e.season);
season?.Episodes.Add(new EpisodesRequested
if (season == null)
{
Url = e.url,
Title = e.name,
AirDate = DateTime.Parse(e.airstamp),
EpisodeNumber = e.number,
var newSeason = new SeasonRequestModel
{
SeasonNumber = e.season,
};
newSeason.Episodes.Add(new EpisodesRequested
{
Url = e.url,
Title = e.name,
AirDate = DateTime.Parse(e.airstamp),
EpisodeNumber = e.number,
});
mapped.SeasonRequests.Add(newSeason);
});
}
else
{
season.Episodes.Add(new EpisodesRequested
{
Url = e.url,
Title = e.name,
AirDate = DateTime.Parse(e.airstamp),
EpisodeNumber = e.number,
});
}
}
var existingRequests = await GetTvRequests();

@ -17,6 +17,7 @@
<ItemGroup>
<ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" />
<ProjectReference Include="..\Ombi.Api.Sonarr\Ombi.Api.Sonarr.csproj" />
<ProjectReference Include="..\Ombi.Api.Trakt\Ombi.Api.Trakt.csproj" />
<ProjectReference Include="..\Ombi.Api.TvMaze\Ombi.Api.TvMaze.csproj" />
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />

@ -0,0 +1,84 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Ombi.Api.Sonarr;
using Ombi.Core.Models.Requests;
using Ombi.Core.Settings.Models.External;
namespace Ombi.Core
{
public class TvSender
{
public TvSender(ISonarrApi sonarrApi, ILogger<TvSender> log)
{
SonarrApi = sonarrApi;
Logger = log;
}
private ISonarrApi SonarrApi { get; }
private ILogger<TvSender> Logger { get; }
//public async Task<SonarrAddSeries> SendToSonarr(SonarrSettings sonarrSettings, TvRequestModel model,
// string qualityId)
//{
// var qualityProfile = 0;
// if (!string.IsNullOrEmpty(qualityId)) // try to parse the passed in quality, otherwise use the settings default quality
// {
// int.TryParse(qualityId, out qualityProfile);
// }
// if (qualityProfile <= 0)
// {
// int.TryParse(sonarrSettings.QualityProfile, out qualityProfile);
// }
// var rootFolderPath = model.RootFolderSelected <= 0 ? sonarrSettings.FullRootPath : await GetSonarrRootPath(model.RootFolderSelected, sonarrSettings);
// //var episodeRequest = model.Episodes.Any();
// //var requestAll = model.SeasonsRequested?.Equals("All", StringComparison.CurrentCultureIgnoreCase);
// //var first = model.SeasonsRequested?.Equals("First", StringComparison.CurrentCultureIgnoreCase);
// //var latest = model.SeasonsRequested?.Equals("Latest", StringComparison.CurrentCultureIgnoreCase);
// //var specificSeasonRequest = model.SeasonList?.Any();
// //if (episodeRequest)
// //{
// // return await ProcessSonarrEpisodeRequest(sonarrSettings, model, qualityProfile, rootFolderPath);
// //}
// //if (requestAll ?? false)
// //{
// // return await ProcessSonarrRequestSeason(sonarrSettings, model, qualityProfile, rootFolderPath);
// //}
// //if (first ?? false)
// //{
// // return await ProcessSonarrRequestSeason(sonarrSettings, model, qualityProfile, rootFolderPath);
// //}
// //if (latest ?? false)
// //{
// // return await ProcessSonarrRequestSeason(sonarrSettings, model, qualityProfile, rootFolderPath);
// //}
// //if (specificSeasonRequest ?? false)
// //{
// // return await ProcessSonarrRequestSeason(sonarrSettings, model, qualityProfile, rootFolderPath);
// //}
// return null;
//}
private async Task<string> GetSonarrRootPath(int pathId, SonarrSettings sonarrSettings)
{
var rootFoldersResult = await SonarrApi.GetRootFolders(sonarrSettings.ApiKey, sonarrSettings.FullUri);
foreach (var r in rootFoldersResult.Where(r => r.id == pathId))
{
return r.path;
}
return string.Empty;
}
}
}

@ -6,7 +6,7 @@
<title>Ombi</title>
<base href="@Url.Content("~/")" />
<script src="@Url.Content("~/lib/pace.js")?v=@ViewBag.AssemblyVersion"></script>
<link href="@Url.Content("~/css/lib/pace-theme-minimal.css")" rel="stylesheet" />
<link href="@Url.Content("~/css/lib/pace-theme-flash.css")" rel="stylesheet" />
<link href="@Url.Content("~/css/base.css")" rel="stylesheet" type="text/css"/>
<link href="@Url.Content("~/css/Themes/plex.css")" rel="stylesheet" type="text/css" />
@*<link href="@Url.Content("~/css/lib/primeng.css")" rel="stylesheet" />*@

@ -34,6 +34,7 @@ var paths = {
'@angular/router',
'@angular/forms',
'@angular/platform-browser/animations',
'@angular/material',
'ngx-infinite-scroll'
],
dest: './lib'
@ -62,8 +63,13 @@ var paths = {
libcss: [ // Normal css files to be copied
{
src: [
'./bower_components/PACE/themes/purple/pace-theme-minimal.css',
'./bower_components/font-awesome/css/font-awesome.css',
'./bower_components/PACE/themes/orange/pace-theme-barber-shop.css',
'./bower_components/PACE/themes/orange/pace-theme-big-counter.css',
'./bower_components/PACE/themes/orange/pace-theme-fill-left.css',
'./bower_components/PACE/themes/orange/pace-theme-flash.css',
'./bower_components/PACE/themes/orange/pace-theme-flat-top.css',
'./bower_components/PACE/themes/orange/pace-theme-loading-bar.css',
'./node_modules/primeng/resources/primeng.css',
'./node_modules/tether/dist/css/tether.css'
],

@ -10,6 +10,7 @@
"@angular/core": "^4.1.0",
"@angular/forms": "^4.1.0",
"@angular/http": "^4.1.0",
"@angular/material": "^2.0.0-beta.3",
"@angular/platform-browser": "^4.1.0",
"@angular/platform-browser-dynamic": "^4.1.0",
"@angular/platform-server": "^4.1.0",

@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { MdButtonModule} from '@angular/material';
import { AppComponent } from './app.component';
@ -73,7 +74,8 @@ const routes: Routes = [
InfiniteScrollModule,
AuthModule,
WizardModule,
DialogModule
DialogModule,
MdButtonModule
],
declarations: [
AppComponent,

@ -21,7 +21,7 @@ export interface ISearchTvResult {
siteRating: number,
trailer: string,
homepage:string,
seasonsRequested: ISeasonRequests[],
seasonsRequests: ISeasonRequests[],
requestAll:boolean,
approved: boolean,
requested: boolean,

@ -1,64 +1,66 @@
<div *ngIf="series">
<div *ngFor="let season of series.seasonsRequested">
<div *ngFor="let season of series.seasonRequests;">
<h2>Season: {{season.seasonNumber}}</h2>
<table class="table table-striped table-hover table-responsive table-condensed">
<thead>
<tr>
<th>
<a>
#
</a>
</th>
<th>
<a>
Title
</a>
</th>
<th>
<a>
Air Date
</a>
</th>
<th>
<a>
Status
</a>
</th>
</tr>
<tr>
<th>
<a>
#
</a>
</th>
<th>
<a>
Title
</a>
</th>
<th>
<a>
Air Date
</a>
</th>
<th>
<a>
Status
</a>
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let ep of season.episodes">
<td>
{{ep.episodeNumber}}
</td>
<td>
{{ep.title}}
</td>
<td>
{{ep.airDate | date: 'dd/MM/yyyy' }}
</td>
<td>
<span *ngIf="result.available" class="label label-success">Available</span>
<span *ngIf="result.approved && !result.available" class="label label-info">Processing Request</span>
<div *ngIf="result.requested && !result.available; then requested else notRequested"></div>
<template #requested>
<span *ngIf="!result.available" class="label label-warning">Pending Approval</span>
</template>
<tr *ngFor="let ep of season.episodes">
<td>
{{ep.episodeNumber}}
</td>
<td>
{{ep.title}}
</td>
<td>
{{ep.airDate | date: 'dd/MM/yyyy' }}
</td>
<td>
<span *ngIf="ep.available" class="label label-success">Available</span>
<span *ngIf="ep.approved && !ep.available" class="label label-info">Processing Request</span>
<div *ngIf="ep.requested && !ep.available; then requested else notRequested"></div>
<template #requested>
<span *ngIf="!ep.available" class="label label-warning">Pending Approval</span>
</template>
<template #notRequested>
<span *ngIf="!result.available" class="label label-danger">Not Yet Requested</span>
</template>
</td>
<td>
<a (click)="edit(u)" class="btn btn-sm btn-info-outline">Details/Edit</a>
</td>
</tr>
<template #notRequested>
<span *ngIf="!ep.available" class="label label-danger">Not Yet Requested</span>
</template>
</td>
<td>
<button (click)="addRequest(ep)" [disabled]="ep.available || ep.requested || ep.approved" class="btn btn-sm btn-info-outline">Request</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

@ -10,7 +10,7 @@ import { NotificationService } from '../services/notification.service';
import { ISearchTvResult } from '../interfaces/ISearchTvResult';
import { IRequestEngineResult } from '../interfaces/IRequestEngineResult';
import { IEpisodesRequested } from"../interfaces/IRequestModel";
@Component({
selector: 'ombi',
moduleId: module.id,
@ -33,12 +33,14 @@ export class SeriesInformationComponent implements OnInit, OnDestroy {
seriesId: number;
series: ISearchTvResult;
requestedEpisodes: IEpisodesRequested[] = [];
ngOnInit(): void {
this.searchService.getShowInformation(this.seriesId)
.takeUntil(this.subscriptions)
.subscribe(x => {
this.series = x;
this.series = x as ISearchTvResult;
});
}
@ -48,7 +50,7 @@ export class SeriesInformationComponent implements OnInit, OnDestroy {
this.requestService.requestTv(this.series)
.takeUntil(this.subscriptions)
.subscribe(x => {
this.result = x;
this.result = x as IRequestEngineResult;
if (this.result.requestAdded) {
this.notificationService.success("Request Added",
`Request for ${this.series.seriesName} has been added successfully`);
@ -58,6 +60,11 @@ export class SeriesInformationComponent implements OnInit, OnDestroy {
});
}
addRequest(episode: IEpisodesRequested) {
this.requestedEpisodes.push(episode);
episode.requested = true;
}
ngOnDestroy(): void {

Loading…
Cancel
Save