implement direct play profile edit

This commit is contained in:
Luke Pulverenti 2014-03-28 22:28:02 -04:00
parent 5e5b1f180c
commit 1aa7eb4c62
4 changed files with 21 additions and 3 deletions

View File

@ -39,6 +39,9 @@ namespace MediaBrowser.Api.LiveTv
/// <value>The limit.</value> /// <value>The limit.</value>
[ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] [ApiMember(Name = "Limit", Description = "Optional. The maximum number of records to return", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Limit { get; set; } public int? Limit { get; set; }
[ApiMember(Name = "IsFavorite", Description = "Filter by channels that are favorites, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
public bool? IsFavorite { get; set; }
} }
[Route("/LiveTv/Channels/{Id}", "GET", Summary = "Gets a live tv channel")] [Route("/LiveTv/Channels/{Id}", "GET", Summary = "Gets a live tv channel")]
@ -290,7 +293,8 @@ namespace MediaBrowser.Api.LiveTv
ChannelType = request.Type, ChannelType = request.Type,
UserId = request.UserId, UserId = request.UserId,
StartIndex = request.StartIndex, StartIndex = request.StartIndex,
Limit = request.Limit Limit = request.Limit,
IsFavorite = request.IsFavorite
}, CancellationToken.None).Result; }, CancellationToken.None).Result;

View File

@ -12,6 +12,12 @@ namespace MediaBrowser.Model.LiveTv
/// <value>The type of the channel.</value> /// <value>The type of the channel.</value>
public ChannelType? ChannelType { get; set; } public ChannelType? ChannelType { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is favorite.
/// </summary>
/// <value><c>null</c> if [is favorite] contains no value, <c>true</c> if [is favorite]; otherwise, <c>false</c>.</value>
public bool? IsFavorite { get; set; }
/// <summary> /// <summary>
/// Gets or sets the user identifier. /// Gets or sets the user identifier.
/// </summary> /// </summary>

View File

@ -1297,7 +1297,7 @@ namespace MediaBrowser.Server.Implementations.Dto
{ {
var result = new List<MediaSourceInfo> var result = new List<MediaSourceInfo>
{ {
GetVersionInfo(item, true) GetVersionInfo(item)
}; };
return result; return result;
@ -1321,7 +1321,7 @@ namespace MediaBrowser.Server.Implementations.Dto
}; };
} }
private MediaSourceInfo GetVersionInfo(Audio i, bool isPrimary) private MediaSourceInfo GetVersionInfo(Audio i)
{ {
return new MediaSourceInfo return new MediaSourceInfo
{ {

View File

@ -134,6 +134,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return number; return number;
}); });
if (query.IsFavorite.HasValue)
{
var val = query.IsFavorite.Value;
channels = channels
.Where(i => _userDataManager.GetUserData(user.Id, i.GetUserDataKey()).IsFavorite == val);
}
} }
channels = channels.OrderBy(i => channels = channels.OrderBy(i =>