1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-22 07:42:28 +00:00

New: URL Base setting for Media Server connections

Plus some translations

(cherry picked from commit 9fd193d2a82d5c2cdc0f36c1f984e4b6b68aaa8d)
This commit is contained in:
Mark McDowall 2024-02-27 21:03:35 -08:00 committed by Bogdan
parent fb1b7274d0
commit f6529d5ad3
6 changed files with 63 additions and 21 deletions

View file

@ -225,6 +225,7 @@
"ConnectionLost": "Connection Lost",
"ConnectionLostReconnect": "{appName} will try to connect automatically, or you can click reload below.",
"ConnectionLostToBackend": "{appName} has lost its connection to the backend and will need to be reloaded to restore functionality.",
"ConnectionSettingsUrlBaseHelpText": "Adds a prefix to the {connectionName} url, such as {url}",
"Connections": "Connections",
"Continuing": "Continuing",
"ContinuingAllTracksDownloaded": "Continuing (All tracks downloaded)",
@ -771,6 +772,25 @@
"NotificationStatusAllClientHealthCheckMessage": "All notifications are unavailable due to failures",
"NotificationStatusSingleClientHealthCheckMessage": "Notifications unavailable due to failures: {0}",
"NotificationTriggers": "Notification Triggers",
"NotificationsEmbySettingsSendNotifications": "Send Notifications",
"NotificationsEmbySettingsSendNotificationsHelpText": "Have MediaBrowser send notifications to configured providers",
"NotificationsEmbySettingsUpdateLibraryHelpText": "Update Library on Import, Rename, or Delete?",
"NotificationsKodiSettingAlwaysUpdate": "Always Update",
"NotificationsKodiSettingAlwaysUpdateHelpText": "Update library even when a video is playing?",
"NotificationsKodiSettingsCleanLibrary": "Clean Library",
"NotificationsKodiSettingsCleanLibraryHelpText": "Clean library after update",
"NotificationsKodiSettingsDisplayTime": "Display Time",
"NotificationsKodiSettingsDisplayTimeHelpText": "How long the notification will be displayed for (In seconds)",
"NotificationsKodiSettingsGuiNotification": "GUI Notification",
"NotificationsKodiSettingsUpdateLibraryHelpText": "Update library on Import & Rename?",
"NotificationsPlexSettingsAuthToken": "Auth Token",
"NotificationsPlexSettingsAuthenticateWithPlexTv": "Authenticate with Plex.tv",
"NotificationsSettingsUpdateLibrary": "Update Library",
"NotificationsSettingsUpdateMapPathsFrom": "Map Paths From",
"NotificationsSettingsUpdateMapPathsFromHelpText": "{appName} path, used to modify series paths when {serviceName} sees library path location differently from {appName} (Requires 'Update Library')",
"NotificationsSettingsUpdateMapPathsTo": "Map Paths To",
"NotificationsSettingsUpdateMapPathsToHelpText": "{serviceName} path, used to modify series paths when {serviceName} sees library path location differently from {appName} (Requires 'Update Library')",
"NotificationsSettingsUseSslHelpText": "Connect to {serviceName} over HTTPS instead of HTTP",
"Ok": "Ok",
"OnAlbumDelete": "On Album Delete",
"OnApplicationUpdate": "On Application Update",
@ -1228,6 +1248,7 @@
"UrlBaseHelpTextWarning": "Requires restart to take effect",
"UseHardlinksInsteadOfCopy": "Use Hardlinks instead of Copy",
"UseProxy": "Use Proxy",
"UseSsl": "Use SSL",
"Usenet": "Usenet",
"UsenetDelay": "Usenet Delay",
"UsenetDelayHelpText": "Delay in minutes to wait before grabbing a release from Usenet",

View file

@ -44,7 +44,7 @@ public ValidationFailure Test(MediaBrowserSettings settings)
{
try
{
_logger.Debug("Testing connection to MediaBrowser: {0}", settings.Address);
_logger.Debug("Testing connection to Emby/Jellyfin : {0}", settings.Address);
Notify(settings, "Test from Lidarr", "Success! MediaBrowser has been successfully configured!");
}

View file

@ -13,6 +13,7 @@ public MediaBrowserSettingsValidator()
{
RuleFor(c => c.Host).ValidHost();
RuleFor(c => c.ApiKey).NotEmpty();
RuleFor(c => c.UrlBase).ValidUrlBase();
}
}
@ -31,20 +32,26 @@ public MediaBrowserSettings()
[FieldDefinition(1, Label = "Port")]
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 = "UseSsl", Type = FieldType.Checkbox, HelpText = "NotificationsSettingsUseSslHelpText")]
[FieldToken(TokenField.HelpText, "UseSsl", "serviceName", "Emby/Jellyfin")]
public bool UseSsl { get; set; }
[FieldDefinition(3, Label = "API Key", Privacy = PrivacyLevel.ApiKey)]
[FieldDefinition(3, Label = "UrlBase", Type = FieldType.Textbox, Advanced = true, HelpText = "ConnectionSettingsUrlBaseHelpText")]
[FieldToken(TokenField.HelpText, "UrlBase", "connectionName", "Emby/Jellyfin")]
[FieldToken(TokenField.HelpText, "UrlBase", "url", "http://[host]:[port]/[urlBase]/mediabrowser")]
public string UrlBase { get; set; }
[FieldDefinition(4, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey)]
public string ApiKey { get; set; }
[FieldDefinition(4, Label = "Send Notifications", HelpText = "Have MediaBrowser send notifications to configured providers", Type = FieldType.Checkbox)]
[FieldDefinition(5, Label = "NotificationsEmbySettingsSendNotifications", HelpText = "NotificationsEmbySettingsSendNotificationsHelpText", Type = FieldType.Checkbox)]
public bool Notify { get; set; }
[FieldDefinition(5, Label = "Update Library", HelpText = "Update Library on Import, Rename, & Delete?", Type = FieldType.Checkbox)]
[FieldDefinition(6, Label = "NotificationsSettingsUpdateLibrary", HelpText = "NotificationsEmbySettingsUpdateLibraryHelpText", Type = FieldType.Checkbox)]
public bool UpdateLibrary { get; set; }
[JsonIgnore]
public string Address => $"{Host.ToUrlHost()}:{Port}";
public string Address => $"{Host.ToUrlHost()}:{Port}{UrlBase}";
public bool IsValid => !string.IsNullOrWhiteSpace(Host) && Port > 0;

View file

@ -94,7 +94,7 @@ private HttpRequestBuilder BuildRequest(string resource, HttpMethod method, Plex
{
var scheme = settings.UseSsl ? "https" : "http";
var requestBuilder = new HttpRequestBuilder($"{scheme}://{settings.Host.ToUrlHost()}:{settings.Port}")
var requestBuilder = new HttpRequestBuilder($"{scheme}://{settings.Host.ToUrlHost()}:{settings.Port}{settings.UrlBase}")
.Accept(HttpAccept.Json)
.AddQueryParam("X-Plex-Client-Identifier", _configService.PlexClientIdentifier)
.AddQueryParam("X-Plex-Product", BuildInfo.AppName)

View file

@ -34,22 +34,30 @@ public PlexServerSettings()
[FieldDefinition(1, Label = "Port")]
public int Port { get; set; }
[FieldDefinition(2, Label = "Use SSL", Type = FieldType.Checkbox, HelpText = "Connect to Plex over HTTPS instead of HTTP")]
[FieldDefinition(2, Label = "UseSsl", Type = FieldType.Checkbox, HelpText = "NotificationsSettingsUseSslHelpText")]
[FieldToken(TokenField.HelpText, "UseSsl", "serviceName", "Plex")]
public bool UseSsl { get; set; }
[FieldDefinition(3, Label = "Auth Token", Type = FieldType.Textbox, Privacy = PrivacyLevel.ApiKey, Advanced = true)]
[FieldDefinition(3, Label = "UrlBase", Type = FieldType.Textbox, Advanced = true, HelpText = "ConnectionSettingsUrlBaseHelpText")]
[FieldToken(TokenField.HelpText, "UrlBase", "connectionName", "Plex")]
[FieldToken(TokenField.HelpText, "UrlBase", "url", "http://[host]:[port]/[urlBase]/plex")]
public string UrlBase { get; set; }
[FieldDefinition(4, Label = "NotificationsPlexSettingsAuthToken", Type = FieldType.Textbox, Privacy = PrivacyLevel.ApiKey, Advanced = true)]
public string AuthToken { get; set; }
[FieldDefinition(4, Label = "Authenticate with Plex.tv", Type = FieldType.OAuth)]
[FieldDefinition(5, Label = "NotificationsPlexSettingsAuthenticateWithPlexTv", Type = FieldType.OAuth)]
public string SignIn { get; set; }
[FieldDefinition(5, Label = "Update Library", Type = FieldType.Checkbox)]
[FieldDefinition(6, Label = "NotificationsSettingsUpdateLibrary", Type = FieldType.Checkbox)]
public bool UpdateLibrary { get; set; }
[FieldDefinition(6, Label = "Map Paths From", Type = FieldType.Textbox, Advanced = true, HelpText = "Lidarr path, used to modify series paths when Plex sees library path location differently from Lidarr")]
[FieldDefinition(7, Label = "NotificationsSettingsUpdateMapPathsFrom", Type = FieldType.Textbox, Advanced = true, HelpText = "NotificationsSettingsUpdateMapPathsFromHelpText")]
[FieldToken(TokenField.HelpText, "NotificationsSettingsUpdateMapPathsFrom", "serviceName", "Plex")]
public string MapFrom { get; set; }
[FieldDefinition(7, Label = "Map Paths To", Type = FieldType.Textbox, Advanced = true, HelpText = "Plex path, used to modify series paths when Plex sees library path location differently from Lidarr")]
[FieldDefinition(8, Label = "NotificationsSettingsUpdateMapPathsTo", Type = FieldType.Textbox, Advanced = true, HelpText = "NotificationsSettingsUpdateMapPathsToHelpText")]
[FieldToken(TokenField.HelpText, "NotificationsSettingsUpdateMapPathsTo", "serviceName", "Plex")]
public string MapTo { get; set; }
public bool IsValid => !string.IsNullOrWhiteSpace(Host);

View file

@ -33,29 +33,35 @@ public XbmcSettings()
[FieldDefinition(1, Label = "Port")]
public int Port { get; set; }
[FieldDefinition(2, Label = "Use SSL", Type = FieldType.Checkbox, HelpText = "Connect to Kodi over HTTPS instead of HTTP")]
[FieldDefinition(2, Label = "UseSsl", Type = FieldType.Checkbox, HelpText = "NotificationsSettingsUseSslHelpText")]
[FieldToken(TokenField.HelpText, "UseSsl", "serviceName", "Kodi")]
public bool UseSsl { get; set; }
[FieldDefinition(3, Label = "Username", Privacy = PrivacyLevel.UserName)]
[FieldDefinition(3, Label = "UrlBase", Type = FieldType.Textbox, Advanced = true, HelpText = "ConnectionSettingsUrlBaseHelpText")]
[FieldToken(TokenField.HelpText, "UrlBase", "connectionName", "Kodi")]
[FieldToken(TokenField.HelpText, "UrlBase", "url", "http://[host]:[port]/[urlBase]/kodi")]
public string UrlBase { get; set; }
[FieldDefinition(4, Label = "Username", Privacy = PrivacyLevel.UserName)]
public string Username { get; set; }
[FieldDefinition(4, Label = "Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)]
[FieldDefinition(5, Label = "Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)]
public string Password { get; set; }
[DefaultValue(5)]
[FieldDefinition(5, Label = "Display Time", HelpText = "How long the notification will be displayed for (In seconds)")]
[FieldDefinition(6, Label = "NotificationsKodiSettingsDisplayTime", HelpText = "NotificationsKodiSettingsDisplayTimeHelpText")]
public int DisplayTime { get; set; }
[FieldDefinition(6, Label = "GUI Notification", Type = FieldType.Checkbox)]
[FieldDefinition(7, Label = "NotificationsKodiSettingsGuiNotification", Type = FieldType.Checkbox)]
public bool Notify { get; set; }
[FieldDefinition(7, Label = "Update Library", HelpText = "Update Library on Import & Rename?", Type = FieldType.Checkbox)]
[FieldDefinition(8, Label = "NotificationsSettingsUpdateLibrary", HelpText = "NotificationsKodiSettingsUpdateLibraryHelpText", Type = FieldType.Checkbox)]
public bool UpdateLibrary { get; set; }
[FieldDefinition(8, Label = "Clean Library", HelpText = "Clean Library after update?", Type = FieldType.Checkbox)]
[FieldDefinition(9, Label = "NotificationsKodiSettingsCleanLibrary", HelpText = "NotificationsKodiSettingsCleanLibraryHelpText", Type = FieldType.Checkbox)]
public bool CleanLibrary { get; set; }
[FieldDefinition(9, Label = "Always Update", HelpText = "Update Library even when a file is playing?", Type = FieldType.Checkbox)]
[FieldDefinition(10, Label = "NotificationsKodiSettingAlwaysUpdate", HelpText = "NotificationsKodiSettingAlwaysUpdateHelpText", Type = FieldType.Checkbox)]
public bool AlwaysUpdate { get; set; }
[JsonIgnore]