refactor to unify data fetching and define abstract API for re-use
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Plugin.SRFPlay.Api.Models;
|
||||
using Jellyfin.Plugin.SRFPlay.Configuration;
|
||||
|
||||
namespace Jellyfin.Plugin.SRFPlay.Services.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for resolving stream URLs from media composition resources.
|
||||
/// </summary>
|
||||
public interface IStreamUrlResolver
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the best stream URL from a chapter based on quality preference.
|
||||
/// </summary>
|
||||
/// <param name="chapter">The chapter containing resources.</param>
|
||||
/// <param name="qualityPreference">The quality preference.</param>
|
||||
/// <returns>The stream URL, or null if no suitable stream found.</returns>
|
||||
string? GetStreamUrl(Chapter chapter, QualityPreference qualityPreference);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a chapter has non-DRM playable content.
|
||||
/// </summary>
|
||||
/// <param name="chapter">The chapter to check.</param>
|
||||
/// <returns>True if playable content is available.</returns>
|
||||
bool HasPlayableContent(Chapter chapter);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if content is expired based on ValidTo date.
|
||||
/// </summary>
|
||||
/// <param name="chapter">The chapter to check.</param>
|
||||
/// <returns>True if the content is expired.</returns>
|
||||
bool IsContentExpired(Chapter chapter);
|
||||
|
||||
/// <summary>
|
||||
/// Authenticates a stream URL by fetching an Akamai token.
|
||||
/// </summary>
|
||||
/// <param name="streamUrl">The unauthenticated stream URL.</param>
|
||||
/// <param name="cancellationToken">Cancellation token.</param>
|
||||
/// <returns>The authenticated stream URL with token.</returns>
|
||||
Task<string> GetAuthenticatedStreamUrlAsync(string streamUrl, CancellationToken cancellationToken = default);
|
||||
}
|
||||
Reference in New Issue
Block a user