watchparty/src/WatchParty/Parties/Party.cs
Nicolas db815df7d5 Fix plugin to build clean against real Emby 4.9.1.90 SDK
Installed .NET 8 SDK (per-user, winget needed admin elevation this
machine doesn't have) and restored the real MediaBrowser.Server.Core /
MediaBrowser.Common packages, then fixed everything the compiler and
a bit of reflection surfaced:

- PlaybackProgressEventArgs/PlaybackStopEventArgs are in
  MediaBrowser.Controller.Library, not ...Session
- IAuthorizationContext/AuthorizationInfo are in MediaBrowser.Controller.Net
- Item/user/session ids (SessionInfo.Id/UserId, BaseItemDto.Id) are plain
  string on this SDK version, not Guid - Party/PartyMember updated
  accordingly (Party.Id stays a Guid; it's minted by this plugin, not Emby)
- Reading the calling user needed an extra step:
  IAuthorizationContext.GetAuthorizationInfo(Request).UserId is a `long`
  (internal row id); .User.Id is the one matching SessionInfo.UserId,
  but it's a Guid so it's reformatted with .ToString("N")

docs/architecture.md's "Assumptions to verify" now reflects what was
actually confirmed vs. what's still only compile-checked (HTTP status
codes, content-type headers, the JS auth header format, the dashboard
config page) pending a run against a real server.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 14:40:17 +02:00

38 lines
1.4 KiB
C#

using System;
using System.Collections.Concurrent;
namespace WatchParty.Parties
{
/// <summary>
/// A watch party: a join code, the item everyone's meant to be watching,
/// and the set of members being kept in sync. See docs/architecture.md.
/// </summary>
public class Party
{
public Guid Id { get; set; } = Guid.NewGuid();
/// <summary>Short human-typeable code used to join, e.g. "K7QX2P".</summary>
public string JoinCode { get; set; }
/// <summary>The library item everyone is meant to be watching. Emby's own
/// item/user ids are plain strings on this SDK version (confirmed by
/// building against the real MediaBrowser.Model assembly) - only Party.Id
/// itself (below) is a Guid we mint ourselves.</summary>
public string ItemId { get; set; }
public string HostUserId { get; set; }
/// <summary>
/// Whose reported position is treated as ground truth. Defaults to the
/// host, but falls back to whoever's left if the host leaves (see
/// PartyManager.Leave).
/// </summary>
public string ReferenceUserId { get; set; }
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
public ConcurrentDictionary<string, PartyMember> Members { get; } = new ConcurrentDictionary<string, PartyMember>();
public DateTime LastActivityUtc { get; set; } = DateTime.UtcNow;
}
}