Added path mappings for Jellyfin/Emby connections
This commit is contained in:
parent
9d384d92f1
commit
a798ff3dcc
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using FluentValidation.Results;
|
using FluentValidation.Results;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Common.Disk;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
|
@ -46,7 +48,14 @@ namespace NzbDrone.Core.Notifications.Emby
|
||||||
|
|
||||||
foreach (var path in paths)
|
foreach (var path in paths)
|
||||||
{
|
{
|
||||||
_proxy.Update(settings, path, updateType);
|
var mappedPath = new OsPath(path);
|
||||||
|
|
||||||
|
if (settings.MapTo.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
mappedPath = new OsPath(settings.MapTo) + (mappedPath - new OsPath(settings.MapFrom));
|
||||||
|
}
|
||||||
|
|
||||||
|
_proxy.Update(settings, mappedPath.ToString(), updateType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ namespace NzbDrone.Core.Notifications.Emby
|
||||||
{
|
{
|
||||||
RuleFor(c => c.Host).ValidHost();
|
RuleFor(c => c.Host).ValidHost();
|
||||||
RuleFor(c => c.ApiKey).NotEmpty();
|
RuleFor(c => c.ApiKey).NotEmpty();
|
||||||
|
RuleFor(c => c.MapFrom).NotEmpty().Unless(c => c.MapTo.IsNullOrWhiteSpace());
|
||||||
|
RuleFor(c => c.MapTo).NotEmpty().Unless(c => c.MapFrom.IsNullOrWhiteSpace());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +33,7 @@ namespace NzbDrone.Core.Notifications.Emby
|
||||||
[FieldDefinition(1, Label = "Port")]
|
[FieldDefinition(1, Label = "Port")]
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(2, Label = "Use SSL", Type = FieldType.Checkbox, HelpText = "Connect to Emby over HTTPS instead of HTTP")]
|
[FieldDefinition(2, Label = "Use SSL", Type = FieldType.Checkbox, HelpText = "Connect to Emby/Jellyfin over HTTPS instead of HTTP")]
|
||||||
public bool UseSsl { get; set; }
|
public bool UseSsl { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(3, Label = "API Key", Privacy = PrivacyLevel.ApiKey)]
|
[FieldDefinition(3, Label = "API Key", Privacy = PrivacyLevel.ApiKey)]
|
||||||
|
@ -46,6 +48,12 @@ namespace NzbDrone.Core.Notifications.Emby
|
||||||
[FieldDefinition(5, Label = "Update Library By Name", HelpText = "Update Library by name rather than path(Requires 'UpdateLibrary')", Type = FieldType.Checkbox, Advanced = true)]
|
[FieldDefinition(5, Label = "Update Library By Name", HelpText = "Update Library by name rather than path(Requires 'UpdateLibrary')", Type = FieldType.Checkbox, Advanced = true)]
|
||||||
public bool UpdateLibraryByName { get; set; }
|
public bool UpdateLibraryByName { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(5, Label = "Map Paths From", HelpText = "Sonarr path, used to modify series paths when Emby/Jellyfin sees library path location differently from Sonarr(Requires 'UpdateLibrary')", Type = FieldType.Textbox, Advanced = true)]
|
||||||
|
public string MapFrom { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(5, Label = "Map Paths To", HelpText = "Emby/Jellyfin path, used to modify series paths when Emby/Jellyfin sees library path location differently from Sonarr(Requires 'UpdateLibrary')", Type = FieldType.Textbox, Advanced = true)]
|
||||||
|
public string MapTo { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string Address => $"{Host.ToUrlHost()}:{Port}";
|
public string Address => $"{Host.ToUrlHost()}:{Port}";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue