Use Console.Error for debug output (appears in docker logs)

This commit is contained in:
mani
2026-01-08 13:37:00 +01:00
parent 0148b5d39a
commit c8217ca192

View File

@@ -391,13 +391,14 @@ public static class StreamingHelpers
// Check if this is a progressive download (no segments) vs HLS streaming
var streamingRequest = state.BaseRequest as StreamingRequestDto;
// Always write to file for debugging (logger might be null or not passed)
try
{
var debugMsg = $"[{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss}] GetOutputFilePath called - SegmentContainer={streamingRequest?.SegmentContainer ?? "NULL"}, TranscodingType={state.TranscodingType}, OutputContainer={state.OutputContainer}, IsSegmentContainerNull={streamingRequest?.SegmentContainer is null}, IsProgressive={state.TranscodingType == TranscodingJobType.Progressive}, ConditionResult={streamingRequest?.SegmentContainer is null && state.TranscodingType == TranscodingJobType.Progressive}\n";
File.AppendAllText("/tmp/jellyfin-transcode-debug.log", debugMsg);
}
catch { }
// Debug output to stderr (appears in docker logs)
Console.Error.WriteLine($"=== TRANSCODE PATH DEBUG ===");
Console.Error.WriteLine($"SegmentContainer: {streamingRequest?.SegmentContainer ?? "NULL"}");
Console.Error.WriteLine($"TranscodingType: {state.TranscodingType}");
Console.Error.WriteLine($"OutputContainer: {state.OutputContainer}");
Console.Error.WriteLine($"IsSegmentContainerNull: {streamingRequest?.SegmentContainer is null}");
Console.Error.WriteLine($"IsProgressive: {state.TranscodingType == TranscodingJobType.Progressive}");
Console.Error.WriteLine($"ConditionResult: {streamingRequest?.SegmentContainer is null && state.TranscodingType == TranscodingJobType.Progressive}");
logger?.LogInformation(
"GetOutputFilePath: SegmentContainer={SegmentContainer}, TranscodingType={TranscodingType}, OutputContainer={OutputContainer}",
@@ -412,14 +413,15 @@ public static class StreamingHelpers
var diskTranscodePath = Path.Combine(folder, "downloads");
Directory.CreateDirectory(diskTranscodePath);
folder = diskTranscodePath;
try { File.AppendAllText("/tmp/jellyfin-transcode-debug.log", $"[{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss}] Using downloads folder: {diskTranscodePath}\n"); } catch { }
Console.Error.WriteLine($"==> Using downloads folder: {diskTranscodePath}");
logger?.LogInformation("Using downloads folder: {Path}", diskTranscodePath);
}
else
{
try { File.AppendAllText("/tmp/jellyfin-transcode-debug.log", $"[{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss}] Using standard folder: {folder}\n"); } catch { }
Console.Error.WriteLine($"==> Using standard folder: {folder}");
logger?.LogInformation("Using standard transcode folder: {Path}", folder);
}
Console.Error.WriteLine($"=== END DEBUG ===");
return Path.Combine(folder, filename + ext);
}