IGroupController.cs 3.2 KB

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