aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/LiveTvController.cs
diff options
context:
space:
mode:
authorcvium <clausvium@gmail.com>2021-09-05 10:11:17 +0200
committercvium <clausvium@gmail.com>2021-09-05 10:11:17 +0200
commitffe5ae8056d2f145bacae120b56fde39d132dc6f (patch)
tree174625f71dae8abd79fb87ca606b514c407b770c /Jellyfin.Api/Controllers/LiveTvController.cs
parent417a7011c7b5fe4a5ca5ce7c0b61c14f15bc748b (diff)
parentff83fabac35a7bf8756a8d822b8f031d700dbb64 (diff)
Merge branch 'master' into TVFix
Diffstat (limited to 'Jellyfin.Api/Controllers/LiveTvController.cs')
-rw-r--r--Jellyfin.Api/Controllers/LiveTvController.cs35
1 files changed, 16 insertions, 19 deletions
diff --git a/Jellyfin.Api/Controllers/LiveTvController.cs b/Jellyfin.Api/Controllers/LiveTvController.cs
index 24ee833ef..b20eae750 100644
--- a/Jellyfin.Api/Controllers/LiveTvController.cs
+++ b/Jellyfin.Api/Controllers/LiveTvController.cs
@@ -429,10 +429,10 @@ namespace Jellyfin.Api.Controllers
[HttpPost("Tuners/{tunerId}/Reset")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[Authorize(Policy = Policies.DefaultAuthorization)]
- public ActionResult ResetTuner([FromRoute, Required] string tunerId)
+ public async Task<ActionResult> ResetTuner([FromRoute, Required] string tunerId)
{
- AssertUserCanManageLiveTv();
- _liveTvManager.ResetTuner(tunerId, CancellationToken.None);
+ await AssertUserCanManageLiveTv().ConfigureAwait(false);
+ await _liveTvManager.ResetTuner(tunerId, CancellationToken.None).ConfigureAwait(false);
return NoContent();
}
@@ -761,9 +761,9 @@ namespace Jellyfin.Api.Controllers
[Authorize(Policy = Policies.DefaultAuthorization)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
- public ActionResult DeleteRecording([FromRoute, Required] Guid recordingId)
+ public async Task<ActionResult> DeleteRecording([FromRoute, Required] Guid recordingId)
{
- AssertUserCanManageLiveTv();
+ await AssertUserCanManageLiveTv().ConfigureAwait(false);
var item = _libraryManager.GetItemById(recordingId);
if (item == null)
@@ -790,7 +790,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status204NoContent)]
public async Task<ActionResult> CancelTimer([FromRoute, Required] string timerId)
{
- AssertUserCanManageLiveTv();
+ await AssertUserCanManageLiveTv().ConfigureAwait(false);
await _liveTvManager.CancelTimer(timerId).ConfigureAwait(false);
return NoContent();
}
@@ -808,7 +808,7 @@ namespace Jellyfin.Api.Controllers
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "timerId", Justification = "Imported from ServiceStack")]
public async Task<ActionResult> UpdateTimer([FromRoute, Required] string timerId, [FromBody] TimerInfoDto timerInfo)
{
- AssertUserCanManageLiveTv();
+ await AssertUserCanManageLiveTv().ConfigureAwait(false);
await _liveTvManager.UpdateTimer(timerInfo, CancellationToken.None).ConfigureAwait(false);
return NoContent();
}
@@ -824,7 +824,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status204NoContent)]
public async Task<ActionResult> CreateTimer([FromBody] TimerInfoDto timerInfo)
{
- AssertUserCanManageLiveTv();
+ await AssertUserCanManageLiveTv().ConfigureAwait(false);
await _liveTvManager.CreateTimer(timerInfo, CancellationToken.None).ConfigureAwait(false);
return NoContent();
}
@@ -882,7 +882,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status204NoContent)]
public async Task<ActionResult> CancelSeriesTimer([FromRoute, Required] string timerId)
{
- AssertUserCanManageLiveTv();
+ await AssertUserCanManageLiveTv().ConfigureAwait(false);
await _liveTvManager.CancelSeriesTimer(timerId).ConfigureAwait(false);
return NoContent();
}
@@ -900,7 +900,7 @@ namespace Jellyfin.Api.Controllers
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "timerId", Justification = "Imported from ServiceStack")]
public async Task<ActionResult> UpdateSeriesTimer([FromRoute, Required] string timerId, [FromBody] SeriesTimerInfoDto seriesTimerInfo)
{
- AssertUserCanManageLiveTv();
+ await AssertUserCanManageLiveTv().ConfigureAwait(false);
await _liveTvManager.UpdateSeriesTimer(seriesTimerInfo, CancellationToken.None).ConfigureAwait(false);
return NoContent();
}
@@ -916,7 +916,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status204NoContent)]
public async Task<ActionResult> CreateSeriesTimer([FromBody] SeriesTimerInfoDto seriesTimerInfo)
{
- AssertUserCanManageLiveTv();
+ await AssertUserCanManageLiveTv().ConfigureAwait(false);
await _liveTvManager.CreateSeriesTimer(seriesTimerInfo, CancellationToken.None).ConfigureAwait(false);
return NoContent();
}
@@ -1172,7 +1172,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesVideoFile]
- public async Task<ActionResult> GetLiveRecordingFile([FromRoute, Required] string recordingId)
+ public ActionResult GetLiveRecordingFile([FromRoute, Required] string recordingId)
{
var path = _liveTvManager.GetEmbyTvActiveRecordingPath(recordingId);
@@ -1181,11 +1181,8 @@ namespace Jellyfin.Api.Controllers
return NotFound();
}
- await using var memoryStream = new MemoryStream();
- await new ProgressiveFileCopier(path, null, _transcodingJobHelper, CancellationToken.None)
- .WriteToAsync(memoryStream, CancellationToken.None)
- .ConfigureAwait(false);
- return File(memoryStream, MimeTypes.GetMimeType(path));
+ var stream = new ProgressiveFileStream(path, null, _transcodingJobHelper);
+ return new FileStreamResult(stream, MimeTypes.GetMimeType(path));
}
/// <summary>
@@ -1215,9 +1212,9 @@ namespace Jellyfin.Api.Controllers
return new FileStreamResult(liveStream, MimeTypes.GetMimeType("file." + container));
}
- private void AssertUserCanManageLiveTv()
+ private async Task AssertUserCanManageLiveTv()
{
- var user = _sessionContext.GetUser(Request);
+ var user = await _sessionContext.GetUser(Request).ConfigureAwait(false);
if (user == null)
{