-
-
\ No newline at end of file
diff --git a/src/Ombi/ClientApp/src/app/settings/emby/emby.component.scss b/src/Ombi/ClientApp/src/app/settings/emby/emby.component.scss
index 649201f48..8bba2e3bf 100644
--- a/src/Ombi/ClientApp/src/app/settings/emby/emby.component.scss
+++ b/src/Ombi/ClientApp/src/app/settings/emby/emby.component.scss
@@ -1,41 +1,29 @@
@import "~styles/shared.scss";
.small-middle-container {
- margin: auto;
- width: 95%;
- margin-top: 10px;
+ margin: auto;
+ width: 95%;
+ margin-top: 10px;
}
-.col-md-10 {
- display: grid;
-}
+.emby-server-card {
+ margin: 0em 1em 1em 0;
+ width: 13em;
+ min-height: 8em;
-.col-md-2 {
- display: contents;
-}
+ button {
+ text-align: center;
+ align-content: center;
+ white-space: normal;
+ overflow-wrap: anywhere;
+ height: 100%;
+ width: 100%;
+ }
-.control-label {
- font-weight: 400;
-}
+ i {
+ margin-top: 0.25em;
+ }
-.row {
- display: block;
+ h3 {
+ margin: 0;
+ }
}
-
-.btn-danger-outline {
- background-color: #E84C3D;
-}
-
-.btn-success-outline {
- background-color: #1b9d1b;
-}
-
-::ng-deep .dark .btn:hover {
- box-shadow: 0 5px 11px 0 rgba(255, 255, 255, 0.18), 0 4px 15px 0 rgba(255, 255, 255, 0.15);
- color: inherit;
-}
-
-@media (min-width:1440px) {
- .col-md-2 {
- display: inline-table;
- }
-}
\ No newline at end of file
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 f9e22c976..86a22ed18 100644
--- a/src/Ombi/ClientApp/src/app/settings/emby/emby.component.ts
+++ b/src/Ombi/ClientApp/src/app/settings/emby/emby.component.ts
@@ -1,136 +1,163 @@
import { Component, OnInit } from "@angular/core";
-import { EmbyService, JobService, NotificationService, SettingsService, TesterService } from "../../services";
-import { IEmbyLibrariesSettings, IEmbyServer, IEmbySettings } from "../../interfaces";
-
-import {UntypedFormControl} from '@angular/forms';
-import { MatTabChangeEvent } from "@angular/material/tabs";
+import {
+ JobService,
+ NotificationService,
+ SettingsService,
+} from "../../services";
+import { IEmbyServer, IEmbySettings } from "../../interfaces";
+import { MatSlideToggleChange } from "@angular/material/slide-toggle";
+import { MatDialog } from "@angular/material/dialog";
+import {
+ EmbyServerDialog,
+ EmbyServerDialogData,
+} from "./emby-server-dialog/emby-server-dialog.component";
@Component({
- templateUrl: "./emby.component.html",
- styleUrls: ["./emby.component.scss"]
+ templateUrl: "./emby.component.html",
+ styleUrls: ["./emby.component.scss"],
})
export class EmbyComponent implements OnInit {
+ public savedSettings: IEmbySettings;
+ public currentSettings: IEmbySettings;
- public settings: IEmbySettings;
- public hasDiscoveredOrDirty: boolean;
- selected = new UntypedFormControl(0);
+ constructor(
+ private settingsService: SettingsService,
+ private notificationService: NotificationService,
+ private jobService: JobService,
+ private dialog: MatDialog
+ ) {}
- constructor(private settingsService: SettingsService,
- private notificationService: NotificationService,
- private testerService: TesterService,
- private jobService: JobService,
- private embyService: EmbyService) { }
+ public ngOnInit() {
+ this.settingsService.getEmby().subscribe({
+ next: (result) => {
+ if (result.servers == null) result.servers = [];
+ this.savedSettings = result;
+ this.currentSettings = result;
+ },
+ error: () => {
+ this.notificationService.error("Failed to retrieve Emby settings.");
+ },
+ });
+ }
- public ngOnInit() {
- this.settingsService.getEmby().subscribe(x => this.settings = x);
- }
-
- public async discoverServerInfo(server: IEmbyServer) {
- const result = await this.embyService.getPublicInfo(server).toPromise();
- server.name = result.serverName;
- server.serverId = result.id;
- this.hasDiscoveredOrDirty = true;
- }
-
- public addTab(event: MatTabChangeEvent) {
- const tabName = event.tab.textLabel;
- if (tabName == "Add Server"){
- if (this.settings.servers == null) {
- this.settings.servers = [];
- }
- this.settings.servers.push({
- name: "New " + this.settings.servers.length + "*",
- id: Math.floor(Math.random() * (99999 - 0 + 1) + 1),
- apiKey: "",
- administratorId: "",
- enableEpisodeSearching: false,
- ip: "",
- port: 0,
- ssl: false,
- subDir: "",
- } as IEmbyServer);
- this.selected.setValue(this.settings.servers.length - 1);
+ public toggleEnableFlag(event: MatSlideToggleChange) {
+ const newSettings: IEmbySettings = structuredClone(this.savedSettings);
+ newSettings.enable = event.checked;
+ const errorMessage = "There was an error saving Emby settings.";
+ this.settingsService.saveEmby(newSettings).subscribe({
+ next: (result) => {
+ if (result) {
+ this.savedSettings.enable = event.checked;
+ this.notificationService.success(
+ `Successfully ${
+ event.checked ? "enabled" : "disabled"
+ } Emby settings.`
+ );
+ } else {
+ this.notificationService.error(errorMessage);
}
- }
+ },
+ error: () => {
+ this.notificationService.error(errorMessage);
+ },
+ });
+ }
- public toggle() {
- this.hasDiscoveredOrDirty = true;
- }
+ public newServer() {
+ const newServer: IEmbyServer = {
+ name: "",
+ id: Math.floor(Math.random() * 99999 + 1),
+ apiKey: "",
+ administratorId: "",
+ enableEpisodeSearching: false,
+ ip: "",
+ port: undefined,
+ ssl: false,
+ subDir: "",
+ serverId: "",
+ serverHostname: "",
+ embySelectedLibraries: [],
+ };
+ const data: EmbyServerDialogData = {
+ server: newServer,
+ isNewServer: true,
+ savedSettings: this.savedSettings,
+ };
+ const dialog = this.dialog.open(EmbyServerDialog, {
+ width: "700px",
+ data: data,
+ panelClass: "modal-panel",
+ });
+ dialog.afterClosed().subscribe((x) => {
+ return console.log(x);
+ });
+ }
- public test(server: IEmbyServer) {
- this.testerService.embyTest(server).subscribe(x => {
- if (x === true) {
- this.notificationService.success(`Successfully connected to the Emby server ${server.name}!`);
- } else {
- this.notificationService.error(`We could not connect to the Emby server ${server.name}!`);
- }
- });
- }
+ public editServer(server: IEmbyServer) {
+ const data: EmbyServerDialogData = {
+ server: server,
+ isNewServer: false,
+ savedSettings: this.savedSettings,
+ };
+ const dialog = this.dialog.open(EmbyServerDialog, {
+ width: "700px",
+ data: data,
+ panelClass: "modal-panel",
+ });
+ dialog.afterClosed().subscribe((x) => {
+ console.log(server);
+ return console.log(x);
+ });
+ }
- public removeServer(server: IEmbyServer) {
- const index = this.settings.servers.indexOf(server, 0);
- if (index > -1) {
- this.settings.servers.splice(index, 1);
- this.selected.setValue(this.settings.servers.length - 1);
- this.toggle();
+ public runIncrementalSync(): void {
+ const errorMessage = "There was an error triggering the incremental sync.";
+ this.jobService.runEmbyRecentlyAddedCacher().subscribe({
+ next: (result) => {
+ if (result) {
+ this.notificationService.success("Triggered the incremental sync.");
+ } else {
+ this.notificationService.error(errorMessage);
}
- }
+ },
+ error: () => {
+ this.notificationService.error(errorMessage);
+ },
+ });
+ }
- public save() {
- this.settingsService.saveEmby(this.settings).subscribe(x => {
- if (x) {
- this.notificationService.success("Successfully saved Emby settings");
- } else {
- this.notificationService.success("There was an error when saving the Emby settings");
- }
- });
- }
-
- public runCacher(): void {
- this.jobService.runEmbyCacher().subscribe(x => {
- if(x) {
- this.notificationService.success("Triggered the Emby Content Cacher");
- }
- });
- }
-
- public runRecentlyAddedCacher(): void {
- this.jobService.runEmbyRecentlyAddedCacher().subscribe(x => {
- if (x) {
- this.notificationService.success("Triggered the Emby Recently Added Sync");
- }
- });
- }
-
- public clearDataAndResync(): void {
- this.jobService.clearMediaserverData().subscribe(x => {
- if (x) {
- this.notificationService.success("Triggered the Clear MediaServer Resync");
- }
- });
- }
-
- public loadLibraries(server: IEmbyServer) {
- if (server.ip == null) {
- this.notificationService.error("Emby is not yet configured correctly");
- return;
+ public runFullSync(): void {
+ const errorMessage = "There was an error triggering the full sync.";
+ this.jobService.runEmbyCacher().subscribe({
+ next: (result) => {
+ if (result) {
+ this.notificationService.success("Triggered the full sync.");
+ } else {
+ this.notificationService.error(errorMessage);
}
- this.embyService.getLibraries(server).subscribe(x => {
- server.embySelectedLibraries = [];
- if (x.totalRecordCount > 0) {
- x.items.forEach((item) => {
- const lib: IEmbyLibrariesSettings = {
- key: item.id,
- title: item.name,
- enabled: false,
- collectionType: item.collectionType
- };
- server.embySelectedLibraries.push(lib);
- });
- } else {
- this.notificationService.error("Couldn't find any libraries");
- }
- },
- err => { this.notificationService.error(err); });
- }
+ },
+ error: () => {
+ this.notificationService.error(errorMessage);
+ },
+ });
+ }
+
+ public runCacheWipeWithFullSync(): void {
+ const errorMessage =
+ "There was an error triggering the cache wipe with a full sync.";
+ this.jobService.clearMediaserverData().subscribe({
+ next: (result) => {
+ if (result) {
+ this.notificationService.success(
+ "Triggered the cache wipe with a full sync."
+ );
+ } else {
+ this.notificationService.error(errorMessage);
+ }
+ },
+ error: () => {
+ this.notificationService.error(errorMessage);
+ },
+ });
+ }
}
diff --git a/src/Ombi/ClientApp/src/app/settings/settings.module.ts b/src/Ombi/ClientApp/src/app/settings/settings.module.ts
index a1b530f11..6ff076621 100644
--- a/src/Ombi/ClientApp/src/app/settings/settings.module.ts
+++ b/src/Ombi/ClientApp/src/app/settings/settings.module.ts
@@ -37,6 +37,7 @@ import { DiscordComponent } from "./notifications/discord.component";
import { DogNzbComponent } from "./dognzb/dognzb.component";
import { EmailNotificationComponent } from "./notifications/emailnotification.component";
import { EmbyComponent } from "./emby/emby.component";
+import { EmbyServerDialog } from "./emby/emby-server-dialog/emby-server-dialog.component";
import { FailedRequestsComponent } from "./failedrequests/failedrequests.component";
import { FeaturesComponent } from "./features/features.component";
import { GotifyComponent } from "./notifications/gotify.component";
@@ -153,6 +154,7 @@ const routes: Routes = [
OmbiComponent,
PlexComponent,
EmbyComponent,
+ EmbyServerDialog,
JellyfinComponent,
JobsComponent,
LandingPageComponent,