add download media sample button to playback troubleshooting (#2709)
* add download media sample button to playback troubleshooting * fixes
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user