Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider;

public interface IListenTogetherSyncProvidable : IListenTogetherProvidable
{
public Task<ProviderListenTogetherStatus> JoinListenTogetherRoomAsync(string roomId, string inviterId, CancellationToken ctk = new());

public Task<TimeSpan?> SendListenTogetherHeartbeatAsync(string roomId, ProviderListenTogetherHeartbeat heartbeat, CancellationToken ctk = new());

public Task<ProviderListenTogetherRoomState> GetListenTogetherRoomStateAsync(string roomId, CancellationToken ctk = new());

public Task<List<SingleSongBase>> GetListenTogetherQueueSongsAsync(IReadOnlyList<string> itemIds, CancellationToken ctk = new());

public Task EndListenTogetherRoomAsync(string roomId, CancellationToken ctk = new());
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using HyPlayer.PlayCore.Abstraction.Models;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider;

public interface IMultiListenTogetherProvidable : IProvider
{
public Task<ProviderMultiListenTogetherRoom> CreateMultiListenTogetherRoomAsync(string seedItemId, CancellationToken ctk = new());

public Task<ProviderMultiListenTogetherRoom> JoinMultiListenTogetherRoomAsync(string roomId, string inviterId, CancellationToken ctk = new());

public Task<ProviderMultiListenTogetherRoom?> GetMultiListenTogetherRoomAsync(CancellationToken ctk = new());

public Task<ProviderMultiListenTogetherHeartbeat> SendMultiListenTogetherHeartbeatAsync(string roomId, CancellationToken ctk = new());

public Task<List<ProviderMultiListenTogetherQueueItem>> GetMultiListenTogetherQueueAsync(string roomId, CancellationToken ctk = new());

public Task<ProviderMultiListenTogetherOperation> RecommendMultiListenTogetherItemAsync(string roomId, string itemId, CancellationToken ctk = new());

public Task<ProviderMultiListenTogetherOperation> RequestMultiListenTogetherSkipAsync(string roomId, string itemId, string entryId, CancellationToken ctk = new());

public Task LeaveMultiListenTogetherRoomAsync(string roomId, CancellationToken ctk = new());
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace HyPlayer.PlayCore.Abstraction.Models;

public sealed class ProviderListenTogetherHeartbeat
{
public required string ItemId { get; init; }

public bool IsPlaying { get; init; }

public TimeSpan Position { get; init; }

public string? UserId { get; init; }

public long PlaylistVersion { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ namespace HyPlayer.PlayCore.Abstraction.Models;
public sealed class ProviderListenTogetherQueueReport
{
public required List<SingleSongBase> Queue { get; init; }

public List<SingleSongBase>? RandomQueue { get; init; }
public string? UserId { get; init; }
public string PlayModeId { get; init; } = "seq";
public int ClientSeq { get; init; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace HyPlayer.PlayCore.Abstraction.Models;

public sealed class ProviderListenTogetherRoomState
{
public List<string> DisplayItemIds { get; init; } = [];

public List<string> RandomItemIds { get; init; } = [];

public string? PlayModeId { get; init; }

public List<ProviderListenTogetherQueueVersion> Versions { get; init; } = [];

public ProviderListenTogetherRemoteCommand? LastCommand { get; init; }
}

public sealed class ProviderListenTogetherQueueVersion
{
public required string UserId { get; init; }

public long Version { get; init; }
}

public sealed class ProviderListenTogetherRemoteCommand
{
public required string CommandId { get; init; }

public string? UserId { get; init; }

public string? FormerItemId { get; init; }

public string? TargetItemId { get; init; }

public TimeSpan Position { get; init; }

public bool IsPlaying { get; init; }

public long ClientSeq { get; init; }

public long ServerSeq { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ public sealed class ProviderListenTogetherStatus
{
public bool IsInRoom { get; init; }
public string? RoomId { get; init; }

public string? CreatorId { get; init; }
public bool IsMultiRoom { get; init; }
public List<ProviderListenTogetherUser> Users { get; init; } = [];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
namespace HyPlayer.PlayCore.Abstraction.Models;

public sealed class ProviderMultiListenTogetherRoom
{
public required string RoomId { get; init; }
public string? CreatorId { get; init; }
public List<ProviderListenTogetherUser> Users { get; init; } = [];
public ProviderMultiListenTogetherPlayback? Playback { get; init; }
public bool CanRecommend { get; init; } = true;
public bool CanRequestSkip { get; init; } = true;
}

public sealed class ProviderMultiListenTogetherPlayback
{
public required string ItemId { get; init; }
public required string EntryId { get; init; }
public string? RecommenderId { get; init; }
public TimeSpan Position { get; init; }
public TimeSpan Duration { get; init; }
public long Version { get; init; }
public List<string> NextItemIds { get; init; } = [];
}

public sealed class ProviderMultiListenTogetherHeartbeat
{
public ProviderMultiListenTogetherPlayback? Playback { get; init; }
public TimeSpan? Interval { get; init; }
public bool IsClosed { get; init; }
}

public sealed class ProviderMultiListenTogetherQueueItem
{
public required string ItemId { get; init; }
public required string EntryId { get; init; }
public required string Title { get; init; }
public string Artists { get; init; } = string.Empty;
public string? CoverUrl { get; init; }
public string? RecommenderId { get; init; }
public string RecommenderName { get; init; } = string.Empty;
public bool IsSystemRecommendation { get; init; }
public bool IsPlaying { get; init; }
}

public sealed class ProviderMultiListenTogetherOperation
{
public bool Succeeded { get; init; }
public string Message { get; init; } = string.Empty;
public ProviderMultiListenTogetherPlayback? Playback { get; init; }
}
Loading