diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs index a5b19ff524..84f802d761 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs @@ -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) diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs index 5fa3995e6a..7c1de251ca 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -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,73 @@ 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 } + + }).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 } + + }).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 } @@ -163,12 +225,12 @@ 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 } diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs index ee8dd5d3a7..10ed95fe5e 100644 --- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs @@ -46,6 +46,8 @@ namespace MediaBrowser.Controller.LiveTv /// public string Overview { get; set; } + public string SeriesId { get; set; } + /// /// The start date of the recording, in UTC. ///