diff options
| author | Cody Robibero <cody@robibe.ro> | 2024-02-21 14:24:50 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-21 14:24:50 -0700 |
| commit | ca21a80c95d7e96734484ee642f761be2f3a4d0c (patch) | |
| tree | 1ab2e7e37295492788e5edd572a67e503862061f /MediaBrowser.Controller | |
| parent | 1dfaa171a95e3e6eea780f018cd8442f1dcc9f78 (diff) | |
| parent | 170b8b2550a6ebb08453fe96d6c2223eaa1aa0ff (diff) | |
Merge pull request #11045 from barronpm/livetv-recordingsmanager
LiveTV Recordings Refactor
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Video.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/IRecordingsManager.cs | 55 |
3 files changed, 57 insertions, 6 deletions
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 5adadec39..04f47b729 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -171,7 +171,7 @@ namespace MediaBrowser.Controller.Entities [JsonIgnore] public override bool HasLocalAlternateVersions => LocalAlternateVersions.Length > 0; - public static ILiveTvManager LiveTvManager { get; set; } + public static IRecordingsManager RecordingsManager { get; set; } [JsonIgnore] public override SourceType SourceType @@ -334,7 +334,7 @@ namespace MediaBrowser.Controller.Entities protected override bool IsActiveRecording() { - return LiveTvManager.GetActiveRecordingInfo(Path) is not null; + return RecordingsManager.GetActiveRecordingInfo(Path) is not null; } public override bool CanDelete() diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 0ac0699a3..ed08cdc47 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -245,10 +245,6 @@ namespace MediaBrowser.Controller.LiveTv /// <param name="user">The user.</param> void AddChannelInfo(IReadOnlyCollection<(BaseItemDto ItemDto, LiveTvChannel Channel)> items, DtoOptions options, User user); - string GetEmbyTvActiveRecordingPath(string id); - - ActiveRecordingInfo GetActiveRecordingInfo(string path); - void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, ActiveRecordingInfo activeRecordingInfo, User user = null); Task<BaseItem[]> GetRecordingFoldersAsync(User user); diff --git a/MediaBrowser.Controller/LiveTv/IRecordingsManager.cs b/MediaBrowser.Controller/LiveTv/IRecordingsManager.cs new file mode 100644 index 000000000..b918e2931 --- /dev/null +++ b/MediaBrowser.Controller/LiveTv/IRecordingsManager.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Controller.LiveTv; + +/// <summary> +/// Service responsible for managing LiveTV recordings. +/// </summary> +public interface IRecordingsManager +{ + /// <summary> + /// Gets the path for the provided timer id. + /// </summary> + /// <param name="id">The timer id.</param> + /// <returns>The recording path, or <c>null</c> if none exists.</returns> + string? GetActiveRecordingPath(string id); + + /// <summary> + /// Gets the information for an active recording. + /// </summary> + /// <param name="path">The recording path.</param> + /// <returns>The <see cref="ActiveRecordingInfo"/>, or <c>null</c> if none exists.</returns> + ActiveRecordingInfo? GetActiveRecordingInfo(string path); + + /// <summary> + /// Gets the recording folders. + /// </summary> + /// <returns>The <see cref="VirtualFolderInfo"/> for each recording folder.</returns> + IEnumerable<VirtualFolderInfo> GetRecordingFolders(); + + /// <summary> + /// Ensures that the recording folders all exist, and removes unused folders. + /// </summary> + /// <returns>Task.</returns> + Task CreateRecordingFolders(); + + /// <summary> + /// Cancels the recording with the provided timer id, if one is active. + /// </summary> + /// <param name="timerId">The timer id.</param> + /// <param name="timer">The timer.</param> + void CancelRecording(string timerId, TimerInfo? timer); + + /// <summary> + /// Records a stream. + /// </summary> + /// <param name="recordingInfo">The recording info.</param> + /// <param name="channel">The channel associated with the recording timer.</param> + /// <param name="recordingEndDate">The time to stop recording.</param> + /// <returns>Task representing the recording process.</returns> + Task RecordStream(ActiveRecordingInfo recordingInfo, BaseItem channel, DateTime recordingEndDate); +} |
