diff options
| author | Cody Robibero <cody@robibe.ro> | 2024-02-28 17:09:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-28 17:09:23 -0700 |
| commit | f3c333f4d5bb272b5ffcff29af337ca31e8c374b (patch) | |
| tree | 008525e157be39a25e013fd3b039d4680760eb68 /MediaBrowser.Controller/LiveTv | |
| parent | 54eb81395ef8d3d4cb064b56361ce94fc72b38b5 (diff) | |
| parent | 4f0f364ac941dc4a856512c9bf0e6b93fdf7b3ab (diff) | |
Merge branch 'master' into bhowe34/fix-replace-missing-metadata-for-music
Diffstat (limited to 'MediaBrowser.Controller/LiveTv')
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/IGuideManager.cs | 26 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/IListingsManager.cs | 79 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 67 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/IRecordingsManager.cs | 55 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/TunerChannelMapping.cs | 17 |
5 files changed, 160 insertions, 84 deletions
diff --git a/MediaBrowser.Controller/LiveTv/IGuideManager.cs b/MediaBrowser.Controller/LiveTv/IGuideManager.cs new file mode 100644 index 0000000000..9883b9283c --- /dev/null +++ b/MediaBrowser.Controller/LiveTv/IGuideManager.cs @@ -0,0 +1,26 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Model.LiveTv; + +namespace MediaBrowser.Controller.LiveTv; + +/// <summary> +/// Service responsible for managing the Live TV guide. +/// </summary> +public interface IGuideManager +{ + /// <summary> + /// Gets the guide information. + /// </summary> + /// <returns>The <see cref="GuideInfo"/>.</returns> + GuideInfo GetGuideInfo(); + + /// <summary> + /// Refresh the guide. + /// </summary> + /// <param name="progress">The <see cref="IProgress{T}"/> to use.</param> + /// <param name="cancellationToken">The <see cref="CancellationToken"/> to use.</param> + /// <returns>Task representing the refresh operation.</returns> + Task RefreshGuide(IProgress<double> progress, CancellationToken cancellationToken); +} diff --git a/MediaBrowser.Controller/LiveTv/IListingsManager.cs b/MediaBrowser.Controller/LiveTv/IListingsManager.cs new file mode 100644 index 0000000000..bbf569575a --- /dev/null +++ b/MediaBrowser.Controller/LiveTv/IListingsManager.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.LiveTv; + +namespace MediaBrowser.Controller.LiveTv; + +/// <summary> +/// Service responsible for managing <see cref="IListingsProvider"/>s and mapping +/// their channels to channels provided by <see cref="ITunerHost"/>s. +/// </summary> +public interface IListingsManager +{ + /// <summary> + /// Saves the listing provider. + /// </summary> + /// <param name="info">The listing provider information.</param> + /// <param name="validateLogin">A value indicating whether to validate login.</param> + /// <param name="validateListings">A value indicating whether to validate listings..</param> + /// <returns>Task.</returns> + Task<ListingsProviderInfo> SaveListingProvider(ListingsProviderInfo info, bool validateLogin, bool validateListings); + + /// <summary> + /// Deletes the listing provider. + /// </summary> + /// <param name="id">The listing provider's id.</param> + void DeleteListingsProvider(string? id); + + /// <summary> + /// Gets the lineups. + /// </summary> + /// <param name="providerType">Type of the provider.</param> + /// <param name="providerId">The provider identifier.</param> + /// <param name="country">The country.</param> + /// <param name="location">The location.</param> + /// <returns>The available lineups.</returns> + Task<List<NameIdPair>> GetLineups(string? providerType, string? providerId, string? country, string? location); + + /// <summary> + /// Gets the programs for a provided channel. + /// </summary> + /// <param name="channel">The channel to retrieve programs for.</param> + /// <param name="startDateUtc">The earliest date to retrieve programs for.</param> + /// <param name="endDateUtc">The latest date to retrieve programs for.</param> + /// <param name="cancellationToken">The <see cref="CancellationToken"/> to use.</param> + /// <returns>The available programs.</returns> + Task<IEnumerable<ProgramInfo>> GetProgramsAsync( + ChannelInfo channel, + DateTime startDateUtc, + DateTime endDateUtc, + CancellationToken cancellationToken); + + /// <summary> + /// Adds metadata from the <see cref="IListingsProvider"/>s to the provided channels. + /// </summary> + /// <param name="channels">The channels.</param> + /// <param name="enableCache">A value indicating whether to use the EPG channel cache.</param> + /// <param name="cancellationToken">The <see cref="CancellationToken"/> to use.</param> + /// <returns>A task representing the metadata population.</returns> + Task AddProviderMetadata(IList<ChannelInfo> channels, bool enableCache, CancellationToken cancellationToken); + + /// <summary> + /// Gets the channel mapping options for a provider. + /// </summary> + /// <param name="providerId">The id of the provider to use.</param> + /// <returns>The channel mapping options.</returns> + Task<ChannelMappingOptionsDto> GetChannelMappingOptions(string? providerId); + + /// <summary> + /// Sets the channel mapping. + /// </summary> + /// <param name="providerId">The id of the provider for the mapping.</param> + /// <param name="tunerChannelNumber">The tuner channel number.</param> + /// <param name="providerChannelNumber">The provider channel number.</param> + /// <returns>The updated channel mapping.</returns> + Task<TunerChannelMapping> SetChannelMapping(string providerId, string tunerChannelNumber, string providerChannelNumber); +} diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 26f9fe42d3..c0e46ba245 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -10,7 +10,6 @@ using Jellyfin.Data.Entities; using Jellyfin.Data.Events; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; using MediaBrowser.Model.Dto; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Querying; @@ -36,8 +35,6 @@ namespace MediaBrowser.Controller.LiveTv /// <value>The services.</value> IReadOnlyList<ILiveTvService> Services { get; } - IReadOnlyList<IListingsProvider> ListingProviders { get; } - /// <summary> /// Gets the new timer defaults asynchronous. /// </summary> @@ -68,13 +65,6 @@ namespace MediaBrowser.Controller.LiveTv Task CancelSeriesTimer(string id); /// <summary> - /// Adds the parts. - /// </summary> - /// <param name="services">The services.</param> - /// <param name="listingProviders">The listing providers.</param> - void AddParts(IEnumerable<ILiveTvService> services, IEnumerable<IListingsProvider> listingProviders); - - /// <summary> /// Gets the timer. /// </summary> /// <param name="id">The identifier.</param> @@ -115,16 +105,6 @@ namespace MediaBrowser.Controller.LiveTv Task<QueryResult<SeriesTimerInfoDto>> GetSeriesTimers(SeriesTimerQuery query, CancellationToken cancellationToken); /// <summary> - /// Gets the channel stream. - /// </summary> - /// <param name="id">The identifier.</param> - /// <param name="mediaSourceId">The media source identifier.</param> - /// <param name="currentLiveStreams">The current live streams.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task{StreamResponseInfo}.</returns> - Task<Tuple<MediaSourceInfo, ILiveStream>> GetChannelStream(string id, string mediaSourceId, List<ILiveStream> currentLiveStreams, CancellationToken cancellationToken); - - /// <summary> /// Gets the program. /// </summary> /// <param name="id">The identifier.</param> @@ -175,12 +155,6 @@ namespace MediaBrowser.Controller.LiveTv Task CreateSeriesTimer(SeriesTimerInfoDto timer, CancellationToken cancellationToken); /// <summary> - /// Gets the guide information. - /// </summary> - /// <returns>GuideInfo.</returns> - GuideInfo GetGuideInfo(); - - /// <summary> /// Gets the recommended programs. /// </summary> /// <param name="query">The query.</param> @@ -236,14 +210,6 @@ namespace MediaBrowser.Controller.LiveTv QueryResult<BaseItem> GetInternalChannels(LiveTvChannelQuery query, DtoOptions dtoOptions, CancellationToken cancellationToken); /// <summary> - /// Gets the channel media sources. - /// </summary> - /// <param name="item">Item to search for.</param> - /// <param name="cancellationToken">CancellationToken to use for operation.</param> - /// <returns>Channel media sources wrapped in a task.</returns> - Task<IEnumerable<MediaSourceInfo>> GetChannelMediaSources(BaseItem item, CancellationToken cancellationToken); - - /// <summary> /// Adds the information to program dto. /// </summary> /// <param name="programs">The programs.</param> @@ -253,31 +219,6 @@ namespace MediaBrowser.Controller.LiveTv Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem Item, BaseItemDto ItemDto)> programs, IReadOnlyList<ItemFields> fields, User user = null); /// <summary> - /// Saves the listing provider. - /// </summary> - /// <param name="info">The information.</param> - /// <param name="validateLogin">if set to <c>true</c> [validate login].</param> - /// <param name="validateListings">if set to <c>true</c> [validate listings].</param> - /// <returns>Task.</returns> - Task<ListingsProviderInfo> SaveListingProvider(ListingsProviderInfo info, bool validateLogin, bool validateListings); - - void DeleteListingsProvider(string id); - - Task<TunerChannelMapping> SetChannelMapping(string providerId, string tunerChannelNumber, string providerChannelNumber); - - TunerChannelMapping GetTunerChannelMapping(ChannelInfo tunerChannel, NameValuePair[] mappings, List<ChannelInfo> providerChannels); - - /// <summary> - /// Gets the lineups. - /// </summary> - /// <param name="providerType">Type of the provider.</param> - /// <param name="providerId">The provider identifier.</param> - /// <param name="country">The country.</param> - /// <param name="location">The location.</param> - /// <returns>Task<List<NameIdPair>>.</returns> - Task<List<NameIdPair>> GetLineups(string providerType, string providerId, string country, string location); - - /// <summary> /// Adds the channel information. /// </summary> /// <param name="items">The items.</param> @@ -285,14 +226,6 @@ namespace MediaBrowser.Controller.LiveTv /// <param name="user">The user.</param> void AddChannelInfo(IReadOnlyCollection<(BaseItemDto ItemDto, LiveTvChannel Channel)> items, DtoOptions options, User user); - Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken); - - Task<List<ChannelInfo>> GetChannelsFromListingsProviderData(string id, CancellationToken cancellationToken); - - 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 0000000000..b918e2931b --- /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); +} diff --git a/MediaBrowser.Controller/LiveTv/TunerChannelMapping.cs b/MediaBrowser.Controller/LiveTv/TunerChannelMapping.cs deleted file mode 100644 index 1c1a4417dc..0000000000 --- a/MediaBrowser.Controller/LiveTv/TunerChannelMapping.cs +++ /dev/null @@ -1,17 +0,0 @@ -#nullable disable - -#pragma warning disable CS1591 - -namespace MediaBrowser.Controller.LiveTv -{ - public class TunerChannelMapping - { - public string Name { get; set; } - - public string ProviderChannelName { get; set; } - - public string ProviderChannelId { get; set; } - - public string Id { get; set; } - } -} |
