update tv guide

pull/702/head
Luke Pulverenti 9 years ago
parent 3fda8ec5c2
commit 23bab40308

@ -11,7 +11,7 @@ namespace MediaBrowser.Controller.LiveTv
{
string Name { get; }
string Type { get; }
Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, ChannelInfo channel, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken);
Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken);
Task AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken);
Task Validate(ListingsProviderInfo info);
Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string location);

@ -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();

@ -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)
{

@ -345,7 +345,9 @@
"ButtonSelectDirectory": "Select Directory",
"LabelCustomPaths": "Specify custom paths where desired. Leave fields empty to use the defaults.",
"LabelCachePath": "Cache path:",
"LabelCachePathHelp": "Specify a custom location for server cache files, such as images.",
"LabelCachePathHelp": "Specify a custom location for server cache files, such as images. Leave blank to use the server default.",
"LabelRecordingPath": "Recording path:",
"LabelRecordingPathHelp": "Specify a custom location to save recordings. Leave blank to use the server default.",
"LabelImagesByNamePath": "Images by name path:",
"LabelImagesByNamePathHelp": "Specify a custom location for downloaded actor, genre and studio images.",
"LabelMetadataPath": "Metadata path:",
@ -1486,5 +1488,6 @@
"LabelZipCode": "Zip Code:",
"GuideProviderListingsStep": "Step 2: Select Listings",
"GuideProviderLoginStep": "Step 1: Login",
"LabelLineup": "Lineup"
"LabelLineup": "Lineup",
"MessageTunerDeviceNotListed": "Is your tuner device not listed? Try installing an external service plugin for more Live TV options."
}

@ -346,6 +346,7 @@ pli||pi|Pali|pali
pol||pl|Polish|polonais
pon|||Pohnpeian|pohnpei
por||pt|Portuguese|portugais
pob||pt-br|Portuguese (Brazil)|portugais
pra|||Prakrit languages|prâkrit, langues
pro|||Provençal, Old (to 1500)|provençal ancien (jusqu'à 1500)
pus||ps|Pushto; Pashto|pachto

Loading…
Cancel
Save