added HasImage to live tv objects

This commit is contained in:
Luke Pulverenti 2013-12-13 10:48:48 -05:00
parent d00178d8f0
commit 2884920f0f
6 changed files with 35 additions and 10 deletions

View file

@ -50,6 +50,8 @@ namespace MediaBrowser.Controller.LiveTv
/// <value>The type of the channel.</value> /// <value>The type of the channel.</value>
public ChannelType ChannelType { get; set; } public ChannelType ChannelType { get; set; }
public bool? HasProviderImage { get; set; }
protected override string CreateSortName() protected override string CreateSortName()
{ {
double number = 0; double number = 0;

View file

@ -30,5 +30,11 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary> /// </summary>
/// <value>The type of the channel.</value> /// <value>The type of the channel.</value>
public ChannelType ChannelType { get; set; } public ChannelType ChannelType { get; set; }
/// <summary>
/// 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.
/// </summary>
public bool? HasImage { get; set; }
} }
} }

View file

@ -90,6 +90,12 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary> /// </summary>
/// <value>The episode title.</value> /// <value>The episode title.</value>
public string EpisodeTitle { get; set; } public string EpisodeTitle { get; set; }
/// <summary>
/// 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.
/// </summary>
public bool? HasImage { get; set; }
public ProgramInfo() public ProgramInfo()
{ {

View file

@ -107,6 +107,12 @@ namespace MediaBrowser.Controller.LiveTv
/// <value>The community rating.</value> /// <value>The community rating.</value>
public float? CommunityRating { get; set; } public float? CommunityRating { get; set; }
/// <summary>
/// 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.
/// </summary>
public bool? HasImage { get; set; }
public RecordingInfo() public RecordingInfo()
{ {
Genres = new List<string>(); Genres = new List<string>();

View file

@ -44,20 +44,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return true; return true;
} }
try var channel = (Channel)item;
if (channel.HasProviderImage ?? true)
{ {
await DownloadImage(item, cancellationToken).ConfigureAwait(false); try
}
catch (HttpException ex)
{
// Don't fail the provider on a 404
if (!ex.StatusCode.HasValue || ex.StatusCode.Value != HttpStatusCode.NotFound)
{ {
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); SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return true; return true;
} }

View file

@ -269,7 +269,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
Path = path, Path = path,
ChannelId = channelInfo.Id, ChannelId = channelInfo.Id,
ChannelNumber = channelInfo.Number, ChannelNumber = channelInfo.Number,
ServiceName = serviceName ServiceName = serviceName,
HasProviderImage = channelInfo.HasImage
}; };
isNew = true; isNew = true;