diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 9f45df8e6a..7ccb83bc80 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -295,11 +295,18 @@ namespace MediaBrowser.Api.LiveTv public object Get(GetLiveTvInfo request) { 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 { - 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); diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 119b4dd7e0..7910e99571 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1087,7 +1087,8 @@ namespace MediaBrowser.Controller.Entities 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)); } } } diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index edabd4abac..cf90fb7571 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -764,6 +764,14 @@ namespace MediaBrowser.Model.ApiClient /// The options. /// System.String. string GetImageUrl(RecordingInfoDto item, ImageOptions options); + + /// + /// Gets the image URL. + /// + /// The item. + /// The options. + /// System.String. + string GetImageUrl(ProgramInfoDto item, ImageOptions options); /// /// Gets an image url that can be used to download an image from the api @@ -1002,6 +1010,14 @@ namespace MediaBrowser.Model.ApiClient /// Task{QueryResult{TimerInfoDto}}. Task> GetLiveTvTimersAsync(TimerQuery query, CancellationToken cancellationToken); + /// + /// Gets the live tv programs asynchronous. + /// + /// The query. + /// The cancellation token. + /// Task{QueryResult{ProgramInfoDto}}. + Task> GetLiveTvProgramsAsync(ProgramQuery query, CancellationToken cancellationToken); + /// /// Gets the live tv timer asynchronous. /// diff --git a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs index afce042308..9ea15739fe 100644 --- a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs +++ b/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 System; using System.Collections.Generic; @@ -8,7 +9,7 @@ namespace MediaBrowser.Model.LiveTv /// /// Class ChannelInfoDto /// - public class ChannelInfoDto : IItemDto + public class ChannelInfoDto : INotifyPropertyChanged, IItemDto { /// /// Gets or sets the name. @@ -27,19 +28,19 @@ namespace MediaBrowser.Model.LiveTv /// /// The external identifier. public string ExternalId { get; set; } - + /// /// Gets or sets the image tags. /// /// The image tags. public Dictionary ImageTags { get; set; } - + /// /// Gets or sets the number. /// /// The number. public string Number { get; set; } - + /// /// Gets or sets the name of the service. /// @@ -87,10 +88,12 @@ namespace MediaBrowser.Model.LiveTv /// /// The original primary image aspect ratio. public double? OriginalPrimaryImageAspectRatio { get; set; } - + public ChannelInfoDto() { ImageTags = new Dictionary(); } + + public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs b/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs index f59a707adf..dd2dc81bd3 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs @@ -56,6 +56,24 @@ namespace MediaBrowser.Model.LiveTv /// The name of the active service. public string ActiveServiceName { get; set; } + /// + /// Gets or sets a value indicating whether this instance is enabled. + /// + /// true if this instance is enabled; otherwise, false. + public bool IsEnabled { get; set; } + + /// + /// Gets or sets the status. + /// + /// The status. + public LiveTvServiceStatus Status { get; set; } + + /// + /// Gets or sets the status message. + /// + /// The status message. + public string StatusMessage { get; set; } + public LiveTvInfo() { Services = new List(); diff --git a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs index 0798a22943..aeaf2c15ba 100644 --- a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs +++ b/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 System; using System.Collections.Generic; namespace MediaBrowser.Model.LiveTv { - public class ProgramInfoDto + public class ProgramInfoDto : INotifyPropertyChanged { /// /// Id of the program. @@ -186,6 +187,8 @@ namespace MediaBrowser.Model.LiveTv Genres = new List(); ImageTags = new Dictionary(); } + + public event PropertyChangedEventHandler PropertyChanged; } public enum ProgramAudio diff --git a/MediaBrowser.Model/LiveTv/RecordingGroupDto.cs b/MediaBrowser.Model/LiveTv/RecordingGroupDto.cs index 29f0824fb1..fca2e1fe41 100644 --- a/MediaBrowser.Model/LiveTv/RecordingGroupDto.cs +++ b/MediaBrowser.Model/LiveTv/RecordingGroupDto.cs @@ -1,10 +1,11 @@ - +using System.ComponentModel; + namespace MediaBrowser.Model.LiveTv { /// /// Class RecordingGroupDto. /// - public class RecordingGroupDto + public class RecordingGroupDto : INotifyPropertyChanged { /// /// Gets or sets the name. @@ -23,5 +24,7 @@ namespace MediaBrowser.Model.LiveTv /// /// The recording count. public int RecordingCount { get; set; } + + public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs index ceb976689d..5076e9d02b 100644 --- a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs +++ b/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 System; using System.Collections.Generic; namespace MediaBrowser.Model.LiveTv { - public class RecordingInfoDto + public class RecordingInfoDto : INotifyPropertyChanged { /// /// Id of the recording. @@ -226,5 +227,7 @@ namespace MediaBrowser.Model.LiveTv Genres = new List(); ImageTags = new Dictionary(); } + + public event PropertyChangedEventHandler PropertyChanged; } } \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs index a8c6a2e37a..3426fd4cbf 100644 --- a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs @@ -1,9 +1,10 @@ using System; using System.Collections.Generic; +using System.ComponentModel; namespace MediaBrowser.Model.LiveTv { - public class SeriesTimerInfoDto + public class SeriesTimerInfoDto : INotifyPropertyChanged { /// /// Id of the recording. @@ -134,5 +135,7 @@ namespace MediaBrowser.Model.LiveTv { Days = new List(); } + + public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs index 507ba09478..32580d3e3c 100644 --- a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs @@ -1,8 +1,9 @@ using System; +using System.ComponentModel; namespace MediaBrowser.Model.LiveTv { - public class TimerInfoDto + public class TimerInfoDto : INotifyPropertyChanged { /// /// Id of the recording. @@ -128,5 +129,7 @@ namespace MediaBrowser.Model.LiveTv /// /// The program information. public ProgramInfoDto ProgramInfo { get; set; } + + public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs b/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs index c440bf7675..9b4f17a86f 100644 --- a/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs +++ b/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs @@ -172,7 +172,8 @@ namespace MediaBrowser.Providers.Movies 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; }