aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/LiveTvController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Api/Controllers/LiveTvController.cs')
-rw-r--r--Jellyfin.Api/Controllers/LiveTvController.cs14
1 files changed, 10 insertions, 4 deletions
diff --git a/Jellyfin.Api/Controllers/LiveTvController.cs b/Jellyfin.Api/Controllers/LiveTvController.cs
index 074cdb24e0..1c570daf21 100644
--- a/Jellyfin.Api/Controllers/LiveTvController.cs
+++ b/Jellyfin.Api/Controllers/LiveTvController.cs
@@ -744,10 +744,12 @@ public class LiveTvController : BaseJellyfinApiController
/// <param name="programId">Program id.</param>
/// <param name="userId">Optional. Attach user data.</param>
/// <response code="200">Program returned.</response>
+ /// <response code="404">Program not found.</response>
/// <returns>An <see cref="OkResult"/> containing the livetv program.</returns>
[HttpGet("Programs/{programId}")]
[Authorize(Policy = Policies.LiveTvAccess)]
[ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<BaseItemDto>> GetProgram(
[FromRoute, Required] string programId,
[FromQuery] Guid? userId)
@@ -756,8 +758,14 @@ public class LiveTvController : BaseJellyfinApiController
var user = userId.IsNullOrEmpty()
? null
: _userManager.GetUserById(userId.Value);
+ var result = await _liveTvManager.GetProgram(programId, CancellationToken.None, user).ConfigureAwait(false);
+
+ if (result is null)
+ {
+ return NotFound();
+ }
- return await _liveTvManager.GetProgram(programId, CancellationToken.None, user).ConfigureAwait(false);
+ return Ok(result);
}
/// <summary>
@@ -994,9 +1002,7 @@ public class LiveTvController : BaseJellyfinApiController
{
if (!string.IsNullOrEmpty(pw))
{
- // TODO: remove ToLower when Convert.ToHexString supports lowercase
- // Schedules Direct requires the hex to be lowercase
- listingsProviderInfo.Password = Convert.ToHexString(SHA1.HashData(Encoding.UTF8.GetBytes(pw))).ToLowerInvariant();
+ listingsProviderInfo.Password = Convert.ToHexStringLower(SHA1.HashData(Encoding.UTF8.GetBytes(pw)));
}
return await _listingsManager.SaveListingProvider(listingsProviderInfo, validateLogin, validateListings).ConfigureAwait(false);