When no custom directory is set, recordings go to an "SRF Recordings" folder in the chosen library, or the first TV Shows library, so they show up without adding a library by hand. The settings page gets a library picker, a check that the directory is writable, and help for sandboxed systemd services. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
85 lines
3.2 KiB
C#
85 lines
3.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Jellyfin.Plugin.SRFPlay.Api.Models;
|
|
using Jellyfin.Plugin.SRFPlay.Api.Models.PlayV3;
|
|
|
|
namespace Jellyfin.Plugin.SRFPlay.Services.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Service for managing sport livestream recordings.
|
|
/// </summary>
|
|
public interface IRecordingService
|
|
{
|
|
/// <summary>
|
|
/// Gets upcoming sport livestreams that can be recorded.
|
|
/// </summary>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>List of upcoming sport livestreams.</returns>
|
|
Task<IReadOnlyList<PlayV3TvProgram>> GetUpcomingScheduleAsync(CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Schedules a livestream for recording.
|
|
/// </summary>
|
|
/// <param name="urn">The SRF URN to record.</param>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>The created recording entry.</returns>
|
|
Task<RecordingEntry> ScheduleRecordingAsync(string urn, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Cancels a scheduled recording.
|
|
/// </summary>
|
|
/// <param name="recordingId">The recording ID.</param>
|
|
/// <returns>True if cancelled.</returns>
|
|
bool CancelRecording(string recordingId);
|
|
|
|
/// <summary>
|
|
/// Stops an active recording.
|
|
/// </summary>
|
|
/// <param name="recordingId">The recording ID.</param>
|
|
/// <returns>True if stopped.</returns>
|
|
bool StopRecording(string recordingId);
|
|
|
|
/// <summary>
|
|
/// Gets all recordings by state.
|
|
/// </summary>
|
|
/// <param name="stateFilter">Optional state filter.</param>
|
|
/// <returns>List of matching recording entries.</returns>
|
|
IReadOnlyList<RecordingEntry> GetRecordings(RecordingState? stateFilter = null);
|
|
|
|
/// <summary>
|
|
/// Gets a single recording by ID.
|
|
/// </summary>
|
|
/// <param name="recordingId">The recording ID.</param>
|
|
/// <returns>The recording entry, or null if not found.</returns>
|
|
RecordingEntry? GetRecording(string recordingId);
|
|
|
|
/// <summary>
|
|
/// Gets recordings that have an output file on disk, finished or still in progress.
|
|
/// </summary>
|
|
/// <returns>Playable recordings, newest first.</returns>
|
|
IReadOnlyList<RecordingEntry> GetPlayableRecordings();
|
|
|
|
/// <summary>
|
|
/// Deletes a completed recording (entry and optionally the file).
|
|
/// </summary>
|
|
/// <param name="recordingId">The recording ID.</param>
|
|
/// <param name="deleteFile">Whether to delete the file too.</param>
|
|
/// <returns>True if deleted.</returns>
|
|
bool DeleteRecording(string recordingId, bool deleteFile = true);
|
|
|
|
/// <summary>
|
|
/// Checks scheduled recordings and starts/stops them as needed.
|
|
/// Called periodically by the scheduler task.
|
|
/// </summary>
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
/// <returns>A task representing the async operation.</returns>
|
|
Task ProcessRecordingsAsync(CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Resolves where recordings will be written and checks the server can write there.
|
|
/// </summary>
|
|
/// <returns>The output directory and the result of a write test.</returns>
|
|
RecordingOutputInfo GetOutputInfo();
|
|
}
|