Просмотр исходного кода

display tv service version info

Luke Pulverenti 11 лет назад
Родитель
Сommit
fb335141fb

+ 13 - 1
MediaBrowser.Api/UserLibrary/ArtistsService.cs

@@ -112,7 +112,19 @@ namespace MediaBrowser.Api.UserLibrary
         protected override IEnumerable<MusicArtist> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> 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<BaseItem> GetLibraryItems(MusicArtist item, IEnumerable<BaseItem> libraryItems)

+ 6 - 0
MediaBrowser.Controller/LiveTv/ILiveTvService.cs

@@ -26,6 +26,12 @@ namespace MediaBrowser.Controller.LiveTv
         /// <value>The name.</value>
         string Name { get; }
 
+        /// <summary>
+        /// Gets the home page URL.
+        /// </summary>
+        /// <value>The home page URL.</value>
+        string HomePageUrl { get; }
+
         /// <summary>
         /// Gets the status information asynchronous.
         /// </summary>

+ 12 - 0
MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs

@@ -15,5 +15,17 @@ namespace MediaBrowser.Controller.LiveTv
         /// </summary>
         /// <value>The status message.</value>
         public string StatusMessage { get; set; }
+
+        /// <summary>
+        /// Gets or sets the version.
+        /// </summary>
+        /// <value>The version.</value>
+        public string Version { get; set; }
+
+        /// <summary>
+        /// Gets or sets a value indicating whether this instance has update available.
+        /// </summary>
+        /// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
+        public bool HasUpdateAvailable { get; set; }
     }
 }

+ 6 - 0
MediaBrowser.Controller/LiveTv/ProgramInfo.cs

@@ -17,6 +17,12 @@ namespace MediaBrowser.Controller.LiveTv
         /// <value>The channel identifier.</value>
         public string ChannelId { get; set; }
 
+        /// <summary>
+        /// Gets or sets the channel primary image tag.
+        /// </summary>
+        /// <value>The channel primary image tag.</value>
+        public Guid? ChannelPrimaryImageTag { get; set; }
+
         /// <summary>
         /// Name of the program
         /// </summary>

+ 8 - 0
MediaBrowser.Model/ApiClient/IApiClient.cs

@@ -1017,6 +1017,14 @@ namespace MediaBrowser.Model.ApiClient
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <returns>Task{QueryResult{ProgramInfoDto}}.</returns>
         Task<QueryResult<ProgramInfoDto>> GetLiveTvProgramsAsync(ProgramQuery query, CancellationToken cancellationToken);
+
+        /// <summary>
+        /// Gets the recommended live tv programs asynchronous.
+        /// </summary>
+        /// <param name="query">The query.</param>
+        /// <param name="cancellationToken">The cancellation token.</param>
+        /// <returns>Task{QueryResult{ProgramInfoDto}}.</returns>
+        Task<QueryResult<ProgramInfoDto>> GetRecommendedLiveTvProgramsAsync(RecommendedProgramQuery query, CancellationToken cancellationToken);
         
         /// <summary>
         /// Gets the live tv timer asynchronous.

+ 18 - 0
MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs

@@ -14,6 +14,12 @@ namespace MediaBrowser.Model.LiveTv
         /// <value>The name.</value>
         public string Name { get; set; }
 
+        /// <summary>
+        /// Gets or sets the home page URL.
+        /// </summary>
+        /// <value>The home page URL.</value>
+        public string HomePageUrl { get; set; }
+
         /// <summary>
         /// Gets or sets the status.
         /// </summary>
@@ -25,6 +31,18 @@ namespace MediaBrowser.Model.LiveTv
         /// </summary>
         /// <value>The status message.</value>
         public string StatusMessage { get; set; }
+
+        /// <summary>
+        /// Gets or sets the version.
+        /// </summary>
+        /// <value>The version.</value>
+        public string Version { get; set; }
+
+        /// <summary>
+        /// Gets or sets a value indicating whether this instance has update available.
+        /// </summary>
+        /// <value><c>true</c> if this instance has update available; otherwise, <c>false</c>.</value>
+        public bool HasUpdateAvailable { get; set; }
     }
 
     public class GuideInfo

+ 6 - 0
MediaBrowser.Model/LiveTv/ProgramInfoDto.cs

@@ -37,6 +37,12 @@ namespace MediaBrowser.Model.LiveTv
         /// <value>The channel identifier.</value>
         public string ChannelId { get; set; }
 
+        /// <summary>
+        /// Gets or sets the channel primary image tag.
+        /// </summary>
+        /// <value>The channel primary image tag.</value>
+        public Guid? ChannelPrimaryImageTag { get; set; }
+
         /// <summary>
         /// Gets or sets the name of the channel.
         /// </summary>

+ 8 - 2
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
         /// </summary>
         public string ChannelId { get; set; }
 
+        /// <summary>
+        /// Gets or sets the channel primary image tag.
+        /// </summary>
+        /// <value>The channel primary image tag.</value>
+        public Guid? ChannelPrimaryImageTag { get; set; }
+
         /// <summary>
         /// ChannelName of the recording.
         /// </summary>

+ 19 - 5
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)

+ 6 - 9
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)
             {

+ 2 - 2
Nuget/MediaBrowser.Common.Internal.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Common.Internal</id>
-        <version>3.0.304</version>
+        <version>3.0.305</version>
         <title>MediaBrowser.Common.Internal</title>
         <authors>Luke</authors>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.304" />
+            <dependency id="MediaBrowser.Common" version="3.0.305" />
             <dependency id="NLog" version="2.1.0" />
             <dependency id="SimpleInjector" version="2.4.0" />
             <dependency id="sharpcompress" version="0.10.2" />

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Common</id>
-        <version>3.0.304</version>
+        <version>3.0.305</version>
         <title>MediaBrowser.Common</title>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>

+ 2 - 2
Nuget/MediaBrowser.Server.Core.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Server.Core</id>
-        <version>3.0.304</version>
+        <version>3.0.305</version>
         <title>Media Browser.Server.Core</title>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains core components required to build plugins for Media Browser Server.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.304" />
+            <dependency id="MediaBrowser.Common" version="3.0.305" />
         </dependencies>
     </metadata>
     <files>