add download media sample button to playback troubleshooting (#2709)

* add download media sample button to playback troubleshooting

* fixes
This commit is contained in:
Jason Dove
2025-12-09 11:49:07 -06:00
committed by GitHub
parent 5dc20ebd1b
commit a1f9b86fc1
10 changed files with 502 additions and 317 deletions
@@ -164,7 +164,13 @@ public class TroubleshootController(
Option<string> maybeArchivePath = await mediator.Send(new ArchiveTroubleshootingResults(), cancellationToken);
foreach (string archivePath in maybeArchivePath)
{
FileStream fs = System.IO.File.OpenRead(archivePath);
var fs = new FileStream(
archivePath,
FileMode.Open,
FileAccess.Read,
FileShare.Read,
4096,
FileOptions.DeleteOnClose);
return File(
fs,
"application/zip",
@@ -173,4 +179,27 @@ public class TroubleshootController(
return NotFound();
}
[HttpHead("api/troubleshoot/playback/sample/{mediaItemId:int}")]
[HttpGet("api/troubleshoot/playback/sample/{mediaItemId:int}")]
public async Task<IActionResult> TroubleshootPlaybackSample(int mediaItemId, CancellationToken cancellationToken)
{
Option<string> maybeArchivePath = await mediator.Send(new ArchiveMediaSample(mediaItemId), cancellationToken);
foreach (string archivePath in maybeArchivePath)
{
var fs = new FileStream(
archivePath,
FileMode.Open,
FileAccess.Read,
FileShare.Read,
4096,
FileOptions.DeleteOnClose);
return File(
fs,
"application/zip",
$"ersatztv-media-sample-{DateTimeOffset.Now.ToUnixTimeSeconds()}.zip");
}
return NotFound();
}
}