diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index bdec55561..e55103230 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -440,6 +440,9 @@ namespace MediaBrowser.Api.LiveTv [ApiMember(Name = "Id", Description = "Provider id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] 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")] public string Location { get; set; } @@ -535,7 +538,7 @@ namespace MediaBrowser.Api.LiveTv public async Task 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); } diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 889875383..e568b2eae 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -357,10 +357,11 @@ namespace MediaBrowser.Controller.LiveTv /// /// Gets the lineups. /// + /// Type of the provider. /// The provider identifier. /// The country. /// The location. /// Task<List<NameIdPair>>. - Task> GetLineups(string providerId, string country, string location); + Task> GetLineups(string providerType, string providerId, string country, string location); } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/EmbyListings.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/EmbyListings.cs index 5edebb393..e446ff469 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/EmbyListings.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/EmbyListings.cs @@ -48,7 +48,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings.Emby public Task> 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) diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/EmbyListingsNorthAmerica.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/EmbyListingsNorthAmerica.cs index 4713e3074..6fc6975a8 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/EmbyListingsNorthAmerica.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/EmbyListingsNorthAmerica.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings.Emby return Task.FromResult(true); } - public async Task> GetLineups(ListingsProviderInfo info, string country, string location) + public async Task> GetLineups(string country, string location) { // location = postal code var path = await GetResponse("https://data.emby.media/service/lineups?postalCode=" + location).ConfigureAwait(false); diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/IEmbyListingProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/IEmbyListingProvider.cs index 83477acfc..95c22b986 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/IEmbyListingProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/Emby/IEmbyListingProvider.cs @@ -13,6 +13,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings.Emby Task> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken); Task AddMetadata(ListingsProviderInfo info, List channels, CancellationToken cancellationToken); Task Validate(ListingsProviderInfo info, bool validateLogin, bool validateListings); - Task> GetLineups(ListingsProviderInfo info, string country, string location); + Task> GetLineups(string country, string location); } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index aa883ce75..02ca7f0f6 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -2272,20 +2272,34 @@ namespace MediaBrowser.Server.Implementations.LiveTv return info; } - public Task> GetLineups(string providerId, string country, string location) + public Task> GetLineups(string providerType, string providerId, string country, string location) { var config = GetConfiguration(); - 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)); - - if (provider == null) + if (string.IsNullOrWhiteSpace(providerId)) { - throw new ResourceNotFoundException(); - } + var provider = _listingProviders.FirstOrDefault(i => string.Equals(providerType, i.Type, StringComparison.OrdinalIgnoreCase)); - return provider.GetLineups(info, country, location); + 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 provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase)); + + if (provider == null) + { + throw new ResourceNotFoundException(); + } + + return provider.GetLineups(info, country, location); + } } } }