diff --git a/src/Ombi.Core/Rule/Rules/Search/EmbyAvailabilityRule.cs b/src/Ombi.Core/Rule/Rules/Search/EmbyAvailabilityRule.cs index 343681e29..75b6633bb 100644 --- a/src/Ombi.Core/Rule/Rules/Search/EmbyAvailabilityRule.cs +++ b/src/Ombi.Core/Rule/Rules/Search/EmbyAvailabilityRule.cs @@ -70,11 +70,11 @@ namespace Ombi.Core.Rule.Rules.Search var server = s.Servers.FirstOrDefault(x => x.ServerHostname != null); if ((server?.ServerHostname ?? string.Empty).HasValue()) { - obj.EmbyUrl = EmbyHelper.GetEmbyMediaUrl(item.EmbyId, server?.ServerHostname, s.IsJellyfin); + obj.EmbyUrl = EmbyHelper.GetEmbyMediaUrl(item.EmbyId, server?.ServerId, server?.ServerHostname, s.IsJellyfin); } else { - obj.EmbyUrl = EmbyHelper.GetEmbyMediaUrl(item.EmbyId, null, s.IsJellyfin); + obj.EmbyUrl = EmbyHelper.GetEmbyMediaUrl(item.EmbyId, server?.ServerId, null, s.IsJellyfin); } } diff --git a/src/Ombi.Helpers.Tests/EmbyHelperTests.cs b/src/Ombi.Helpers.Tests/EmbyHelperTests.cs index 746bd1d5f..261ba87cc 100644 --- a/src/Ombi.Helpers.Tests/EmbyHelperTests.cs +++ b/src/Ombi.Helpers.Tests/EmbyHelperTests.cs @@ -9,15 +9,17 @@ namespace Ombi.Helpers.Tests public class EmbyHelperTests { [TestCaseSource(nameof(UrlData))] - public string TestUrl(string mediaId, string url) + public string TestUrl(string mediaId, string url, string serverId) { - return EmbyHelper.GetEmbyMediaUrl(mediaId, url); + // http://192.168.68.X:8096/web/index.html#!/item?id=17980&serverId=4e7a85e6ed0b49b9a6d6d15e739a566b + return EmbyHelper.GetEmbyMediaUrl(mediaId, serverId, url); } [TestCaseSource(nameof(JellyfinUrlData))] - public string TestJellyfinUrl(string mediaId, string url) + public string TestJellyfinUrl(string mediaId, string url, string serverId) { - return EmbyHelper.GetEmbyMediaUrl(mediaId, url, true); + // http://192.168.68.X:8097/web/index.html#!/details?id=7ffe222498445d5ebfddb31bc4fa9a6d&serverId=50cce67f0baa425093d189b3017331fb + return EmbyHelper.GetEmbyMediaUrl(mediaId, serverId, url, true); } public static IEnumerable UrlData @@ -25,10 +27,10 @@ namespace Ombi.Helpers.Tests get { var mediaId = 1; - yield return new TestCaseData(mediaId.ToString(), "http://google.com").Returns($"http://google.com/#!/item?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash"); - yield return new TestCaseData(mediaId.ToString(), "http://google.com/").Returns($"http://google.com/#!/item?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain"); - yield return new TestCaseData(mediaId.ToString(), "https://google.com/").Returns($"https://google.com/#!/item?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_Https"); - yield return new TestCaseData(mediaId.ToString(), string.Empty).Returns($"https://app.emby.media/#!/item?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithOutCustomDomain"); + yield return new TestCaseData(mediaId.ToString(), "http://google.com", "1").Returns($"http://google.com/web/index.html#!/item?id={mediaId}&serverId=1").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash"); + yield return new TestCaseData(mediaId.ToString(), "http://google.com/", "1").Returns($"http://google.com/web/index.html#!/item?id={mediaId}&serverId=1").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain"); + yield return new TestCaseData(mediaId.ToString(), "https://google.com/", "1").Returns($"https://google.com/web/index.html#!/item?id={mediaId}&serverId=1").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_Https"); + yield return new TestCaseData(mediaId.ToString(), string.Empty, "1").Returns($"https://app.emby.media/web/index.html#!/item?id={mediaId}&serverId=1").SetName("EmbyHelper_GetMediaUrl_WithOutCustomDomain"); } } @@ -37,9 +39,9 @@ namespace Ombi.Helpers.Tests get { var mediaId = 1; - yield return new TestCaseData(mediaId.ToString(), "http://google.com").Returns($"http://google.com/#!/itemdetails.html?id={mediaId}").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash"); - yield return new TestCaseData(mediaId.ToString(), "http://google.com/").Returns($"http://google.com/#!/itemdetails.html?id={mediaId}").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain"); - yield return new TestCaseData(mediaId.ToString(), "https://google.com/").Returns($"https://google.com/#!/itemdetails.html?id={mediaId}").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain_Https"); + yield return new TestCaseData(mediaId.ToString(), "http://google.com", "1").Returns($"http://google.com/web/index.html#!/details?id={mediaId}&serverId=1").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash"); + yield return new TestCaseData(mediaId.ToString(), "http://google.com/", "1").Returns($"http://google.com/web/index.html#!/details?id={mediaId}&serverId=1").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain"); + yield return new TestCaseData(mediaId.ToString(), "https://google.com/", "1").Returns($"https://google.com/web/index.html#!/details?id={mediaId}&serverId=1").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain_Https"); } } } diff --git a/src/Ombi.Helpers/EmbyHelper.cs b/src/Ombi.Helpers/EmbyHelper.cs index 61716cd4b..4d2bcfc57 100644 --- a/src/Ombi.Helpers/EmbyHelper.cs +++ b/src/Ombi.Helpers/EmbyHelper.cs @@ -2,24 +2,25 @@ { public class EmbyHelper { - public static string GetEmbyMediaUrl(string mediaId, string customerServerUrl = null, bool isJellyfin = false) + public static string GetEmbyMediaUrl(string mediaId, string serverId, string customerServerUrl = null, bool isJellyfin = false) { + //web/index.html#!/details|item string path = "item"; if (isJellyfin) { - path = "itemdetails.html"; + path = "details"; } if (customerServerUrl.HasValue()) { if (!customerServerUrl.EndsWith("/")) { - return $"{customerServerUrl}/#!/{path}?id={mediaId}"; + return $"{customerServerUrl}/web/index.html#!/{path}?id={mediaId}&serverId={serverId}"; } - return $"{customerServerUrl}#!/{path}?id={mediaId}"; + return $"{customerServerUrl}web/index.html#!/{path}?id={mediaId}&serverId={serverId}"; } else { - return $"https://app.emby.media/#!/{path}?id={mediaId}"; + return $"https://app.emby.media/web/index.html#!/{path}?id={mediaId}&serverId={serverId}"; } } } diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs index c886a3db3..f8bde2755 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyContentSync.cs @@ -145,7 +145,7 @@ namespace Ombi.Schedule.Jobs.Emby Title = tvShow.Name, Type = EmbyMediaType.Series, EmbyId = tvShow.Id, - Url = EmbyHelper.GetEmbyMediaUrl(tvShow.Id, server.ServerHostname, settings.IsJellyfin), + Url = EmbyHelper.GetEmbyMediaUrl(tvShow.Id, server?.ServerId, server.ServerHostname, settings.IsJellyfin), AddedAt = DateTime.UtcNow }); } @@ -186,7 +186,7 @@ namespace Ombi.Schedule.Jobs.Emby Title = movieInfo.Name, Type = EmbyMediaType.Movie, EmbyId = movieInfo.Id, - Url = EmbyHelper.GetEmbyMediaUrl(movieInfo.Id, server.ServerHostname), + Url = EmbyHelper.GetEmbyMediaUrl(movieInfo.Id, server?.ServerId, server.ServerHostname), AddedAt = DateTime.UtcNow, }); } diff --git a/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs b/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs index 3ade5746b..b3ffce0e1 100644 --- a/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs +++ b/src/Ombi.Settings/Settings/Models/External/EmbySettings.cs @@ -12,6 +12,7 @@ namespace Ombi.Core.Settings.Models.External public class EmbyServers : ExternalSettings { + public string ServerId { get; set; } public string Name { get; set; } public string ApiKey { get; set; } public string AdministratorId { get; set; } diff --git a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts index 976a0f95f..0656bb1db 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/ISettings.ts @@ -41,6 +41,7 @@ export interface IEmbySettings extends ISettings { } export interface IEmbyServer extends IExternalSettings { + serverId: string; name: string; apiKey: string; administratorId: string; @@ -49,6 +50,7 @@ export interface IEmbyServer extends IExternalSettings { } export interface IPublicInfo { + id: string; serverName: string; isJellyfin: boolean; } 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 57f1a24e4..e6d35b1c1 100644 --- a/src/Ombi/ClientApp/src/app/settings/emby/emby.component.html +++ b/src/Ombi/ClientApp/src/app/settings/emby/emby.component.html @@ -30,19 +30,24 @@ - +
Hostname / IP - - + +
+ + Server ID + + +
Port - + SSL 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 895beb957..5db2d1120 100644 --- a/src/Ombi/ClientApp/src/app/settings/emby/emby.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/emby/emby.component.ts @@ -2,7 +2,7 @@ import { IEmbyServer, IEmbySettings } from "../../interfaces"; import { EmbyService, JobService, NotificationService, SettingsService, TesterService } from "../../services"; -import { MatTabChangeEvent, MatTabGroup } from "@angular/material/tabs"; +import { MatTabChangeEvent } from "@angular/material/tabs"; import {FormControl} from '@angular/forms'; @Component({ @@ -29,6 +29,7 @@ export class EmbyComponent implements OnInit { const result = await this.embyService.getPublicInfo(server).toPromise(); this.settings.isJellyfin = result.isJellyfin; server.name = result.serverName; + server.serverId = result.id; this.hasDiscoveredOrDirty = true; } diff --git a/src/Ombi/ClientApp/src/app/wizard/emby/emby.component.ts b/src/Ombi/ClientApp/src/app/wizard/emby/emby.component.ts index 5e8f1b2ef..58d5dd3f6 100644 --- a/src/Ombi/ClientApp/src/app/wizard/emby/emby.component.ts +++ b/src/Ombi/ClientApp/src/app/wizard/emby/emby.component.ts @@ -35,7 +35,7 @@ export class EmbyComponent implements OnInit { ssl: false, subDir: "", serverHostname: "", - + serverId: undefined }); } diff --git a/src/Ombi/databasej.json b/src/Ombi/databasej.json deleted file mode 100644 index 7c77dd61a..000000000 --- a/src/Ombi/databasej.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "OmbiDatabase": { - "Type": "MySQL", - "ConnectionString": "Server=192.168.68.118;Database=app.ombi.io;User=ombi" - }, - "SettingsDatabase": { - "Type": "MySQL", - "ConnectionString": "Server=192.168.68.118;Database=app.ombi.io;User=ombi" - }, - "ExternalDatabase": { - "Type": "MySQL", - "ConnectionString": "Server=192.168.68.118;Database=app.ombi.io;User=ombi" - } - } \ No newline at end of file