fix: simplify ghost playback start to avoid Jellyfin validation errors
Some checks failed
CI / build-and-test (push) Has been cancelled

- Remove complex Item object from playback start (was causing 400 errors)
- Send minimal playback info with just ghost UUID and playback state
- Progress reports already working (204 responses)
- Jellyfin will track session without full item details
This commit is contained in:
2026-02-07 13:30:47 -05:00
parent 1a0e0216f5
commit f741cc5297

View File

@@ -2290,32 +2290,11 @@ public class JellyfinController : ControllerBase
// Generate a deterministic UUID from the external ID // Generate a deterministic UUID from the external ID
var ghostUuid = GenerateUuidFromString(itemId); var ghostUuid = GenerateUuidFromString(itemId);
// Try to get metadata for the external track to populate the ghost item // Build minimal playback start with just the ghost UUID
var ghostItem = new // Don't include the Item object - Jellyfin will just track the session without item details
{
Name = itemName ?? "External Track",
Id = ghostUuid,
Type = "Audio",
MediaType = "Audio",
RunTimeTicks = 0L, // We don't know duration yet
Artists = new[] { provider }, // Use provider as artist for now
Album = "External",
AlbumArtist = provider,
IsFolder = false,
UserData = new
{
PlaybackPositionTicks = positionTicks ?? 0,
PlayCount = 0,
IsFavorite = false,
Played = false
}
};
// Build playback start with ghost item
var playbackStart = new var playbackStart = new
{ {
ItemId = ghostUuid, ItemId = ghostUuid,
Item = ghostItem,
PositionTicks = positionTicks ?? 0, PositionTicks = positionTicks ?? 0,
CanSeek = true, CanSeek = true,
IsPaused = false, IsPaused = false,
@@ -2326,7 +2305,7 @@ public class JellyfinController : ControllerBase
var playbackJson = JsonSerializer.Serialize(playbackStart); var playbackJson = JsonSerializer.Serialize(playbackStart);
_logger.LogDebug("📤 Sending ghost playback start for external track: {Json}", playbackJson); _logger.LogDebug("📤 Sending ghost playback start for external track: {Json}", playbackJson);
// Forward to Jellyfin with ghost item // Forward to Jellyfin with ghost UUID
var (ghostResult, ghostStatusCode) = await _proxyService.PostJsonAsync("Sessions/Playing", playbackJson, Request.Headers); var (ghostResult, ghostStatusCode) = await _proxyService.PostJsonAsync("Sessions/Playing", playbackJson, Request.Headers);
if (ghostStatusCode == 204 || ghostStatusCode == 200) if (ghostStatusCode == 204 || ghostStatusCode == 200)