From 1527cbb79ad2c814cab3c5301eb6cee394645e42 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Sat, 6 Feb 2021 19:59:25 +0000 Subject: [PATCH] Added a button to clear the media data and resync --- src/Ombi/ClientApp/src/app/services/job.service.ts | 4 ++++ .../src/app/settings/emby/emby.component.html | 6 ++++++ .../src/app/settings/emby/emby.component.ts | 8 ++++++++ .../app/settings/jellyfin/jellyfin.component.html | 6 ++++++ .../src/app/settings/jellyfin/jellyfin.component.ts | 8 ++++++++ .../src/app/settings/jobs/jobs.component.html | 4 ++-- .../src/app/settings/plex/plex.component.html | 10 ++++++++-- .../src/app/settings/plex/plex.component.ts | 11 +++++++++-- .../ClientApp/src/app/settings/wiki.component.html | 2 +- src/Ombi/Controllers/V1/JobController.cs | 12 ++++++++++++ 10 files changed, 64 insertions(+), 7 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/services/job.service.ts b/src/Ombi/ClientApp/src/app/services/job.service.ts index e1915dac2..24b5e9a52 100644 --- a/src/Ombi/ClientApp/src/app/services/job.service.ts +++ b/src/Ombi/ClientApp/src/app/services/job.service.ts @@ -43,6 +43,10 @@ export class JobService extends ServiceHelpers { return this.http.post(`${this.url}plexrecentlyadded/`, {headers: this.headers}); } + public clearMediaserverData(): Observable { + return this.http.post(`${this.url}clearmediaserverdata/`, {headers: this.headers}); + } + public runEmbyCacher(): Observable { return this.http.post(`${this.url}embycontentcacher/`, {headers: this.headers}); } diff --git a/src/Ombi/ClientApp/src/app/settings/emby/emby.component.html b/src/Ombi/ClientApp/src/app/settings/emby/emby.component.html index e7dd34504..a079534f2 100644 --- a/src/Ombi/ClientApp/src/app/settings/emby/emby.component.html +++ b/src/Ombi/ClientApp/src/app/settings/emby/emby.component.html @@ -105,6 +105,12 @@ +
+ +
diff --git a/src/Ombi/ClientApp/src/app/settings/emby/emby.component.ts b/src/Ombi/ClientApp/src/app/settings/emby/emby.component.ts index df6653fd6..c01b5636f 100644 --- a/src/Ombi/ClientApp/src/app/settings/emby/emby.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/emby/emby.component.ts @@ -92,4 +92,12 @@ export class EmbyComponent implements OnInit { } }); } + + public clearDataAndResync(): void { + this.jobService.clearMediaserverData().subscribe(x => { + if (x) { + this.notificationService.success("Triggered the Clear MediaServer Resync"); + } + }); + } } diff --git a/src/Ombi/ClientApp/src/app/settings/jellyfin/jellyfin.component.html b/src/Ombi/ClientApp/src/app/settings/jellyfin/jellyfin.component.html index 66b4b39f6..ada4f5aa6 100644 --- a/src/Ombi/ClientApp/src/app/settings/jellyfin/jellyfin.component.html +++ b/src/Ombi/ClientApp/src/app/settings/jellyfin/jellyfin.component.html @@ -105,6 +105,12 @@ +
+ +
diff --git a/src/Ombi/ClientApp/src/app/settings/jellyfin/jellyfin.component.ts b/src/Ombi/ClientApp/src/app/settings/jellyfin/jellyfin.component.ts index 133ae4b39..fd65ba43c 100644 --- a/src/Ombi/ClientApp/src/app/settings/jellyfin/jellyfin.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/jellyfin/jellyfin.component.ts @@ -93,4 +93,12 @@ export class JellyfinComponent implements OnInit { } }); } + + public clearDataAndResync(): void { + this.jobService.clearMediaserverData().subscribe(x => { + if (x) { + this.notificationService.success("Triggered the Clear MediaServer Resync"); + } + }); + } } diff --git a/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.html b/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.html index f51c5626e..03780b264 100644 --- a/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.html +++ b/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.html @@ -1,11 +1,11 @@  - +
Job Settings
Changes require a restart.

- You can generate valid CRON Expressions here: https://www.cronmaker.com/ + You can generate valid CRON Expressions here: https://www.cronmaker.com/

diff --git a/src/Ombi/ClientApp/src/app/settings/plex/plex.component.html b/src/Ombi/ClientApp/src/app/settings/plex/plex.component.html index 6ade3261d..3b05e4585 100644 --- a/src/Ombi/ClientApp/src/app/settings/plex/plex.component.html +++ b/src/Ombi/ClientApp/src/app/settings/plex/plex.component.html @@ -158,15 +158,21 @@
-
-
+
+ +
diff --git a/src/Ombi/ClientApp/src/app/settings/plex/plex.component.ts b/src/Ombi/ClientApp/src/app/settings/plex/plex.component.ts index 7509fb45a..dc2352999 100644 --- a/src/Ombi/ClientApp/src/app/settings/plex/plex.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/plex/plex.component.ts @@ -73,10 +73,9 @@ export class PlexComponent implements OnInit, OnDestroy { } public addTab(event: MatTabChangeEvent) { - const tabName = event.tab.textLabel; if (tabName == "Add Server"){ - + if (this.settings.servers == null) { this.settings.servers = []; } @@ -146,6 +145,14 @@ export class PlexComponent implements OnInit, OnDestroy { }); } + public clearDataAndResync(): void { + this.jobService.clearMediaserverData().subscribe(x => { + if (x) { + this.notificationService.success("Triggered the Clear MediaServer Resync"); + } + }); + } + public ngOnDestroy() { this.subscriptions.next(); this.subscriptions.complete(); diff --git a/src/Ombi/ClientApp/src/app/settings/wiki.component.html b/src/Ombi/ClientApp/src/app/settings/wiki.component.html index fe12a1a19..d34ce82ff 100644 --- a/src/Ombi/ClientApp/src/app/settings/wiki.component.html +++ b/src/Ombi/ClientApp/src/app/settings/wiki.component.html @@ -2,7 +2,7 @@ diff --git a/src/Ombi/Controllers/V1/JobController.cs b/src/Ombi/Controllers/V1/JobController.cs index b8ae1446b..e182e1239 100644 --- a/src/Ombi/Controllers/V1/JobController.cs +++ b/src/Ombi/Controllers/V1/JobController.cs @@ -9,6 +9,7 @@ using Ombi.Schedule.Jobs.Emby; using Ombi.Schedule.Jobs.Jellyfin; using Ombi.Schedule.Jobs.Ombi; using Ombi.Schedule.Jobs.Plex; +using Ombi.Schedule.Jobs.Plex.Interfaces; using Ombi.Schedule.Jobs.Radarr; using Quartz; @@ -125,6 +126,17 @@ namespace Ombi.Controllers.V1 return true; } + /// + /// Clear out the media server and resync + /// + /// + [HttpPost("clearmediaserverdata")] + public bool ClearMediaServerData() + { + OmbiQuartz.Scheduler.TriggerJob(new JobKey(nameof(IMediaDatabaseRefresh), "System")); + return true; + } + /// /// Runs a smaller version of the content cacher ///