forked from jellyfin/jellyfin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added watchlist property, sorting, collections and repo Co-Authored-By: Simon Larsson <[email protected]> * Bugfix Made bool nullable, fixed sql typo Co-Authored-By: Simon Larsson <[email protected]> * Fixed copy/paste error --------- Co-authored-by: Simon Larsson <[email protected]> Endpoints for watchlist add and remove (#4) * Endpoints for watchlist add and remove Co-Authored-By: Simon Larsson <[email protected]> * Fixed blank line errors --------- Co-authored-by: Simon Larsson <[email protected]> Remove watchlist status when watched (#6) Add @simlar-0 and @yuvve to CONTRIBUTORS.md Fixed Null handling of isWatchlisted (#8) Fix typo (#10) Co-Authored-By: Simon Larsson <[email protected]>
- Loading branch information
Showing
20 changed files
with
312 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
Emby.Server.Implementations/Sorting/IsWatchlistedComparer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#nullable disable | ||
|
||
#pragma warning disable CS1591 | ||
|
||
using Jellyfin.Data.Entities; | ||
using Jellyfin.Data.Enums; | ||
using MediaBrowser.Controller.Entities; | ||
using MediaBrowser.Controller.Library; | ||
using MediaBrowser.Controller.Sorting; | ||
using MediaBrowser.Model.Querying; | ||
|
||
namespace Emby.Server.Implementations.Sorting | ||
{ | ||
public class IsWatchlistedComparer : IUserBaseItemComparer | ||
{ | ||
/// <summary> | ||
/// Gets or sets the user. | ||
/// </summary> | ||
/// <value>The user.</value> | ||
public User User { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the name. | ||
/// </summary> | ||
/// <value>The name.</value> | ||
public ItemSortBy Type => ItemSortBy.IsWatchlisted; | ||
|
||
/// <summary> | ||
/// Gets or sets the user data repository. | ||
/// </summary> | ||
/// <value>The user data repository.</value> | ||
public IUserDataManager UserDataRepository { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the user manager. | ||
/// </summary> | ||
/// <value>The user manager.</value> | ||
public IUserManager UserManager { get; set; } | ||
|
||
/// <summary> | ||
/// Compares the specified x. | ||
/// </summary> | ||
/// <param name="x">The x.</param> | ||
/// <param name="y">The y.</param> | ||
/// <returns>System.Int32.</returns> | ||
public int Compare(BaseItem x, BaseItem y) | ||
{ | ||
return GetValue(x).CompareTo(GetValue(y)); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the date. | ||
/// </summary> | ||
/// <param name="x">The x.</param> | ||
/// <returns>DateTime.</returns> | ||
private int GetValue(BaseItem x) | ||
{ | ||
return x.IsWatchlisted(User) ? 0 : 1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.