mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Some series information stuff, changes the pace theme too.
This commit is contained in:
parent
fa5efb6c66
commit
7064afb780
10 changed files with 186 additions and 64 deletions
|
@ -59,7 +59,25 @@ namespace Ombi.Core.Engine
|
||||||
foreach (var e in episodes)
|
foreach (var e in episodes)
|
||||||
{
|
{
|
||||||
var season = mapped.SeasonRequests.FirstOrDefault(x => x.SeasonNumber == e.season);
|
var season = mapped.SeasonRequests.FirstOrDefault(x => x.SeasonNumber == e.season);
|
||||||
season?.Episodes.Add(new EpisodesRequested
|
if (season == null)
|
||||||
|
{
|
||||||
|
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,
|
Url = e.url,
|
||||||
Title = e.name,
|
Title = e.name,
|
||||||
|
@ -68,6 +86,7 @@ namespace Ombi.Core.Engine
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var existingRequests = await GetTvRequests();
|
var existingRequests = await GetTvRequests();
|
||||||
var plexSettings = await PlexSettings.GetSettingsAsync();
|
var plexSettings = await PlexSettings.GetSettingsAsync();
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" />
|
<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.Trakt\Ombi.Api.Trakt.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.TvMaze\Ombi.Api.TvMaze.csproj" />
|
<ProjectReference Include="..\Ombi.Api.TvMaze\Ombi.Api.TvMaze.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
|
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
|
||||||
|
|
84
Ombi/Ombi.Core/TvSender.cs
Normal file
84
Ombi/Ombi.Core/TvSender.cs
Normal file
|
@ -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>
|
<title>Ombi</title>
|
||||||
<base href="@Url.Content("~/")" />
|
<base href="@Url.Content("~/")" />
|
||||||
<script src="@Url.Content("~/lib/pace.js")?v=@ViewBag.AssemblyVersion"></script>
|
<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/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/Themes/plex.css")" rel="stylesheet" type="text/css" />
|
||||||
@*<link href="@Url.Content("~/css/lib/primeng.css")" rel="stylesheet" />*@
|
@*<link href="@Url.Content("~/css/lib/primeng.css")" rel="stylesheet" />*@
|
||||||
|
|
|
@ -34,6 +34,7 @@ var paths = {
|
||||||
'@angular/router',
|
'@angular/router',
|
||||||
'@angular/forms',
|
'@angular/forms',
|
||||||
'@angular/platform-browser/animations',
|
'@angular/platform-browser/animations',
|
||||||
|
'@angular/material',
|
||||||
'ngx-infinite-scroll'
|
'ngx-infinite-scroll'
|
||||||
],
|
],
|
||||||
dest: './lib'
|
dest: './lib'
|
||||||
|
@ -62,8 +63,13 @@ var paths = {
|
||||||
libcss: [ // Normal css files to be copied
|
libcss: [ // Normal css files to be copied
|
||||||
{
|
{
|
||||||
src: [
|
src: [
|
||||||
'./bower_components/PACE/themes/purple/pace-theme-minimal.css',
|
|
||||||
'./bower_components/font-awesome/css/font-awesome.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/primeng/resources/primeng.css',
|
||||||
'./node_modules/tether/dist/css/tether.css'
|
'./node_modules/tether/dist/css/tether.css'
|
||||||
],
|
],
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"@angular/core": "^4.1.0",
|
"@angular/core": "^4.1.0",
|
||||||
"@angular/forms": "^4.1.0",
|
"@angular/forms": "^4.1.0",
|
||||||
"@angular/http": "^4.1.0",
|
"@angular/http": "^4.1.0",
|
||||||
|
"@angular/material": "^2.0.0-beta.3",
|
||||||
"@angular/platform-browser": "^4.1.0",
|
"@angular/platform-browser": "^4.1.0",
|
||||||
"@angular/platform-browser-dynamic": "^4.1.0",
|
"@angular/platform-browser-dynamic": "^4.1.0",
|
||||||
"@angular/platform-server": "^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 { BrowserModule } from '@angular/platform-browser';
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { MdButtonModule} from '@angular/material';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
|
@ -73,7 +74,8 @@ const routes: Routes = [
|
||||||
InfiniteScrollModule,
|
InfiniteScrollModule,
|
||||||
AuthModule,
|
AuthModule,
|
||||||
WizardModule,
|
WizardModule,
|
||||||
DialogModule
|
DialogModule,
|
||||||
|
MdButtonModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
|
|
|
@ -21,7 +21,7 @@ export interface ISearchTvResult {
|
||||||
siteRating: number,
|
siteRating: number,
|
||||||
trailer: string,
|
trailer: string,
|
||||||
homepage:string,
|
homepage:string,
|
||||||
seasonsRequested: ISeasonRequests[],
|
seasonsRequests: ISeasonRequests[],
|
||||||
requestAll:boolean,
|
requestAll:boolean,
|
||||||
approved: boolean,
|
approved: boolean,
|
||||||
requested: boolean,
|
requested: boolean,
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<div *ngIf="series">
|
<div *ngIf="series">
|
||||||
|
|
||||||
<div *ngFor="let season of series.seasonsRequested">
|
|
||||||
|
|
||||||
|
<div *ngFor="let season of series.seasonRequests;">
|
||||||
<h2>Season: {{season.seasonNumber}}</h2>
|
<h2>Season: {{season.seasonNumber}}</h2>
|
||||||
|
|
||||||
<table class="table table-striped table-hover table-responsive table-condensed">
|
<table class="table table-striped table-hover table-responsive table-condensed">
|
||||||
|
@ -40,25 +42,25 @@
|
||||||
{{ep.airDate | date: 'dd/MM/yyyy' }}
|
{{ep.airDate | date: 'dd/MM/yyyy' }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span *ngIf="result.available" class="label label-success">Available</span>
|
<span *ngIf="ep.available" class="label label-success">Available</span>
|
||||||
<span *ngIf="result.approved && !result.available" class="label label-info">Processing Request</span>
|
<span *ngIf="ep.approved && !ep.available" class="label label-info">Processing Request</span>
|
||||||
<div *ngIf="result.requested && !result.available; then requested else notRequested"></div>
|
<div *ngIf="ep.requested && !ep.available; then requested else notRequested"></div>
|
||||||
<template #requested>
|
<template #requested>
|
||||||
<span *ngIf="!result.available" class="label label-warning">Pending Approval</span>
|
<span *ngIf="!ep.available" class="label label-warning">Pending Approval</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #notRequested>
|
<template #notRequested>
|
||||||
<span *ngIf="!result.available" class="label label-danger">Not Yet Requested</span>
|
<span *ngIf="!ep.available" class="label label-danger">Not Yet Requested</span>
|
||||||
</template>
|
</template>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<a (click)="edit(u)" class="btn btn-sm btn-info-outline">Details/Edit</a>
|
|
||||||
|
<button (click)="addRequest(ep)" [disabled]="ep.available || ep.requested || ep.approved" class="btn btn-sm btn-info-outline">Request</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
|
@ -10,7 +10,7 @@ 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 { IEpisodesRequested } from"../interfaces/IRequestModel";
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ombi',
|
selector: 'ombi',
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
|
@ -33,12 +33,14 @@ export class SeriesInformationComponent implements OnInit, OnDestroy {
|
||||||
seriesId: number;
|
seriesId: number;
|
||||||
series: ISearchTvResult;
|
series: ISearchTvResult;
|
||||||
|
|
||||||
|
requestedEpisodes: IEpisodesRequested[] = [];
|
||||||
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.searchService.getShowInformation(this.seriesId)
|
this.searchService.getShowInformation(this.seriesId)
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
.subscribe(x => {
|
.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)
|
this.requestService.requestTv(this.series)
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
this.result = x;
|
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.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 {
|
ngOnDestroy(): void {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue