update tv

This commit is contained in:
Luke Pulverenti 2015-08-10 15:09:10 -04:00
parent 4f6fb1a76e
commit 1e9292c454
6 changed files with 32 additions and 14 deletions

View file

@ -440,6 +440,9 @@ namespace MediaBrowser.Api.LiveTv
[ApiMember(Name = "Id", Description = "Provider id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "Id", Description = "Provider id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Id { get; set; } public string Id { get; set; }
[ApiMember(Name = "Type", Description = "Provider Type", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Type { get; set; }
[ApiMember(Name = "Location", Description = "Location", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "Location", Description = "Location", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Location { get; set; } public string Location { get; set; }
@ -535,7 +538,7 @@ namespace MediaBrowser.Api.LiveTv
public async Task<object> Get(GetLineups request) public async Task<object> Get(GetLineups request)
{ {
var info = await _liveTvManager.GetLineups(request.Id, request.Country, request.Location).ConfigureAwait(false); var info = await _liveTvManager.GetLineups(request.Type, request.Id, request.Country, request.Location).ConfigureAwait(false);
return ToOptimizedSerializedResultUsingCache(info); return ToOptimizedSerializedResultUsingCache(info);
} }

View file

@ -357,10 +357,11 @@ namespace MediaBrowser.Controller.LiveTv
/// <summary> /// <summary>
/// Gets the lineups. /// Gets the lineups.
/// </summary> /// </summary>
/// <param name="providerType">Type of the provider.</param>
/// <param name="providerId">The provider identifier.</param> /// <param name="providerId">The provider identifier.</param>
/// <param name="country">The country.</param> /// <param name="country">The country.</param>
/// <param name="location">The location.</param> /// <param name="location">The location.</param>
/// <returns>Task&lt;List&lt;NameIdPair&gt;&gt;.</returns> /// <returns>Task&lt;List&lt;NameIdPair&gt;&gt;.</returns>
Task<List<NameIdPair>> GetLineups(string providerId, string country, string location); Task<List<NameIdPair>> GetLineups(string providerType, string providerId, string country, string location);
} }
} }

View file

@ -48,7 +48,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings.Emby
public Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location) public Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location)
{ {
return GetListingsProvider(country).GetLineups(info, country, location); return GetListingsProvider(country).GetLineups(country, location);
} }
private IEmbyListingProvider GetListingsProvider(string country) private IEmbyListingProvider GetListingsProvider(string country)

View file

@ -43,7 +43,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings.Emby
return Task.FromResult(true); return Task.FromResult(true);
} }
public async Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location) public async Task<List<NameIdPair>> GetLineups(string country, string location)
{ {
// location = postal code // location = postal code
var path = await GetResponse<String>("https://data.emby.media/service/lineups?postalCode=" + location).ConfigureAwait(false); var path = await GetResponse<String>("https://data.emby.media/service/lineups?postalCode=" + location).ConfigureAwait(false);

View file

@ -13,6 +13,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings.Emby
Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, 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 AddMetadata(ListingsProviderInfo info, List<ChannelInfo> channels, CancellationToken cancellationToken);
Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings); Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings);
Task<List<NameIdPair>> GetLineups(ListingsProviderInfo info, string country, string location); Task<List<NameIdPair>> GetLineups(string country, string location);
} }
} }

View file

@ -2272,10 +2272,23 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return info; return info;
} }
public Task<List<NameIdPair>> GetLineups(string providerId, string country, string location) public Task<List<NameIdPair>> GetLineups(string providerType, string providerId, string country, string location)
{ {
var config = GetConfiguration(); var config = GetConfiguration();
if (string.IsNullOrWhiteSpace(providerId))
{
var provider = _listingProviders.FirstOrDefault(i => string.Equals(providerType, i.Type, StringComparison.OrdinalIgnoreCase));
if (provider == null)
{
throw new ResourceNotFoundException();
}
return provider.GetLineups(null, country, location);
}
else
{
var info = config.ListingProviders.FirstOrDefault(i => string.Equals(i.Id, providerId, StringComparison.OrdinalIgnoreCase)); var info = config.ListingProviders.FirstOrDefault(i => string.Equals(i.Id, providerId, StringComparison.OrdinalIgnoreCase));
var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase)); var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
@ -2288,4 +2301,5 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return provider.GetLineups(info, country, location); return provider.GetLineups(info, country, location);
} }
} }
}
} }