浏览代码

add more properties to LiveTvInfo

Luke Pulverenti 11 年之前
父节点
当前提交
91e4f67139

+ 9 - 2
MediaBrowser.Api/LiveTv/LiveTvService.cs

@@ -295,11 +295,18 @@ namespace MediaBrowser.Api.LiveTv
         public object Get(GetLiveTvInfo request)
         public object Get(GetLiveTvInfo request)
         {
         {
             var services = _liveTvManager.GetServiceInfos(CancellationToken.None).Result;
             var services = _liveTvManager.GetServiceInfos(CancellationToken.None).Result;
+            var servicesList = services.ToList();
+
+            var activeServiceInfo = _liveTvManager.ActiveService == null ? null :
+                servicesList.FirstOrDefault(i => string.Equals(i.Name, _liveTvManager.ActiveService.Name, StringComparison.OrdinalIgnoreCase));
 
 
             var info = new LiveTvInfo
             var info = new LiveTvInfo
             {
             {
-                Services = services.ToList(),
-                ActiveServiceName = _liveTvManager.ActiveService == null ? null : _liveTvManager.ActiveService.Name
+                Services = servicesList.ToList(),
+                ActiveServiceName = activeServiceInfo == null ? null : activeServiceInfo.Name,
+                IsEnabled = _liveTvManager.ActiveService != null,
+                Status = activeServiceInfo == null ? LiveTvServiceStatus.Unavailable : activeServiceInfo.Status,
+                StatusMessage = activeServiceInfo == null ? null : activeServiceInfo.StatusMessage
             };
             };
 
 
             return ToOptimizedResult(info);
             return ToOptimizedResult(info);

+ 2 - 1
MediaBrowser.Controller/Entities/Folder.cs

@@ -1087,7 +1087,8 @@ namespace MediaBrowser.Controller.Entities
 
 
         public override bool IsPlayed(User user)
         public override bool IsPlayed(User user)
         {
         {
-            return GetRecursiveChildren(user).Where(i => !i.IsFolder).All(i => i.IsPlayed(user));
+            return GetRecursiveChildren(user).Where(i => !i.IsFolder && i.LocationType != LocationType.Virtual)
+                .All(i => i.IsPlayed(user));
         }
         }
     }
     }
 }
 }

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

@@ -764,6 +764,14 @@ namespace MediaBrowser.Model.ApiClient
         /// <param name="options">The options.</param>
         /// <param name="options">The options.</param>
         /// <returns>System.String.</returns>
         /// <returns>System.String.</returns>
         string GetImageUrl(RecordingInfoDto item, ImageOptions options);
         string GetImageUrl(RecordingInfoDto item, ImageOptions options);
+
+        /// <summary>
+        /// Gets the image URL.
+        /// </summary>
+        /// <param name="item">The item.</param>
+        /// <param name="options">The options.</param>
+        /// <returns>System.String.</returns>
+        string GetImageUrl(ProgramInfoDto item, ImageOptions options);
         
         
         /// <summary>
         /// <summary>
         /// Gets an image url that can be used to download an image from the api
         /// Gets an image url that can be used to download an image from the api
@@ -1002,6 +1010,14 @@ namespace MediaBrowser.Model.ApiClient
         /// <returns>Task{QueryResult{TimerInfoDto}}.</returns>
         /// <returns>Task{QueryResult{TimerInfoDto}}.</returns>
         Task<QueryResult<TimerInfoDto>> GetLiveTvTimersAsync(TimerQuery query, CancellationToken cancellationToken);
         Task<QueryResult<TimerInfoDto>> GetLiveTvTimersAsync(TimerQuery query, CancellationToken cancellationToken);
 
 
+        /// <summary>
+        /// Gets the 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>> GetLiveTvProgramsAsync(ProgramQuery query, CancellationToken cancellationToken);
+        
         /// <summary>
         /// <summary>
         /// Gets the live tv timer asynchronous.
         /// Gets the live tv timer asynchronous.
         /// </summary>
         /// </summary>

+ 9 - 6
MediaBrowser.Model/LiveTv/ChannelInfoDto.cs

@@ -1,4 +1,5 @@
-using MediaBrowser.Model.Dto;
+using System.ComponentModel;
+using MediaBrowser.Model.Dto;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
@@ -8,7 +9,7 @@ namespace MediaBrowser.Model.LiveTv
     /// <summary>
     /// <summary>
     /// Class ChannelInfoDto
     /// Class ChannelInfoDto
     /// </summary>
     /// </summary>
-    public class ChannelInfoDto : IItemDto
+    public class ChannelInfoDto : INotifyPropertyChanged, IItemDto
     {
     {
         /// <summary>
         /// <summary>
         /// Gets or sets the name.
         /// Gets or sets the name.
@@ -27,19 +28,19 @@ namespace MediaBrowser.Model.LiveTv
         /// </summary>
         /// </summary>
         /// <value>The external identifier.</value>
         /// <value>The external identifier.</value>
         public string ExternalId { get; set; }
         public string ExternalId { get; set; }
-        
+
         /// <summary>
         /// <summary>
         /// Gets or sets the image tags.
         /// Gets or sets the image tags.
         /// </summary>
         /// </summary>
         /// <value>The image tags.</value>
         /// <value>The image tags.</value>
         public Dictionary<ImageType, Guid> ImageTags { get; set; }
         public Dictionary<ImageType, Guid> ImageTags { get; set; }
-        
+
         /// <summary>
         /// <summary>
         /// Gets or sets the number.
         /// Gets or sets the number.
         /// </summary>
         /// </summary>
         /// <value>The number.</value>
         /// <value>The number.</value>
         public string Number { get; set; }
         public string Number { get; set; }
-        
+
         /// <summary>
         /// <summary>
         /// Gets or sets the name of the service.
         /// Gets or sets the name of the service.
         /// </summary>
         /// </summary>
@@ -87,10 +88,12 @@ namespace MediaBrowser.Model.LiveTv
         /// </summary>
         /// </summary>
         /// <value>The original primary image aspect ratio.</value>
         /// <value>The original primary image aspect ratio.</value>
         public double? OriginalPrimaryImageAspectRatio { get; set; }
         public double? OriginalPrimaryImageAspectRatio { get; set; }
-        
+
         public ChannelInfoDto()
         public ChannelInfoDto()
         {
         {
             ImageTags = new Dictionary<ImageType, Guid>();
             ImageTags = new Dictionary<ImageType, Guid>();
         }
         }
+
+        public event PropertyChangedEventHandler PropertyChanged;
     }
     }
 }
 }

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

@@ -56,6 +56,24 @@ namespace MediaBrowser.Model.LiveTv
         /// <value>The name of the active service.</value>
         /// <value>The name of the active service.</value>
         public string ActiveServiceName { get; set; }
         public string ActiveServiceName { get; set; }
 
 
+        /// <summary>
+        /// Gets or sets a value indicating whether this instance is enabled.
+        /// </summary>
+        /// <value><c>true</c> if this instance is enabled; otherwise, <c>false</c>.</value>
+        public bool IsEnabled { get; set; }
+
+        /// <summary>
+        /// Gets or sets the status.
+        /// </summary>
+        /// <value>The status.</value>
+        public LiveTvServiceStatus Status { get; set; }
+
+        /// <summary>
+        /// Gets or sets the status message.
+        /// </summary>
+        /// <value>The status message.</value>
+        public string StatusMessage { get; set; }
+
         public LiveTvInfo()
         public LiveTvInfo()
         {
         {
             Services = new List<LiveTvServiceInfo>();
             Services = new List<LiveTvServiceInfo>();

+ 5 - 2
MediaBrowser.Model/LiveTv/ProgramInfoDto.cs

@@ -1,11 +1,12 @@
-using MediaBrowser.Model.Dto;
+using System.ComponentModel;
+using MediaBrowser.Model.Dto;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace MediaBrowser.Model.LiveTv
 namespace MediaBrowser.Model.LiveTv
 {
 {
-    public class ProgramInfoDto
+    public class ProgramInfoDto : INotifyPropertyChanged
     {
     {
         /// <summary>
         /// <summary>
         /// Id of the program.
         /// Id of the program.
@@ -186,6 +187,8 @@ namespace MediaBrowser.Model.LiveTv
             Genres = new List<string>();
             Genres = new List<string>();
             ImageTags = new Dictionary<ImageType, Guid>();
             ImageTags = new Dictionary<ImageType, Guid>();
         }
         }
+
+        public event PropertyChangedEventHandler PropertyChanged;
     }
     }
 
 
     public enum ProgramAudio
     public enum ProgramAudio

+ 5 - 2
MediaBrowser.Model/LiveTv/RecordingGroupDto.cs

@@ -1,10 +1,11 @@
-
+using System.ComponentModel;
+
 namespace MediaBrowser.Model.LiveTv
 namespace MediaBrowser.Model.LiveTv
 {
 {
     /// <summary>
     /// <summary>
     /// Class RecordingGroupDto.
     /// Class RecordingGroupDto.
     /// </summary>
     /// </summary>
-    public class RecordingGroupDto
+    public class RecordingGroupDto : INotifyPropertyChanged
     {
     {
         /// <summary>
         /// <summary>
         /// Gets or sets the name.
         /// Gets or sets the name.
@@ -23,5 +24,7 @@ namespace MediaBrowser.Model.LiveTv
         /// </summary>
         /// </summary>
         /// <value>The recording count.</value>
         /// <value>The recording count.</value>
         public int RecordingCount { get; set; }
         public int RecordingCount { get; set; }
+
+        public event PropertyChangedEventHandler PropertyChanged;
     }
     }
 }
 }

+ 5 - 2
MediaBrowser.Model/LiveTv/RecordingInfoDto.cs

@@ -1,11 +1,12 @@
-using MediaBrowser.Model.Dto;
+using System.ComponentModel;
+using MediaBrowser.Model.Dto;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
 namespace MediaBrowser.Model.LiveTv
 namespace MediaBrowser.Model.LiveTv
 {
 {
-    public class RecordingInfoDto
+    public class RecordingInfoDto : INotifyPropertyChanged
     {
     {
         /// <summary>
         /// <summary>
         /// Id of the recording.
         /// Id of the recording.
@@ -226,5 +227,7 @@ namespace MediaBrowser.Model.LiveTv
             Genres = new List<string>();
             Genres = new List<string>();
             ImageTags = new Dictionary<ImageType, Guid>();
             ImageTags = new Dictionary<ImageType, Guid>();
         }
         }
+
+        public event PropertyChangedEventHandler PropertyChanged;
     }
     }
 }
 }

+ 4 - 1
MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs

@@ -1,9 +1,10 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.ComponentModel;
 
 
 namespace MediaBrowser.Model.LiveTv
 namespace MediaBrowser.Model.LiveTv
 {
 {
-    public class SeriesTimerInfoDto
+    public class SeriesTimerInfoDto : INotifyPropertyChanged
     {
     {
         /// <summary>
         /// <summary>
         /// Id of the recording.
         /// Id of the recording.
@@ -134,5 +135,7 @@ namespace MediaBrowser.Model.LiveTv
         {
         {
             Days = new List<DayOfWeek>();
             Days = new List<DayOfWeek>();
         }
         }
+
+        public event PropertyChangedEventHandler PropertyChanged;
     }
     }
 }
 }

+ 4 - 1
MediaBrowser.Model/LiveTv/TimerInfoDto.cs

@@ -1,8 +1,9 @@
 using System;
 using System;
+using System.ComponentModel;
 
 
 namespace MediaBrowser.Model.LiveTv
 namespace MediaBrowser.Model.LiveTv
 {
 {
-    public class TimerInfoDto
+    public class TimerInfoDto : INotifyPropertyChanged
     {
     {
         /// <summary>
         /// <summary>
         /// Id of the recording.
         /// Id of the recording.
@@ -128,5 +129,7 @@ namespace MediaBrowser.Model.LiveTv
         /// </summary>
         /// </summary>
         /// <value>The program information.</value>
         /// <value>The program information.</value>
         public ProgramInfoDto ProgramInfo { get; set; }
         public ProgramInfoDto ProgramInfo { get; set; }
+
+        public event PropertyChangedEventHandler PropertyChanged;
     }
     }
 }
 }

+ 2 - 1
MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs

@@ -172,7 +172,8 @@ namespace MediaBrowser.Providers.Movies
                     item.CommunityRating = imdbRating;
                     item.CommunityRating = imdbRating;
                 }
                 }
 
 
-                if (!string.IsNullOrEmpty(result.Website))
+                if (!string.IsNullOrEmpty(result.Website)
+                        && !string.Equals(result.Website, "n/a", StringComparison.OrdinalIgnoreCase))
                 {
                 {
                     item.HomePageUrl = result.Website;
                     item.HomePageUrl = result.Website;
                 }
                 }