aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/LiveTv
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/LiveTv')
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
index 562b97a48..64f7a3373 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -194,8 +194,33 @@ namespace MediaBrowser.Server.Implementations.LiveTv
}
}
+ var enableFavoriteSorting = query.EnableFavoriteSorting;
+
channels = channels.OrderBy(i =>
{
+ if (enableFavoriteSorting)
+ {
+ var userData = _userDataManager.GetUserData(user.Id, i.GetUserDataKey());
+
+ if (userData.IsFavorite)
+ {
+ return 0;
+ }
+ if (userData.Likes.HasValue)
+ {
+ if (!userData.Likes.Value)
+ {
+ return 3;
+ }
+
+ return 1;
+ }
+ }
+
+ return 2;
+ })
+ .ThenBy(i =>
+ {
double number = 0;
if (!string.IsNullOrEmpty(i.Number))