public static void SetSonarr(TvShowsSettings tvSettings, SonarrSettingsModel sonarrSettings) { SettingsFile.Write(settings => { settings.DownloadClients.Sonarr.Hostname = sonarrSettings.Hostname; settings.DownloadClients.Sonarr.Port = sonarrSettings.Port; settings.DownloadClients.Sonarr.ApiKey = sonarrSettings.ApiKey; settings.DownloadClients.Sonarr.BaseUrl = sonarrSettings.BaseUrl; settings.DownloadClients.Sonarr.Categories = JToken.FromObject(sonarrSettings.Categories.Select(x => new SonarrCategory { Id = x.Id, Name = x.Name, ProfileId = x.ProfileId, RootFolder = x.RootFolder, Tags = x.Tags, LanguageId = x.LanguageId, UseSeasonFolders = x.UseSeasonFolders, SeriesType = x.SeriesType }).ToArray()); settings.DownloadClients.Sonarr.SearchNewRequests = sonarrSettings.SearchNewRequests; settings.DownloadClients.Sonarr.MonitorNewRequests = sonarrSettings.MonitorNewRequests; settings.DownloadClients.Sonarr.UseSSL = sonarrSettings.UseSSL; settings.DownloadClients.Sonarr.Version = sonarrSettings.Version; SetTvShowSettings(tvSettings, settings); }); }
public static void SetSonarr(TvShowsSettings movieSettings, SonarrSettings sonarrSettings) { SettingsFile.Write(settings => { settings.DownloadClients.Sonarr.Hostname = sonarrSettings.Hostname; settings.DownloadClients.Sonarr.Port = sonarrSettings.Port; settings.DownloadClients.Sonarr.ApiKey = sonarrSettings.ApiKey; settings.DownloadClients.Sonarr.TvRootFolder = sonarrSettings.TvPath; settings.DownloadClients.Sonarr.TvProfileId = sonarrSettings.TvProfile; settings.DownloadClients.Sonarr.TvTags = JToken.FromObject(sonarrSettings.TvTags); settings.DownloadClients.Sonarr.TvLanguageId = sonarrSettings.TvLanguage; settings.DownloadClients.Sonarr.TvUseSeasonFolders = sonarrSettings.TvUseSeasonFolders; settings.DownloadClients.Sonarr.AnimeRootFolder = sonarrSettings.AnimePath; settings.DownloadClients.Sonarr.AnimeProfileId = sonarrSettings.AnimeProfile; settings.DownloadClients.Sonarr.AnimeTags = JToken.FromObject(sonarrSettings.AnimeTags); settings.DownloadClients.Sonarr.AnimeLanguageId = sonarrSettings.AnimeLanguage; settings.DownloadClients.Sonarr.AnimeUseSeasonFolders = sonarrSettings.AnimeUseSeasonFolders; settings.DownloadClients.Sonarr.UseSSL = sonarrSettings.UseSSL; settings.DownloadClients.Sonarr.Version = sonarrSettings.Version; settings.TvShows.Client = movieSettings.Client; settings.TvShows.Command = movieSettings.Command; }); }
public static void SetDisabledClient(TvShowsSettings tvShowsSettings) { SettingsFile.Write(settings => { settings.TvShows.Client = tvShowsSettings.Client; }); }
public async Task <IActionResult> SaveAsync([FromBody] SaveSonarrSettingsModel model) { var tvShowsSettings = new TvShowsSettings { Client = DownloadClient.Sonarr, Command = model.Command.Trim(), Restrictions = model.Restrictions }; var sonarrSetting = new SonarrSettingsModel { Hostname = model.Hostname.Trim(), Port = model.Port, ApiKey = model.ApiKey.Trim(), BaseUrl = model.BaseUrl.Trim(), TvPath = model.TvPath, TvProfile = model.TvProfile, TvTags = model.TvTags ?? Array.Empty <int>(), TvLanguage = model.TvLanguage, TvUseSeasonFolders = model.TvUseSeasonFolders, AnimePath = model.AnimePath, AnimeProfile = model.AnimeProfile, AnimeTags = model.AnimeTags ?? Array.Empty <int>(), AnimeLanguage = model.AnimeLanguage, AnimeUseSeasonFolders = model.AnimeUseSeasonFolders, SearchNewRequests = model.SearchNewRequests, MonitorNewRequests = model.MonitorNewRequests, UseSSL = model.UseSSL, Version = model.Version }; DownloadClientsSettingsRepository.SetSonarr(tvShowsSettings, sonarrSetting); return(Ok(new { ok = true })); }
public static void SetSonarr(TvShowsSettings tvSettings, SonarrSettingsModel sonarrSettings) { SettingsFile.Write(settings => { settings.DownloadClients.Sonarr.Hostname = sonarrSettings.Hostname; settings.DownloadClients.Sonarr.Port = sonarrSettings.Port; settings.DownloadClients.Sonarr.ApiKey = sonarrSettings.ApiKey; settings.DownloadClients.Sonarr.BaseUrl = sonarrSettings.BaseUrl; settings.DownloadClients.Sonarr.TvRootFolder = sonarrSettings.TvPath; settings.DownloadClients.Sonarr.TvProfileId = sonarrSettings.TvProfile; settings.DownloadClients.Sonarr.TvTags = JToken.FromObject(sonarrSettings.TvTags); settings.DownloadClients.Sonarr.TvLanguageId = sonarrSettings.TvLanguage; settings.DownloadClients.Sonarr.TvUseSeasonFolders = sonarrSettings.TvUseSeasonFolders; settings.DownloadClients.Sonarr.AnimeRootFolder = sonarrSettings.AnimePath; settings.DownloadClients.Sonarr.AnimeProfileId = sonarrSettings.AnimeProfile; settings.DownloadClients.Sonarr.AnimeTags = JToken.FromObject(sonarrSettings.AnimeTags); settings.DownloadClients.Sonarr.AnimeLanguageId = sonarrSettings.AnimeLanguage; settings.DownloadClients.Sonarr.AnimeUseSeasonFolders = sonarrSettings.AnimeUseSeasonFolders; settings.DownloadClients.Sonarr.SearchNewRequests = sonarrSettings.SearchNewRequests; settings.DownloadClients.Sonarr.MonitorNewRequests = sonarrSettings.MonitorNewRequests; settings.DownloadClients.Sonarr.UseSSL = sonarrSettings.UseSSL; settings.DownloadClients.Sonarr.Version = sonarrSettings.Version; settings.TvShows.Client = tvSettings.Client; settings.TvShows.Command = tvSettings.Command; settings.TvShows.Restrictions = tvSettings.Restrictions; }); }
public static void SetOverseerr(TvShowsSettings movieSettings, OverseerrSettingsModel overseerrSettings) { SettingsFile.Write(settings => { SetOverseerrSettings(overseerrSettings, settings); SetTvShowSettings(movieSettings, settings); }); }
public static void SetDisabledClient(TvShowsSettings tvShowsSettings) { SettingsFile.Write(settings => { NotificationsFile.ClearAllTvShowNotifications(); settings.TvShows.Client = tvShowsSettings.Client; }); }
public static void SetOmbi(TvShowsSettings tvShowsSettings, OmbiSettingsModel ombiSettings) { SettingsFile.Write(settings => { SetOmbiSettings(ombiSettings, settings); SetTvShowSettings(tvShowsSettings, settings); }); }
public TvShowsDownloadClientController( IHttpClientFactory httpClientFactory, IOptionsSnapshot <TvShowsSettings> tvShowsSettingsAccessor, IOptionsSnapshot <DownloadClientsSettings> botClientsSettingsAccessor) { _tvShowsSettings = tvShowsSettingsAccessor.Value; _downloadClientsSettings = botClientsSettingsAccessor.Value; _httpClientFactory = httpClientFactory; }
public TvShowsDownloadClientController( IHttpClientFactory httpClientFactory, TvShowsSettingsProvider tvShowsSettingsProvider, DownloadClientsSettingsProvider downloadClientsSettingsProvider) { _tvShowsSettings = tvShowsSettingsProvider.Provide(); _downloadClientsSettings = downloadClientsSettingsProvider.Provide(); _httpClientFactory = httpClientFactory; }
public static void SetOverseerr(TvShowsSettings movieSettings, SaveOverseerrTvShowsSettingsModel overseerrSettings) { SettingsFile.Write(settings => { SetOverseerrSettings(overseerrSettings, settings); settings.DownloadClients.Overseerr.TvShows = JToken.FromObject(overseerrSettings.TvShows); SetTvShowSettings(movieSettings, settings); }); }
public async Task <IActionResult> SaveAsync([FromBody] SaveSonarrSettingsModel model) { var tvShowsSettings = new TvShowsSettings { Client = DownloadClient.Sonarr, Restrictions = model.Restrictions }; if (!model.Categories.Any()) { return(BadRequest($"At least one category is required.")); } if (model.Categories.Any(x => string.IsNullOrWhiteSpace(x.Name))) { return(BadRequest($"A category name is required.")); } foreach (var category in model.Categories) { category.Name = category.Name.Trim(); category.Tags = category.Tags; } if (new HashSet <string>(model.Categories.Select(x => x.Name.ToLower())).Count != model.Categories.Length) { return(BadRequest($"All categories must have different names.")); } if (new HashSet <int>(model.Categories.Select(x => x.Id)).Count != model.Categories.Length) { return(BadRequest($"All categories must have different ids.")); } if (model.Categories.Any(x => !Regex.IsMatch(x.Name, @"^[\w-]{1,32}$"))) { return(BadRequest($"Invalid categorie names, make sure they only contain alphanumeric characters, dashes and underscores. (No spaces, etc)")); } var sonarrSetting = new SonarrSettingsModel { Hostname = model.Hostname.Trim(), Port = model.Port, ApiKey = model.ApiKey.Trim(), BaseUrl = model.BaseUrl.Trim(), Categories = model.Categories, SearchNewRequests = model.SearchNewRequests, MonitorNewRequests = model.MonitorNewRequests, UseSSL = model.UseSSL, Version = model.Version }; DownloadClientsSettingsRepository.SetSonarr(tvShowsSettings, sonarrSetting); return(Ok(new { ok = true })); }
public static void SetOmbi(TvShowsSettings tvShowsSettings, OmbiSettingsModel ombiSettings) { SettingsFile.Write(settings => { SetOmbiSettings(ombiSettings, settings); settings.TvShows.Client = tvShowsSettings.Client; settings.TvShows.Command = tvShowsSettings.Command; }); }
private static void SetTvShowSettings(TvShowsSettings tvSettings, dynamic settings) { if (settings.TvShows.Client != tvSettings.Client) { NotificationsFile.ClearAllTvShowNotifications(); } settings.TvShows.Client = tvSettings.Client; settings.TvShows.Restrictions = tvSettings.Restrictions; }
public async Task <IActionResult> SaveTvShowsAsync([FromBody] SaveOmbiTvShowsSettingsModel model) { var tvShowsSettings = new TvShowsSettings { Client = DownloadClient.Ombi, Restrictions = model.Restrictions }; var ombiSettings = Sanitize(model); DownloadClientsSettingsRepository.SetOmbi(tvShowsSettings, ombiSettings); return(Ok(new { ok = true })); }
public async Task <IActionResult> SaveTvShowsAsync([FromBody] SaveOmbiSettingsModel model) { var tvShowsSettings = new TvShowsSettings { Client = DownloadClient.Ombi, Command = model.Command.Trim(), }; var ombiSettings = ConvertToOmbiSettings(model); DownloadClientsSettingsRepository.SetOmbi(tvShowsSettings, ombiSettings); return(Ok(new { ok = true })); }
public async Task <IActionResult> SaveTvShowsAsync([FromBody] SaveOverseerrTvShowsSettingsModel model) { var tvShowsSettings = new TvShowsSettings { Client = DownloadClient.Overseerr, Command = model.Command.Trim(), Restrictions = model.Restrictions }; var overseerrSettings = Sanitize(model); DownloadClientsSettingsRepository.SetOverseerr(tvShowsSettings, overseerrSettings); return(Ok(new { ok = true })); }
public async Task <IActionResult> SaveTvShowsAsync([FromBody] SaveOverseerrTvShowsSettingsModel model) { var tvShowsSettings = new TvShowsSettings { Client = DownloadClient.Overseerr, Restrictions = model.Restrictions }; Sanitize(model); if (model.TvShows.Categories.Any(x => string.IsNullOrWhiteSpace(x.Name))) { return(BadRequest($"A category name is required.")); } foreach (var category in model.TvShows.Categories) { category.Name = category.Name.Trim(); category.Tags = category.Tags; } if (new HashSet <string>(model.TvShows.Categories.Select(x => x.Name.ToLower())).Count != model.TvShows.Categories.Length) { return(BadRequest($"All categories must have different names.")); } if (new HashSet <int>(model.TvShows.Categories.Select(x => x.Id)).Count != model.TvShows.Categories.Length) { return(BadRequest($"All categories must have different ids.")); } if (model.TvShows.Categories.Any(x => !Regex.IsMatch(x.Name, @"^[\w-]{1,32}$"))) { return(BadRequest($"Invalid categorie names, make sure they only contain alphanumeric characters, dashes and underscores. (No spaces, etc)")); } DownloadClientsSettingsRepository.SetOverseerr(tvShowsSettings, model); return(Ok(new { ok = true })); }