mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
Fixed the duplicate notifications
This commit is contained in:
parent
913197ac18
commit
062ba2419b
7 changed files with 49 additions and 51 deletions
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
using Quartz.Impl;
|
using Quartz.Impl;
|
||||||
|
@ -15,6 +16,8 @@ namespace Ombi.Helpers
|
||||||
|
|
||||||
public static IScheduler Scheduler => Instance._scheduler;
|
public static IScheduler Scheduler => Instance._scheduler;
|
||||||
|
|
||||||
|
private static SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
// Singleton
|
// Singleton
|
||||||
protected static OmbiQuartz _instance;
|
protected static OmbiQuartz _instance;
|
||||||
|
|
||||||
|
@ -84,10 +87,20 @@ namespace Ombi.Helpers
|
||||||
|
|
||||||
public static async Task TriggerJob(string jobName, string group)
|
public static async Task TriggerJob(string jobName, string group)
|
||||||
{
|
{
|
||||||
if (!(await IsJobRunning(jobName)))
|
await _semaphore.WaitAsync();
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await Scheduler.TriggerJob(new JobKey(jobName, group));
|
if (!(await IsJobRunning(jobName)))
|
||||||
|
{
|
||||||
|
await Scheduler.TriggerJob(new JobKey(jobName, group));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_semaphore.Release();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Store.Entities.Requests;
|
using Ombi.Store.Entities.Requests;
|
||||||
|
@ -31,7 +32,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
|
|
||||||
var today = DateTime.UtcNow.Date;
|
var today = DateTime.UtcNow.Date;
|
||||||
|
|
||||||
var resolved = _issuesRepository.GetAll().Where(x => x.Status == IssueStatus.Resolved);
|
var resolved = await _issuesRepository.GetAll().Where(x => x.Status == IssueStatus.Resolved).ToListAsync();
|
||||||
var toDelete = resolved.Where(x => x.ResovledDate.HasValue && (today - x.ResovledDate.Value.Date).TotalDays >= settings.DaysAfterResolvedToDelete);
|
var toDelete = resolved.Where(x => x.ResovledDate.HasValue && (today - x.ResovledDate.Value.Date).TotalDays >= settings.DaysAfterResolvedToDelete);
|
||||||
|
|
||||||
foreach (var d in toDelete)
|
foreach (var d in toDelete)
|
||||||
|
|
|
@ -115,34 +115,13 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
|
|
||||||
if ((processedContent?.HasProcessedContent ?? false) && recentlyAddedSearch)
|
if ((processedContent?.HasProcessedContent ?? false) && recentlyAddedSearch)
|
||||||
{
|
{
|
||||||
// Ensure it's not already running
|
await NotifyClient("Plex Sync - Checking if any requests are now available");
|
||||||
if (await OmbiQuartz.IsJobRunning(nameof(IPlexAvailabilityChecker)))
|
Logger.LogInformation("Kicking off Plex Availability Checker");
|
||||||
{
|
await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex");
|
||||||
Logger.LogInformation("Availability checker already running");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await NotifyClient("Plex Sync - Checking if any requests are now available");
|
|
||||||
Logger.LogInformation("Kicking off Plex Availability Checker");
|
|
||||||
await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((processedContent?.HasProcessedContent ?? false) && recentlyAddedSearch)
|
|
||||||
{
|
|
||||||
// Ensure it's not already running
|
|
||||||
if (await OmbiQuartz.IsJobRunning(nameof(IPlexAvailabilityChecker)))
|
|
||||||
{
|
|
||||||
Logger.LogInformation("Availability checker already running");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var processedCont = processedContent?.Content?.Count() ?? 0;
|
var processedCont = processedContent?.Content?.Count() ?? 0;
|
||||||
var processedEp = processedContent?.Episodes?.Count() ?? 0;
|
var processedEp = processedContent?.Episodes?.Count() ?? 0;
|
||||||
Logger.LogInformation("Finished Plex Content Cacher, with processed content: {0}, episodes: {1}. Recently Added Scan: {2}", processedContent, processedEp, recentlyAddedSearch);
|
Logger.LogInformation("Finished Plex Content Cacher, with processed content: {0}, episodes: {1}. Recently Added Scan: {2}", processedCont, processedEp, recentlyAddedSearch);
|
||||||
|
|
||||||
await NotifyClient(recentlyAddedSearch ? $"Plex Recently Added Sync Finished, We processed {processedCont}, and {processedEp} Episodes" : "Plex Content Sync Finished");
|
await NotifyClient(recentlyAddedSearch ? $"Plex Recently Added Sync Finished, We processed {processedCont}, and {processedEp} Episodes" : "Plex Content Sync Finished");
|
||||||
|
|
||||||
|
|
|
@ -76,14 +76,14 @@
|
||||||
<div class="col-12 col-md-2">
|
<div class="col-12 col-md-2">
|
||||||
<mat-card class="mat-elevation-z8 spacing-below" *ngIf="isAdmin && movieRequest" [ngStyle]="{'display': showAdvanced ? '' : 'none' }">
|
<mat-card class="mat-elevation-z8 spacing-below" *ngIf="isAdmin && movieRequest" [ngStyle]="{'display': showAdvanced ? '' : 'none' }">
|
||||||
<mat-card-content class="medium-font">
|
<mat-card-content class="medium-font">
|
||||||
<movie-admin-panel [movie]="movieRequest" (radarrEnabledChange)="showAdvanced = $event" (advancedOptionsChange)="setAdvancedOptions($event)">
|
<movie-admin-panel [movie]="movieRequest" (radarrEnabledChange)="showAdvanced = $event" (advancedOptionsChanged)="setAdvancedOptions($event)">
|
||||||
</movie-admin-panel>
|
</movie-admin-panel>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
||||||
<mat-card class="mat-elevation-z8">
|
<mat-card class="mat-elevation-z8">
|
||||||
<mat-card-content class="medium-font">
|
<mat-card-content class="medium-font">
|
||||||
<movie-information-panel [movie]="movie" [advancedOptions]="advancedOptions"></movie-information-panel>
|
<movie-information-panel [movie]="movie" [request]="movieRequest"></movie-information-panel>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
||||||
|
|
|
@ -33,14 +33,13 @@ export class MovieDetailsComponent {
|
||||||
public messageService: MessageService, private auth: AuthService,
|
public messageService: MessageService, private auth: AuthService,
|
||||||
private storage: StorageService) {
|
private storage: StorageService) {
|
||||||
this.route.params.subscribe((params: any) => {
|
this.route.params.subscribe((params: any) => {
|
||||||
debugger;
|
if (typeof params.movieDbId === 'string' || params.movieDbId instanceof String) {
|
||||||
if (typeof params.movieDbId === 'string' || params.movieDbId instanceof String) {
|
if (params.movieDbId.startsWith("tt")) {
|
||||||
if (params.movieDbId.startsWith("tt")) {
|
this.imdbId = params.movieDbId;
|
||||||
this.imdbId = params.movieDbId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.theMovidDbId = params.movieDbId;
|
}
|
||||||
this.load();
|
this.theMovidDbId = params.movieDbId;
|
||||||
|
this.load();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,22 +96,22 @@ export class MovieDetailsComponent {
|
||||||
public async deny() {
|
public async deny() {
|
||||||
const dialogRef = this.dialog.open(DenyDialogComponent, {
|
const dialogRef = this.dialog.open(DenyDialogComponent, {
|
||||||
width: '250px',
|
width: '250px',
|
||||||
data: {requestId: this.movieRequest.id, requestType: RequestType.movie}
|
data: { requestId: this.movieRequest.id, requestType: RequestType.movie }
|
||||||
});
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
this.movieRequest.denied = result;
|
this.movieRequest.denied = result;
|
||||||
if(this.movieRequest.denied) {
|
if (this.movieRequest.denied) {
|
||||||
this.movie.approved = false;
|
this.movie.approved = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async issue() {
|
public async issue() {
|
||||||
const dialogRef = this.dialog.open(NewIssueComponent, {
|
const dialogRef = this.dialog.open(NewIssueComponent, {
|
||||||
width: '500px',
|
width: '500px',
|
||||||
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}
|
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 }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async approve() {
|
public async approve() {
|
||||||
|
@ -126,7 +125,7 @@ export class MovieDetailsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async markAvailable() {
|
public async markAvailable() {
|
||||||
const result = await this.requestService.markMovieAvailable({id: this.movieRequest.id}).toPromise();
|
const result = await this.requestService.markMovieAvailable({ id: this.movieRequest.id }).toPromise();
|
||||||
if (result.result) {
|
if (result.result) {
|
||||||
this.movie.available = true;
|
this.movie.available = true;
|
||||||
this.messageService.send(result.message, "Ok");
|
this.messageService.send(result.message, "Ok");
|
||||||
|
@ -135,7 +134,13 @@ export class MovieDetailsComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public setAdvancedOptions(data: any) {
|
public setAdvancedOptions(data: IAdvancedData) {
|
||||||
this.advancedOptions = data;
|
this.advancedOptions = data;
|
||||||
|
if (data.rootFolderId) {
|
||||||
|
this.movieRequest.qualityOverrideTitle = data.rootFolders.filter(x => x.id == data.rootFolderId)[0].path;
|
||||||
|
}
|
||||||
|
if (data.profileId) {
|
||||||
|
this.movieRequest.rootPathOverrideTitle = data.profiles.filter(x => x.id == data.profileId)[0].name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
|
|
||||||
<div *ngIf="advancedOptions">
|
<div *ngIf="advancedOptions">
|
||||||
<strong>{{'MediaDetails.RootFolderOverride' | translate }}</strong>
|
<strong>{{'MediaDetails.RootFolderOverride' | translate }}</strong>
|
||||||
<div>{{advancedOptions.rootFolder.path}}</div>
|
<div>{{request.rootPathOverrideTitle}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="advancedOptions">
|
<div *ngIf="advancedOptions">
|
||||||
<strong>{{'MediaDetails.QualityOverride' | translate }}</strong>
|
<strong>{{'MediaDetails.QualityOverride' | translate }}</strong>
|
||||||
<div>{{advancedOptions.profile.name}}</div>
|
<div>{{request.qualityOverrideTitle}}</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div *ngIf="movie.genres">
|
<div *ngIf="movie.genres">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Component, ViewEncapsulation, Input } from "@angular/core";
|
import { Component, ViewEncapsulation, Input } from "@angular/core";
|
||||||
import { ISearchMovieResultV2 } from "../../../../interfaces/ISearchMovieResultV2";
|
import { ISearchMovieResultV2 } from "../../../../interfaces/ISearchMovieResultV2";
|
||||||
import { IAdvancedData } from "../../../../interfaces";
|
import { IAdvancedData, IMovieRequests } from "../../../../interfaces";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "./movie-information-panel.component.html",
|
templateUrl: "./movie-information-panel.component.html",
|
||||||
|
@ -10,5 +10,5 @@ import { IAdvancedData } from "../../../../interfaces";
|
||||||
})
|
})
|
||||||
export class MovieInformationPanelComponent {
|
export class MovieInformationPanelComponent {
|
||||||
@Input() public movie: ISearchMovieResultV2;
|
@Input() public movie: ISearchMovieResultV2;
|
||||||
@Input() public advancedOptions: IAdvancedData;
|
@Input() public request: IMovieRequests;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue