diff --git a/MediaBrowser.Controller/LiveTv/Channel.cs b/MediaBrowser.Controller/LiveTv/Channel.cs index 8097cea1de..7186cfaf30 100644 --- a/MediaBrowser.Controller/LiveTv/Channel.cs +++ b/MediaBrowser.Controller/LiveTv/Channel.cs @@ -50,6 +50,8 @@ namespace MediaBrowser.Controller.LiveTv /// The type of the channel. public ChannelType ChannelType { get; set; } + public bool? HasProviderImage { get; set; } + protected override string CreateSortName() { double number = 0; diff --git a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs index 27fc596303..bb06366739 100644 --- a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs @@ -30,5 +30,11 @@ namespace MediaBrowser.Controller.LiveTv /// /// The type of the channel. public ChannelType ChannelType { get; set; } + + /// + /// Set this value to true or false if it is known via channel info whether there is an image or not. + /// Leave it null if the only way to determine is by requesting the image and handling the failure. + /// + public bool? HasImage { get; set; } } } diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index 8059c1100b..ce7a4a598b 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -90,6 +90,12 @@ namespace MediaBrowser.Controller.LiveTv /// /// The episode title. public string EpisodeTitle { get; set; } + + /// + /// Set this value to true or false if it is known via program info whether there is an image or not. + /// Leave it null if the only way to determine is by requesting the image and handling the failure. + /// + public bool? HasImage { get; set; } public ProgramInfo() { diff --git a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs index 1ffbb7e237..4fc8c0f7a3 100644 --- a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs +++ b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs @@ -107,6 +107,12 @@ namespace MediaBrowser.Controller.LiveTv /// The community rating. public float? CommunityRating { get; set; } + /// + /// Set this value to true or false if it is known via recording info whether there is an image or not. + /// Leave it null if the only way to determine is by requesting the image and handling the failure. + /// + public bool? HasImage { get; set; } + public RecordingInfo() { Genres = new List(); diff --git a/MediaBrowser.Server.Implementations/LiveTv/ChannelImageProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/ChannelImageProvider.cs index e16430e69b..3a24135406 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/ChannelImageProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/ChannelImageProvider.cs @@ -44,20 +44,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv return true; } - try + var channel = (Channel)item; + + if (channel.HasProviderImage ?? true) { - await DownloadImage(item, cancellationToken).ConfigureAwait(false); - } - catch (HttpException ex) - { - // Don't fail the provider on a 404 - if (!ex.StatusCode.HasValue || ex.StatusCode.Value != HttpStatusCode.NotFound) + try { - throw; + await DownloadImage(item, cancellationToken).ConfigureAwait(false); + } + catch (HttpException ex) + { + // Don't fail the provider on a 404 + if (!ex.StatusCode.HasValue || ex.StatusCode.Value != HttpStatusCode.NotFound) + { + throw; + } } } - SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index b2796bc684..4cd18a5236 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -269,7 +269,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv Path = path, ChannelId = channelInfo.Id, ChannelNumber = channelInfo.Number, - ServiceName = serviceName + ServiceName = serviceName, + HasProviderImage = channelInfo.HasImage }; isNew = true;