add more properties to LiveTvInfo

This commit is contained in:
Luke Pulverenti 2014-01-17 13:23:00 -05:00
parent 43a806ad02
commit 91e4f67139
11 changed files with 79 additions and 18 deletions

View File

@ -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);

View File

@ -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));
}
}
}

View File

@ -764,6 +764,14 @@ namespace MediaBrowser.Model.ApiClient
/// <param name="options">The options.</param>
/// <returns>System.String.</returns>
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>
/// 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>
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>
/// Gets the live tv timer asynchronous.
/// </summary>

View File

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

View File

@ -56,6 +56,24 @@ namespace MediaBrowser.Model.LiveTv
/// <value>The name of the active service.</value>
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()
{
Services = new List<LiveTvServiceInfo>();

View File

@ -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
{
/// <summary>
/// Id of the program.
@ -186,6 +187,8 @@ namespace MediaBrowser.Model.LiveTv
Genres = new List<string>();
ImageTags = new Dictionary<ImageType, Guid>();
}
public event PropertyChangedEventHandler PropertyChanged;
}
public enum ProgramAudio

View File

@ -1,10 +1,11 @@

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

View File

@ -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
{
/// <summary>
/// Id of the recording.
@ -226,5 +227,7 @@ namespace MediaBrowser.Model.LiveTv
Genres = new List<string>();
ImageTags = new Dictionary<ImageType, Guid>();
}
public event PropertyChangedEventHandler PropertyChanged;
}
}

View File

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

View File

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

View File

@ -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;
}