Duncan Tourolle 2f5a182afd
Some checks failed
🏗️ Build Plugin / call (push) Failing after 0s
📝 Create/Update Release Draft & Release Bump PR / call (push) Failing after 0s
🔬 Run CodeQL / call (push) Failing after 0s
🧪 Test Plugin / call (push) Failing after 0s
First POC with working playback
2025-12-13 23:54:33 +01:00

97 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
namespace Jellyfin.Plugin.JellyLMS.Models;
/// <summary>
/// Represents the current playback state.
/// </summary>
public enum PlaybackState
{
/// <summary>
/// Playback is stopped.
/// </summary>
Stopped,
/// <summary>
/// Playback is active.
/// </summary>
Playing,
/// <summary>
/// Playback is paused.
/// </summary>
Paused
}
/// <summary>
/// Represents an active playback session bridging Jellyfin to LMS.
/// </summary>
public class LmsPlaybackSession
{
/// <summary>
/// Gets or sets the unique session identifier.
/// </summary>
public string SessionId { get; set; } = Guid.NewGuid().ToString();
/// <summary>
/// Gets or sets the Jellyfin session ID.
/// </summary>
public string? JellyfinSessionId { get; set; }
/// <summary>
/// Gets or sets the Jellyfin item ID being played.
/// </summary>
public Guid ItemId { get; set; }
/// <summary>
/// Gets or sets the item name for display.
/// </summary>
public string ItemName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the artist name (for audio).
/// </summary>
public string? Artist { get; set; }
/// <summary>
/// Gets or sets the album name (for audio).
/// </summary>
public string? Album { get; set; }
/// <summary>
/// Gets or sets the MAC addresses of LMS players in this session.
/// </summary>
public List<string> PlayerMacs { get; set; } = [];
/// <summary>
/// Gets or sets the current playback state.
/// </summary>
public PlaybackState State { get; set; } = PlaybackState.Stopped;
/// <summary>
/// Gets or sets the current playback position in ticks.
/// </summary>
public long PositionTicks { get; set; }
/// <summary>
/// Gets or sets the total runtime in ticks.
/// </summary>
public long RuntimeTicks { get; set; }
/// <summary>
/// Gets or sets when this session started.
/// </summary>
public DateTime StartedAt { get; set; } = DateTime.UtcNow;
/// <summary>
/// Gets or sets the audio stream URL being played on LMS.
/// </summary>
public string? StreamUrl { get; set; }
/// <summary>
/// Gets or sets the Jellyfin user ID who initiated playback.
/// </summary>
public Guid? UserId { get; set; }
}