aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-03-28 22:28:02 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-03-28 22:28:02 -0400
commit1aa7eb4c6276ac80b3a77f66afb244083bdb77a4 (patch)
treeecb35bd2ff2f2c66b6754d0c6a2cdd145f2a792e
parent5e5b1f180c2a13152c8f318f045547c6508c5b3e (diff)
implement direct play profile edit
-rw-r--r--MediaBrowser.Api/LiveTv/LiveTvService.cs6
-rw-r--r--MediaBrowser.Model/LiveTv/ChannelQuery.cs6
-rw-r--r--MediaBrowser.Server.Implementations/Dto/DtoService.cs4
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs8
4 files changed, 21 insertions, 3 deletions
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs
index 96fe01ab3..abeaba910 100644
--- a/MediaBrowser.Api/LiveTv/LiveTvService.cs
+++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs
@@ -39,6 +39,9 @@ namespace MediaBrowser.Api.LiveTv
/// <value>The limit.</value>
[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; }
+
+ [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")]
@@ -290,7 +293,8 @@ namespace MediaBrowser.Api.LiveTv
ChannelType = request.Type,
UserId = request.UserId,
StartIndex = request.StartIndex,
- Limit = request.Limit
+ Limit = request.Limit,
+ IsFavorite = request.IsFavorite
}, CancellationToken.None).Result;
diff --git a/MediaBrowser.Model/LiveTv/ChannelQuery.cs b/MediaBrowser.Model/LiveTv/ChannelQuery.cs
index eb3b20ce3..9079ebacd 100644
--- a/MediaBrowser.Model/LiveTv/ChannelQuery.cs
+++ b/MediaBrowser.Model/LiveTv/ChannelQuery.cs
@@ -13,6 +13,12 @@ namespace MediaBrowser.Model.LiveTv
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>
/// Gets or sets the user identifier.
/// </summary>
/// <value>The user identifier.</value>
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index 1833b708f..2e0b3cb17 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -1297,7 +1297,7 @@ namespace MediaBrowser.Server.Implementations.Dto
{
var result = new List<MediaSourceInfo>
{
- GetVersionInfo(item, true)
+ GetVersionInfo(item)
};
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
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
index db8786d62..b828dc0de 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -134,6 +134,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv
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 =>