aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/LiveTv
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-07-23 10:58:27 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-07-23 10:58:27 -0400
commit23bab4030872268fdfe98d27f7136d5279d990f8 (patch)
tree479878ccb6beaeb3652f4f18871abba371bcf7e7 /MediaBrowser.Server.Implementations/LiveTv
parent3fda8ec5c264f077b625247ab29ce504be25774c (diff)
update tv guide
Diffstat (limited to 'MediaBrowser.Server.Implementations/LiveTv')
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs11
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs39
2 files changed, 3 insertions, 47 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 6e8213ee09..37b6bf0866 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -257,18 +257,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
{
- var allChannels = await GetChannelsAsync(cancellationToken).ConfigureAwait(false);
- var channelInfo = allChannels.FirstOrDefault(i => string.Equals(channelId, i.Id, StringComparison.OrdinalIgnoreCase));
-
- if (channelInfo == null)
- {
- _logger.Debug("Returning empty program list because channel was not found.");
- return new List<ProgramInfo>();
- }
-
foreach (var provider in GetListingProviders())
{
- var programs = await provider.Item1.GetProgramsAsync(provider.Item2, channelInfo, startDateUtc, endDateUtc, cancellationToken)
+ var programs = await provider.Item1.GetProgramsAsync(provider.Item2, channelId, startDateUtc, endDateUtc, cancellationToken)
.ConfigureAwait(false);
var list = programs.ToList();
diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index f5b41f3df7..2656397bb8 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -35,10 +35,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
_httpClient = httpClient;
}
- public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, ChannelInfo channel, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
+ public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
{
- var channelNumber = channel.Number;
-
List<ProgramInfo> programsInfo = new List<ProgramInfo>();
var token = await GetToken(info, cancellationToken);
@@ -74,7 +72,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
ScheduleDirect.Station station = null;
- if (!_channelPair.TryGetValue("", out station))
+ if (!_channelPair.TryGetValue(channelNumber, out station))
{
return programsInfo;
}
@@ -217,39 +215,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
}
}
- private async Task<ScheduleDirect.Channel> GetLineup(string listingsId, string token, CancellationToken cancellationToken)
- {
- var httpOptions = new HttpRequestOptions()
- {
- Url = ApiUrl + "/lineups/" + listingsId,
- UserAgent = UserAgent,
- CancellationToken = cancellationToken
- };
-
- httpOptions.RequestHeaders["token"] = token;
-
- using (var response = await _httpClient.Get(httpOptions))
- {
- var root = _jsonSerializer.DeserializeFromStream<ScheduleDirect.Channel>(response);
- _logger.Info("Found " + root.map.Count() + " channels on the lineup on ScheduleDirect");
- _logger.Info("Mapping Stations to Channel");
- foreach (ScheduleDirect.Map map in root.map)
- {
- var channel = (map.channel ?? (map.atscMajor + "." + map.atscMinor)).TrimStart('0');
- _logger.Debug("Found channel: " + channel + " in Schedules Direct");
-
- var schChannel = root.stations.FirstOrDefault(item => item.stationID == map.stationID);
-
- if (!_channelPair.ContainsKey(channel) && channel != "0.0" && schChannel != null)
- {
- _channelPair.TryAdd(channel, schChannel);
- }
- }
-
- return root;
- }
- }
-
private ProgramInfo GetProgram(string channel, ScheduleDirect.Program programInfo,
ScheduleDirect.ProgramDetails details)
{