IGroupController.cs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using System.Threading;
  3. using Jellyfin.Data.Entities;
  4. using MediaBrowser.Controller.Session;
  5. using MediaBrowser.Controller.SyncPlay.Queue;
  6. using MediaBrowser.Model.SyncPlay;
  7. namespace MediaBrowser.Controller.SyncPlay
  8. {
  9. /// <summary>
  10. /// Interface IGroupController.
  11. /// </summary>
  12. public interface IGroupController
  13. {
  14. /// <summary>
  15. /// Gets the group identifier.
  16. /// </summary>
  17. /// <value>The group identifier.</value>
  18. Guid GroupId { get; }
  19. /// <summary>
  20. /// Gets the play queue.
  21. /// </summary>
  22. /// <value>The play queue.</value>
  23. PlayQueueManager PlayQueue { get; }
  24. /// <summary>
  25. /// Checks if the group is empty.
  26. /// </summary>
  27. /// <returns><c>true</c> if the group is empty, <c>false</c> otherwise.</returns>
  28. bool IsGroupEmpty();
  29. /// <summary>
  30. /// Initializes the group with the session's info.
  31. /// </summary>
  32. /// <param name="session">The session.</param>
  33. /// <param name="request">The request.</param>
  34. /// <param name="cancellationToken">The cancellation token.</param>
  35. void CreateGroup(SessionInfo session, NewGroupRequest request, CancellationToken cancellationToken);
  36. /// <summary>
  37. /// Adds the session to the group.
  38. /// </summary>
  39. /// <param name="session">The session.</param>
  40. /// <param name="request">The request.</param>
  41. /// <param name="cancellationToken">The cancellation token.</param>
  42. void SessionJoin(SessionInfo session, JoinGroupRequest request, CancellationToken cancellationToken);
  43. /// <summary>
  44. /// Restores the state of a session that already joined the group.
  45. /// </summary>
  46. /// <param name="session">The session.</param>
  47. /// <param name="request">The request.</param>
  48. /// <param name="cancellationToken">The cancellation token.</param>
  49. void SessionRestore(SessionInfo session, JoinGroupRequest request, CancellationToken cancellationToken);
  50. /// <summary>
  51. /// Removes the session from the group.
  52. /// </summary>
  53. /// <param name="session">The session.</param>
  54. /// <param name="cancellationToken">The cancellation token.</param>
  55. void SessionLeave(SessionInfo session, CancellationToken cancellationToken);
  56. /// <summary>
  57. /// Handles the requested action by the session.
  58. /// </summary>
  59. /// <param name="session">The session.</param>
  60. /// <param name="request">The requested action.</param>
  61. /// <param name="cancellationToken">The cancellation token.</param>
  62. void HandleRequest(SessionInfo session, IGroupPlaybackRequest request, CancellationToken cancellationToken);
  63. /// <summary>
  64. /// Gets the info about the group for the clients.
  65. /// </summary>
  66. /// <returns>The group info for the clients.</returns>
  67. GroupInfoDto GetInfo();
  68. /// <summary>
  69. /// Checks if a user has access to all content in the play queue.
  70. /// </summary>
  71. /// <param name="user">The user.</param>
  72. /// <returns><c>true</c> if the user can access the play queue; <c>false</c> otherwise.</returns>
  73. bool HasAccessToPlayQueue(User user);
  74. }
  75. }