From fb335141fb9cb2b2ed626e2ffb555fccb26b3edf Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 17 Jan 2014 15:51:29 -0500 Subject: [PATCH] display tv service version info --- .../UserLibrary/ArtistsService.cs | 14 ++++++++++- .../LiveTv/ILiveTvService.cs | 6 +++++ .../LiveTv/LiveTvServiceStatusInfo.cs | 12 ++++++++++ MediaBrowser.Controller/LiveTv/ProgramInfo.cs | 6 +++++ MediaBrowser.Model/ApiClient/IApiClient.cs | 8 +++++++ .../LiveTv/LiveTvServiceInfo.cs | 18 ++++++++++++++ MediaBrowser.Model/LiveTv/ProgramInfoDto.cs | 6 +++++ MediaBrowser.Model/LiveTv/RecordingInfoDto.cs | 10 ++++++-- .../LiveTv/LiveTvDtoService.cs | 24 +++++++++++++++---- .../LiveTv/LiveTvManager.cs | 15 +++++------- Nuget/MediaBrowser.Common.Internal.nuspec | 4 ++-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 ++-- 13 files changed, 107 insertions(+), 22 deletions(-) diff --git a/MediaBrowser.Api/UserLibrary/ArtistsService.cs b/MediaBrowser.Api/UserLibrary/ArtistsService.cs index 48fc72913..a96630efe 100644 --- a/MediaBrowser.Api/UserLibrary/ArtistsService.cs +++ b/MediaBrowser.Api/UserLibrary/ArtistsService.cs @@ -112,7 +112,19 @@ namespace MediaBrowser.Api.UserLibrary protected override IEnumerable GetAllItems(GetItemsByName request, IEnumerable items) { return LibraryManager.GetAllArtists(items) - .Select(name => LibraryManager.GetArtist(name)); + .Select(name => + { + try + { + return LibraryManager.GetArtist(name); + } + catch (Exception ex) + { + Logger.ErrorException("Error getting artist {0}", ex, name); + return null; + } + + }).Where(i => i != null); } protected override IEnumerable GetLibraryItems(MusicArtist item, IEnumerable libraryItems) diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index 955d81b03..988b62002 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -26,6 +26,12 @@ namespace MediaBrowser.Controller.LiveTv /// The name. string Name { get; } + /// + /// Gets the home page URL. + /// + /// The home page URL. + string HomePageUrl { get; } + /// /// Gets the status information asynchronous. /// diff --git a/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs b/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs index 3da00de49..cc5107590 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs @@ -15,5 +15,17 @@ namespace MediaBrowser.Controller.LiveTv /// /// The status message. public string StatusMessage { get; set; } + + /// + /// Gets or sets the version. + /// + /// The version. + public string Version { get; set; } + + /// + /// Gets or sets a value indicating whether this instance has update available. + /// + /// true if this instance has update available; otherwise, false. + public bool HasUpdateAvailable { get; set; } } } diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index d672340e4..0368c5f2f 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -17,6 +17,12 @@ namespace MediaBrowser.Controller.LiveTv /// The channel identifier. public string ChannelId { get; set; } + /// + /// Gets or sets the channel primary image tag. + /// + /// The channel primary image tag. + public Guid? ChannelPrimaryImageTag { get; set; } + /// /// Name of the program /// diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index cf90fb757..1e54e2dae 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -1017,6 +1017,14 @@ namespace MediaBrowser.Model.ApiClient /// The cancellation token. /// Task{QueryResult{ProgramInfoDto}}. Task> GetLiveTvProgramsAsync(ProgramQuery query, CancellationToken cancellationToken); + + /// + /// Gets the recommended live tv programs asynchronous. + /// + /// The query. + /// The cancellation token. + /// Task{QueryResult{ProgramInfoDto}}. + Task> GetRecommendedLiveTvProgramsAsync(RecommendedProgramQuery query, CancellationToken cancellationToken); /// /// Gets the live tv timer asynchronous. diff --git a/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs b/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs index dd2dc81bd..b54369ef5 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs @@ -14,6 +14,12 @@ namespace MediaBrowser.Model.LiveTv /// The name. public string Name { get; set; } + /// + /// Gets or sets the home page URL. + /// + /// The home page URL. + public string HomePageUrl { get; set; } + /// /// Gets or sets the status. /// @@ -25,6 +31,18 @@ namespace MediaBrowser.Model.LiveTv /// /// The status message. public string StatusMessage { get; set; } + + /// + /// Gets or sets the version. + /// + /// The version. + public string Version { get; set; } + + /// + /// Gets or sets a value indicating whether this instance has update available. + /// + /// true if this instance has update available; otherwise, false. + public bool HasUpdateAvailable { get; set; } } public class GuideInfo diff --git a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs index aeaf2c15b..9a29f1800 100644 --- a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs @@ -37,6 +37,12 @@ namespace MediaBrowser.Model.LiveTv /// The channel identifier. public string ChannelId { get; set; } + /// + /// Gets or sets the channel primary image tag. + /// + /// The channel primary image tag. + public Guid? ChannelPrimaryImageTag { get; set; } + /// /// Gets or sets the name of the channel. /// diff --git a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs index 5076e9d02..2a95247ce 100644 --- a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs @@ -1,8 +1,8 @@ -using System.ComponentModel; -using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; +using System.ComponentModel; namespace MediaBrowser.Model.LiveTv { @@ -36,6 +36,12 @@ namespace MediaBrowser.Model.LiveTv /// public string ChannelId { get; set; } + /// + /// Gets or sets the channel primary image tag. + /// + /// The channel primary image tag. + public Guid? ChannelPrimaryImageTag { get; set; } + /// /// ChannelName of the recording. /// diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs index 1546f8045..2fea919b0 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -66,7 +66,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv if (program != null) { - dto.ProgramInfo = GetProgramInfoDto(program, channel.ChannelInfo.Name); + dto.ProgramInfo = GetProgramInfoDto(program, channel); dto.ProgramInfo.TimerId = dto.Id; dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId; @@ -260,7 +260,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv if (channel != null) { - dto.ChannelName = channel.ChannelInfo.Name; + dto.ChannelName = channel.Name; + + if (!string.IsNullOrEmpty(channel.PrimaryImagePath)) + { + dto.ChannelPrimaryImageTag = GetImageTag(channel); + } } return dto; @@ -303,13 +308,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv if (currentProgram != null) { - dto.CurrentProgram = GetProgramInfoDto(currentProgram, channelInfo.Name, user); + dto.CurrentProgram = GetProgramInfoDto(currentProgram, info, user); } return dto; } - public ProgramInfoDto GetProgramInfoDto(LiveTvProgram item, string channelName, User user = null) + public ProgramInfoDto GetProgramInfoDto(LiveTvProgram item, LiveTvChannel channel, User user = null) { var program = item.ProgramInfo; @@ -331,7 +336,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv CommunityRating = GetClientCommunityRating(program.CommunityRating), IsRepeat = program.IsRepeat, EpisodeTitle = program.EpisodeTitle, - ChannelName = channelName, IsMovie = program.IsMovie, IsSeries = program.IsSeries, IsSports = program.IsSports, @@ -343,6 +347,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv Type = "Program" }; + if (channel != null) + { + dto.ChannelName = channel.Name; + + if (!string.IsNullOrEmpty(channel.PrimaryImagePath)) + { + dto.ChannelPrimaryImageTag = GetImageTag(channel); + } + } + var imageTag = GetImageTag(item); if (imageTag.HasValue) diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 2d91222c1..8577e7510 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -409,9 +409,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv var channel = GetChannel(program); - var channelName = channel == null ? null : channel.ChannelInfo.Name; - - var dto = _tvDtoService.GetProgramInfoDto(program, channelName, user); + var dto = _tvDtoService.GetProgramInfoDto(program, channel, user); await AddRecordingInfo(new[] { dto }, cancellationToken).ConfigureAwait(false); @@ -479,9 +477,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv { var channel = GetChannel(i); - var channelName = channel == null ? null : channel.ChannelInfo.Name; - - return _tvDtoService.GetProgramInfoDto(i, channelName, user); + return _tvDtoService.GetProgramInfoDto(i, channel, user); }) .ToArray(); @@ -541,9 +537,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv { var channel = GetChannel(i); - var channelName = channel == null ? null : channel.ChannelInfo.Name; - - return _tvDtoService.GetProgramInfoDto(i, channelName, user); + return _tvDtoService.GetProgramInfoDto(i, channel, user); }) .ToArray(); @@ -1342,6 +1336,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv info.Status = statusInfo.Status; info.StatusMessage = statusInfo.StatusMessage; + info.Version = statusInfo.Version; + info.HasUpdateAvailable = statusInfo.HasUpdateAvailable; + info.HomePageUrl = service.HomePageUrl; } catch (Exception ex) { diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 1bf4b8073..ee0488546 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.304 + 3.0.305 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 5b1d85616..c0893d26b 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.304 + 3.0.305 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index ae2c7770b..8feb93f2a 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.304 + 3.0.305 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +