[FieldDefinition(1, Label = "LazyLibrarian Server", HelpText = "URL used to connect to LazyLibrarian server, including http(s)://, port, and urlbase if required", Placeholder = "http://localhost:5299")]
publicstringBaseUrl{get;set;}
[FieldDefinition(2, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by LazyLibrarian in Settings/Web Interface")]
[FieldDefinition(2, Label = "API Key", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by LazyLibrarian in Settings/Web Interface")]
publicstringApiKey{get;set;}
[FieldDefinition(3, Label = "Sync Categories", Type = FieldType.Select, SelectOptions = typeof(NewznabCategoryFieldConverter), Advanced = true, HelpText = "Only Indexers that support these categories will be synced")]
[FieldDefinition(1, Label = "Lidarr Server", HelpText = "URL used to connect to Lidarr server, including http(s)://, port, and urlbase if required", Placeholder = "http://localhost:8686")]
publicstringBaseUrl{get;set;}
[FieldDefinition(2, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Lidarr in Settings/General")]
[FieldDefinition(2, Label = "API Key", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Lidarr in Settings/General")]
publicstringApiKey{get;set;}
[FieldDefinition(3, Label = "Sync Categories", Type = FieldType.Select, SelectOptions = typeof(NewznabCategoryFieldConverter), Advanced = true, HelpText = "Only Indexers that support these categories will be synced")]
returnnewValidationFailure(string.Empty,$"Lidarr version should be at least {MinimumApplicationVersion.ToString(3)}. Version reported is {applicationVersion}",applicationVersion);
returnnewValidationFailure("","Unable to send test message");
returnnewValidationFailure(string.Empty,$"Lidarr version should be at least {MinimumApplicationVersion.ToString(3)}. Version reported is {applicationVersion}",applicationVersion);
[FieldDefinition(1, Label = "Mylar Server", HelpText = "URL used to connect to Mylar server, including http(s)://, port, and urlbase if required", Placeholder = "http://localhost:8090")]
publicstringBaseUrl{get;set;}
[FieldDefinition(2, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Mylar in Settings/Web Interface")]
[FieldDefinition(2, Label = "API Key", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Mylar in Settings/Web Interface")]
publicstringApiKey{get;set;}
[FieldDefinition(3, Label = "Sync Categories", Type = FieldType.Select, SelectOptions = typeof(NewznabCategoryFieldConverter), Advanced = true, HelpText = "Only Indexers that support these categories will be synced")]
[FieldDefinition(1, Label = "Radarr Server", HelpText = "URL used to connect to Radarr server, including http(s)://, port, and urlbase if required", Placeholder = "http://localhost:7878")]
publicstringBaseUrl{get;set;}
[FieldDefinition(2, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Radarr in Settings/General")]
[FieldDefinition(2, Label = "API Key", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Radarr in Settings/General")]
publicstringApiKey{get;set;}
[FieldDefinition(3, Label = "Sync Categories", Type = FieldType.Select, SelectOptions = typeof(NewznabCategoryFieldConverter), Advanced = true, HelpText = "Only Indexers that support these categories will be synced")]
returnnewValidationFailure(string.Empty,"Failed to fetch Radarr version");
}
if(applicationVersion==null)
{
returnnewValidationFailure(string.Empty,"Failed to fetch Radarr version");
}
varversion=newVersion(applicationVersion);
varversion=newVersion(applicationVersion);
if(version.Major==3)
{
if(version<MinimumApplicationV3Version)
{
returnnewValidationFailure(string.Empty,$"Radarr version should be at least {MinimumApplicationV3Version.ToString(3)}. Version reported is {applicationVersion}",applicationVersion);
}
}
else
if(version.Major==3)
{
if(version<MinimumApplicationV3Version)
{
if(version<MinimumApplicationV4Version)
{
returnnewValidationFailure(string.Empty,$"Radarr version should be at least {MinimumApplicationV4Version.ToString(3)}. Version reported is {applicationVersion}",applicationVersion);
}
returnnewValidationFailure(string.Empty,$"Radarr version should be at least {MinimumApplicationV3Version.ToString(3)}. Version reported is {applicationVersion}",applicationVersion);
returnnewValidationFailure("ApiKey","API Key is invalid");
returnnewValidationFailure(string.Empty,$"Radarr version should be at least {MinimumApplicationV4Version.ToString(3)}. Version reported is {applicationVersion}",applicationVersion);
[FieldDefinition(1, Label = "Readarr Server", HelpText = "URL used to connect to Readarr server, including http(s)://, port, and urlbase if required", Placeholder = "http://localhost:8787")]
publicstringBaseUrl{get;set;}
[FieldDefinition(2, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Readarr in Settings/General")]
[FieldDefinition(2, Label = "API Key", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Readarr in Settings/General")]
publicstringApiKey{get;set;}
[FieldDefinition(3, Label = "Sync Categories", Type = FieldType.Select, SelectOptions = typeof(NewznabCategoryFieldConverter), Advanced = true, HelpText = "Only Indexers that support these categories will be synced")]
failures.AddIfNotNull(newValidationFailure("ApiKey","API Key is invalid"));
break;
caseHttpStatusCode.BadRequest:
_logger.Error(ex,"Prowlarr URL is invalid");
failures.AddIfNotNull(newValidationFailure("ProwlarrUrl","Prowlarr URL is invalid, Sonarr cannot connect to Prowlarr"));
break;
caseHttpStatusCode.SeeOther:
_logger.Error(ex,"Sonarr returned redirect and is invalid");
failures.AddIfNotNull(newValidationFailure("BaseUrl","Sonarr URL is invalid, Prowlarr cannot connect to Sonarr - are you missing a URL base?"));
break;
caseHttpStatusCode.NotFound:
_logger.Error(ex,"Sonarr not found");
failures.AddIfNotNull(newValidationFailure("BaseUrl","Sonarr URL is invalid, Prowlarr cannot connect to Sonarr. Is Sonarr running and accessible? Sonarr v2 is not supported."));
break;
default:
_logger.Error(ex,"Unable to complete application test");
failures.AddIfNotNull(newValidationFailure("BaseUrl",$"Unable to complete application test, cannot connect to Sonarr. {ex.Message}"));
break;
}
}
catch(JsonReaderExceptionex)
{
_logger.Error(ex,"Unable to parse JSON response from application");
failures.AddIfNotNull(newValidationFailure("BaseUrl",$"Unable to parse JSON response from application. {ex.Message}"));
}
catch(Exceptionex)
{
_logger.Error(ex,"Unable to send test message");
_logger.Error(ex,"Unable to complete application test");
failures.AddIfNotNull(newValidationFailure("BaseUrl",$"Unable to complete application test, cannot connect to Sonarr. {ex.Message}"));
[FieldDefinition(1, Label = "Sonarr Server", HelpText = "URL used to connect to Sonarr server, including http(s)://, port, and urlbase if required", Placeholder = "http://localhost:8989")]
publicstringBaseUrl{get;set;}
[FieldDefinition(2, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Sonarr in Settings/General")]
[FieldDefinition(2, Label = "API Key", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Sonarr in Settings/General")]
publicstringApiKey{get;set;}
[FieldDefinition(3, Label = "Sync Categories", Type = FieldType.Select, SelectOptions = typeof(NewznabCategoryFieldConverter), Advanced = true, HelpText = "Only Indexers that support these categories will be synced")]
returnnewValidationFailure(string.Empty,$"Sonarr version should be at least {MinimumApplicationVersion.ToString(3)}. Version reported is {applicationVersion}",applicationVersion);
returnnewValidationFailure("BaseUrl","Sonarr url is invalid, Prowlarr cannot connect to Sonarr. Is Sonarr running and accessible? Sonarr v2 is not supported.");
}
_logger.Error(ex,"Unable to send test message");
returnnewValidationFailure("BaseUrl","Unable to complete application test");
returnnewValidationFailure(string.Empty,"Failed to fetch Sonarr version");
returnnewValidationFailure("","Unable to send test message");
returnnewValidationFailure(string.Empty,$"Sonarr version should be at least {MinimumApplicationVersion.ToString(3)}. Version reported is {applicationVersion}",applicationVersion);
[FieldDefinition(1, Label = "Whisparr Server", HelpText = "URL used to connect to Whisparr server, including http(s)://, port, and urlbase if required", Placeholder = "http://localhost:6969")]
publicstringBaseUrl{get;set;}
[FieldDefinition(2, Label = "ApiKey", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Whisparr in Settings/General")]
[FieldDefinition(2, Label = "API Key", Privacy = PrivacyLevel.ApiKey, HelpText = "The ApiKey generated by Whisparr in Settings/General")]
publicstringApiKey{get;set;}
[FieldDefinition(3, Label = "Sync Categories", Type = FieldType.Select, SelectOptions = typeof(NewznabCategoryFieldConverter), Advanced = true, HelpText = "Only Indexers that support these categories will be synced")]