aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-07-25 13:21:10 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-07-25 13:21:10 -0400
commit14f97d61765c07b406127fec5937aea1e9e81e0f (patch)
tree82d8dac63bfd6048fc8a6889ef2d49236f525a5f /MediaBrowser.Server.Implementations
parent6a6145294ad19a0d88ad3928b48c7877bbf1b473 (diff)
update schedules direct
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs34
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTv.cs2
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs4
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 65d24ee80..5fd9745a1 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 2e6fc8277..de107ced8 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 3ca60ec51..d539562b8 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();