Пример #1
0
        public static void SetRadarr(MoviesSettings movieSettings, RadarrSettings radarrSettings)
        {
            SettingsFile.Write(settings =>
            {
                settings.DownloadClients.Radarr.Hostname = radarrSettings.Hostname;
                settings.DownloadClients.Radarr.Port     = radarrSettings.Port;
                settings.DownloadClients.Radarr.ApiKey   = radarrSettings.ApiKey;

                settings.DownloadClients.Radarr.MovieProfileId           = radarrSettings.MovieProfile;
                settings.DownloadClients.Radarr.MovieRootFolder          = radarrSettings.MoviePath;
                settings.DownloadClients.Radarr.MovieMinimumAvailability = radarrSettings.MovieMinAvailability;
                settings.DownloadClients.Radarr.MovieTags = JToken.FromObject(radarrSettings.MovieTags);

                settings.DownloadClients.Radarr.AnimeProfileId           = radarrSettings.AnimeProfile;
                settings.DownloadClients.Radarr.AnimeRootFolder          = radarrSettings.AnimePath;
                settings.DownloadClients.Radarr.AnimeMinimumAvailability = radarrSettings.AnimeMinAvailability;
                settings.DownloadClients.Radarr.AnimeTags = JToken.FromObject(radarrSettings.AnimeTags);

                settings.DownloadClients.Radarr.UseSSL  = radarrSettings.UseSSL;
                settings.DownloadClients.Radarr.Version = radarrSettings.Version;

                settings.Movies.Client  = movieSettings.Client;
                settings.Movies.Command = movieSettings.Command;
            });
        }
Пример #2
0
        public async Task <IActionResult> SaveAsync([FromBody] SaveRadarrSettingsModel model)
        {
            var movieSettings = new MoviesSettings
            {
                Client  = DownloadClient.Radarr,
                Command = model.Command.Trim()
            };

            var radarrSetting = new RadarrSettings
            {
                Hostname             = model.Hostname.Trim(),
                ApiKey               = model.ApiKey.Trim(),
                Port                 = model.Port,
                MoviePath            = model.MoviePath,
                MovieProfile         = model.MovieProfile,
                MovieMinAvailability = model.MovieMinAvailability,
                MovieTags            = model.MovieTags ?? Array.Empty <int>(),
                AnimePath            = model.AnimePath,
                AnimeProfile         = model.AnimeProfile,
                AnimeMinAvailability = model.AnimeMinAvailability,
                AnimeTags            = model.AnimeTags ?? Array.Empty <int>(),
                UseSSL               = model.UseSSL,
                Version              = model.Version
            };

            DownloadClientsSettingsRepository.SetRadarr(movieSettings, radarrSetting);

            return(Ok(new { ok = true }));
        }