aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/LiveTv/Listings
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-07-23 19:40:54 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-07-23 19:40:54 -0400
commitba9ed26c4a60b29f25c0cf53d215b617142c0fc3 (patch)
tree14ec9ac08298d4335bb440c7b7e4d5c1ef47524e /MediaBrowser.Server.Implementations/LiveTv/Listings
parentf7c1a88166e4ba756f05db12db2c61865cfc6712 (diff)
update emby tv
Diffstat (limited to 'MediaBrowser.Server.Implementations/LiveTv/Listings')
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs51
1 files changed, 40 insertions, 11 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index ed265d416f..72a965c6ab 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -218,7 +218,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
private ProgramInfo GetProgram(string channel, ScheduleDirect.Program programInfo,
ScheduleDirect.ProgramDetails details)
{
- _logger.Debug("Show type is: " + (details.showType ?? "No ShowType"));
+ //_logger.Debug("Show type is: " + (details.showType ?? "No ShowType"));
DateTime startAt = DateTime.ParseExact(programInfo.airDateTime, "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'",
CultureInfo.InvariantCulture);
DateTime endAt = startAt.AddSeconds(programInfo.duration);
@@ -401,7 +401,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
_logger.Info("Headends on account ");
var countryParam = string.Equals("ca", country, StringComparison.OrdinalIgnoreCase)
- ? "Canada"
+ ? "can"
: "USA";
var options = new HttpRequestOptions()
@@ -562,6 +562,44 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
get { return "SchedulesDirect"; }
}
+ private async Task<bool> HasLineup(ListingsProviderInfo info, CancellationToken cancellationToken)
+ {
+ var token = await GetToken(info, cancellationToken);
+
+ _logger.Info("Headends on account ");
+
+ var options = new HttpRequestOptions()
+ {
+ Url = ApiUrl + "/lineups",
+ UserAgent = UserAgent,
+ CancellationToken = cancellationToken
+ };
+
+ options.RequestHeaders["token"] = token;
+
+ using (Stream responce = await _httpClient.Get(options).ConfigureAwait(false))
+ {
+ var root = _jsonSerializer.DeserializeFromStream<ScheduleDirect.Lineups>(responce);
+
+ return root.lineups.Any(i => string.Equals(info.ListingsId, i.lineup, StringComparison.OrdinalIgnoreCase));
+ }
+ }
+
+ public async Task Validate(ListingsProviderInfo info)
+ {
+ var hasLineup = await HasLineup(info, CancellationToken.None).ConfigureAwait(false);
+
+ if (!hasLineup)
+ {
+ await AddLineupToAccount(info, CancellationToken.None).ConfigureAwait(false);
+ }
+ }
+
+ public Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location)
+ {
+ return GetHeadends(info, country, location, CancellationToken.None);
+ }
+
public class ScheduleDirect
{
public class Token
@@ -841,14 +879,5 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
}
- public async Task Validate(ListingsProviderInfo info)
- {
- //await AddLineupToAccount(info, CancellationToken.None).ConfigureAwait(false);
- }
-
- public Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location)
- {
- return GetHeadends(info, country, location, CancellationToken.None);
- }
}
}