update timer images

This commit is contained in:
Luke Pulverenti 2016-12-17 21:35:21 -05:00
parent 2481c5d9f8
commit c99fa9a651
3 changed files with 71 additions and 5 deletions

View File

@ -30,6 +30,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
Priority = seriesTimer.Priority,
Name = parent.Name,
Overview = parent.Overview,
SeriesId = parent.SeriesId,
SeriesTimerId = seriesTimer.Id,
ShowId = parent.ShowId
};
@ -63,6 +64,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
timerInfo.ShortOverview = programInfo.ShortOverview;
timerInfo.OfficialRating = programInfo.OfficialRating;
timerInfo.IsRepeat = programInfo.IsRepeat;
timerInfo.SeriesId = programInfo.SeriesId;
}
public static string GetRecordingName(TimerInfo info)

View File

@ -14,6 +14,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Dto;
namespace Emby.Server.Implementations.LiveTv
{
@ -80,6 +81,11 @@ namespace Emby.Server.Implementations.LiveTv
}
dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId;
if (!string.IsNullOrWhiteSpace(info.SeriesTimerId))
{
FillImages(dto.ProgramInfo, info.Name, info.SeriesId);
}
}
if (channel != null)
@ -131,17 +137,17 @@ namespace Emby.Server.Implementations.LiveTv
dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days);
FillImages(dto, info);
FillImages(dto, info.Name, info.SeriesId);
return dto;
}
private void FillImages(SeriesTimerInfoDto dto, SeriesTimerInfo info)
private void FillImages(BaseItemDto dto, string seriesName, string programSeriesId)
{
var librarySeries = _libraryManager.GetItemList(new InternalItemsQuery
{
IncludeItemTypes = new string[] { typeof(Series).Name },
Name = info.Name,
Name = seriesName,
Limit = 1,
ImageTypes = new ImageType[] { ImageType.Thumb }
@ -163,12 +169,68 @@ namespace Emby.Server.Implementations.LiveTv
}
}
if (!string.IsNullOrWhiteSpace(info.SeriesId))
if (!string.IsNullOrWhiteSpace(programSeriesId))
{
var program = _libraryManager.GetItemList(new InternalItemsQuery
{
IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name },
ExternalSeriesId = info.SeriesId,
ExternalSeriesId = programSeriesId,
Limit = 1,
ImageTypes = new ImageType[] { ImageType.Primary }
}).FirstOrDefault();
if (program != null)
{
var image = program.GetImageInfo(ImageType.Primary, 0);
if (image != null)
{
try
{
dto.ParentPrimaryImageTag = _imageProcessor.GetImageCacheTag(program, image);
dto.ParentPrimaryImageItemId = program.Id.ToString("N");
}
catch (Exception ex)
{
}
}
}
}
}
private void FillImages(SeriesTimerInfoDto dto, string seriesName, string programSeriesId)
{
var librarySeries = _libraryManager.GetItemList(new InternalItemsQuery
{
IncludeItemTypes = new string[] { typeof(Series).Name },
Name = seriesName,
Limit = 1,
ImageTypes = new ImageType[] { ImageType.Thumb }
}).FirstOrDefault();
if (librarySeries != null)
{
var image = librarySeries.GetImageInfo(ImageType.Thumb, 0);
if (image != null)
{
try
{
dto.ParentThumbImageTag = _imageProcessor.GetImageCacheTag(librarySeries, image);
dto.ParentThumbItemId = librarySeries.Id.ToString("N");
}
catch (Exception ex)
{
}
}
}
if (!string.IsNullOrWhiteSpace(programSeriesId))
{
var program = _libraryManager.GetItemList(new InternalItemsQuery
{
IncludeItemTypes = new string[] { typeof(LiveTvProgram).Name },
ExternalSeriesId = programSeriesId,
Limit = 1,
ImageTypes = new ImageType[] { ImageType.Primary }

View File

@ -46,6 +46,8 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
public string Overview { get; set; }
public string SeriesId { get; set; }
/// <summary>
/// The start date of the recording, in UTC.
/// </summary>