pull/3848/head
tidusjar 4 years ago
parent ae414f4815
commit 96abeb5861

@ -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);
}
}

@ -9,15 +9,15 @@ 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);
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);
return EmbyHelper.GetEmbyMediaUrl(mediaId, serverId, url, true);
}
public static IEnumerable<TestCaseData> UrlData
@ -25,10 +25,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/#!/item?id={mediaId}&serverId=1").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash");
yield return new TestCaseData(mediaId.ToString(), "http://google.com/", "1").Returns($"http://google.com/#!/item?id={mediaId}&serverId=1").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain");
yield return new TestCaseData(mediaId.ToString(), "https://google.com/", "1").Returns($"https://google.com/#!/item?id={mediaId}&serverId=1").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_Https");
yield return new TestCaseData(mediaId.ToString(), string.Empty, "1").Returns($"https://app.emby.media/#!/item?id={mediaId}&serverId=1").SetName("EmbyHelper_GetMediaUrl_WithOutCustomDomain");
}
}
@ -37,9 +37,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/#!/itemdetails.html?id={mediaId}&serverId=1").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash");
yield return new TestCaseData(mediaId.ToString(), "http://google.com/", "1").Returns($"http://google.com/#!/itemdetails.html?id={mediaId}&serverId=1").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain");
yield return new TestCaseData(mediaId.ToString(), "https://google.com/", "1").Returns($"https://google.com/#!/itemdetails.html?id={mediaId}&serverId=1").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain_Https");
}
}
}

@ -2,7 +2,7 @@
{
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)
{
string path = "item";
if (isJellyfin)
@ -13,13 +13,13 @@
{
if (!customerServerUrl.EndsWith("/"))
{
return $"{customerServerUrl}/#!/{path}?id={mediaId}";
return $"{customerServerUrl}/#!/{path}?id={mediaId}&serverId={serverId}";
}
return $"{customerServerUrl}#!/{path}?id={mediaId}";
return $"{customerServerUrl}#!/{path}?id={mediaId}&serverId={serverId}";
}
else
{
return $"https://app.emby.media/#!/{path}?id={mediaId}";
return $"https://app.emby.media/#!/{path}?id={mediaId}&serverId={serverId}";
}
}
}

@ -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,
});
}

@ -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; }

@ -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;
}

@ -30,19 +30,24 @@
<input matInput placeholder="Server Name" [(ngModel)]="server.name" value="{{server.name}}">
</mat-form-field>
</div>
<div class="md-form-field">
<mat-form-field appearance="outline" floatLabel=auto>
<mat-label>Server ID</mat-label>
<input matInput placeholder="Server Id" [(ngModel)]="server.serverId" value="{{server.serverId}}">
</mat-form-field>
</div>
<div class="md-form-field">
<mat-form-field appearance="outline" floatLabel=auto>
<mat-label>Hostname / IP</mat-label>
<input matInput placeholder="Hostname or IP" [(ngModel)]="server.ip" value="{{server.ip}}">
</mat-form-field>
<mat-form-field appearance="outline" floatLabel=auto>
<mat-label>Port</mat-label>
<input matInput placeholder="Port" [(ngModel)]="server.port" value="{{server.port}}">
</mat-form-field>
<mat-slide-toggle id="ssl" [(ngModel)]="server.ssl" [checked]="server.ssl">
SSL
</mat-slide-toggle>

@ -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;
}

@ -35,7 +35,7 @@ export class EmbyComponent implements OnInit {
ssl: false,
subDir: "",
serverHostname: "",
serverId: undefined
});
}

@ -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"
}
}
Loading…
Cancel
Save