diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations')
3 files changed, 25 insertions, 15 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 65d24ee806..5fd9745a1a 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -400,13 +400,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings _logger.Info("Headends on account "); - var countryParam = string.Equals("ca", country, StringComparison.OrdinalIgnoreCase) - ? "can" - : "USA"; - var options = new HttpRequestOptions() { - Url = ApiUrl + "/headends?country=" + countryParam + "&postalcode=" + location, + Url = ApiUrl + "/headends?country=" + country + "&postalcode=" + location, UserAgent = UserAgent, CancellationToken = cancellationToken }; @@ -595,18 +591,32 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings } } - public async Task Validate(ListingsProviderInfo info) + public async Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings) { - if (string.IsNullOrWhiteSpace(info.ListingsId)) + if (validateLogin) { - throw new ArgumentException("Listings Id required"); + if (string.IsNullOrWhiteSpace(info.Username)) + { + throw new ArgumentException("Username is required"); + } + if (string.IsNullOrWhiteSpace(info.Password)) + { + throw new ArgumentException("Password is required"); + } } + if (validateListings) + { + if (string.IsNullOrWhiteSpace(info.ListingsId)) + { + throw new ArgumentException("Listings Id required"); + } - var hasLineup = await HasLineup(info, CancellationToken.None).ConfigureAwait(false); + var hasLineup = await HasLineup(info, CancellationToken.None).ConfigureAwait(false); - if (!hasLineup) - { - await AddLineupToAccount(info, CancellationToken.None).ConfigureAwait(false); + if (!hasLineup) + { + await AddLineupToAccount(info, CancellationToken.None).ConfigureAwait(false); + } } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTv.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTv.cs index 2e6fc8277d..de107ced80 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTv.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTv.cs @@ -30,7 +30,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings // Might not be needed } - public Task Validate(ListingsProviderInfo info) + public async Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings) { // Check that the path or url is valid. If not, throw a file not found exception } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 3ca60ec513..d539562b8f 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -2204,7 +2204,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv _taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>(); } - public async Task<ListingsProviderInfo> SaveListingProvider(ListingsProviderInfo info) + public async Task<ListingsProviderInfo> SaveListingProvider(ListingsProviderInfo info, bool validateLogin, bool validateListings) { info = (ListingsProviderInfo)_jsonSerializer.DeserializeFromString(_jsonSerializer.SerializeToString(info), typeof(ListingsProviderInfo)); @@ -2215,7 +2215,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv throw new ResourceNotFoundException(); } - await provider.Validate(info).ConfigureAwait(false); + await provider.Validate(info, validateLogin, validateListings).ConfigureAwait(false); var config = GetConfiguration(); |
