mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
another
This commit is contained in:
@@ -1785,28 +1785,6 @@ public class JellyfinController : ControllerBase
|
|||||||
|
|
||||||
_logger.LogInformation("📻 Playback START reported");
|
_logger.LogInformation("📻 Playback START reported");
|
||||||
|
|
||||||
// Extract device info and ensure session exists
|
|
||||||
var (deviceId, client, device, version) = ExtractDeviceInfo(Request.Headers);
|
|
||||||
if (!string.IsNullOrEmpty(deviceId))
|
|
||||||
{
|
|
||||||
var sessionCreated = await _sessionManager.EnsureSessionAsync(deviceId, client ?? "Unknown", device ?? "Unknown", version ?? "1.0", Request.Headers);
|
|
||||||
if (sessionCreated)
|
|
||||||
{
|
|
||||||
_logger.LogInformation("✓ Session ensured for device {DeviceId}", deviceId);
|
|
||||||
|
|
||||||
// Give Jellyfin a moment to process the session creation
|
|
||||||
await Task.Delay(100);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.LogWarning("⚠️ Failed to ensure session for device {DeviceId}", deviceId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.LogWarning("⚠️ No device ID found in headers - session cannot be created");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse the body to check if it's an external track
|
// Parse the body to check if it's an external track
|
||||||
var doc = JsonDocument.Parse(body);
|
var doc = JsonDocument.Parse(body);
|
||||||
string? itemId = null;
|
string? itemId = null;
|
||||||
@@ -1839,11 +1817,10 @@ public class JellyfinController : ControllerBase
|
|||||||
itemName ?? "Unknown", itemId);
|
itemName ?? "Unknown", itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For local tracks, forward to Jellyfin with client auth
|
// For local tracks, forward playback start to Jellyfin FIRST
|
||||||
_logger.LogInformation("Forwarding playback start to Jellyfin...");
|
_logger.LogInformation("Forwarding playback start to Jellyfin...");
|
||||||
|
|
||||||
// Fetch full item details to include in playback report
|
// Fetch full item details to include in playback report
|
||||||
// This makes the session show up properly in Jellyfin dashboard with "Now Playing"
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var (itemResult, itemStatus) = await _proxyService.GetJsonAsync($"Items/{itemId}", null, Request.Headers);
|
var (itemResult, itemStatus) = await _proxyService.GetJsonAsync($"Items/{itemId}", null, Request.Headers);
|
||||||
@@ -1868,6 +1845,17 @@ public class JellyfinController : ControllerBase
|
|||||||
if (statusCode == 204 || statusCode == 200)
|
if (statusCode == 204 || statusCode == 200)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("✓ Playback start forwarded to Jellyfin ({StatusCode})", statusCode);
|
_logger.LogInformation("✓ Playback start forwarded to Jellyfin ({StatusCode})", statusCode);
|
||||||
|
|
||||||
|
// NOW ensure session exists with capabilities (after playback is reported)
|
||||||
|
var (deviceId, client, device, version) = ExtractDeviceInfo(Request.Headers);
|
||||||
|
if (!string.IsNullOrEmpty(deviceId))
|
||||||
|
{
|
||||||
|
var sessionCreated = await _sessionManager.EnsureSessionAsync(deviceId, client ?? "Unknown", device ?? "Unknown", version ?? "1.0", Request.Headers);
|
||||||
|
if (sessionCreated)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("✓ Session ensured for device {DeviceId} after playback start", deviceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user