using System;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Querying;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Events;
using MediaBrowser.Controller.Library;
namespace MediaBrowser.Controller.LiveTv
{
///
/// Manages all live tv services installed on the server
///
public interface ILiveTvManager
{
///
/// Gets the services.
///
/// The services.
IReadOnlyList Services { get; }
///
/// Gets the new timer defaults asynchronous.
///
/// The cancellation token.
/// Task{TimerInfo}.
Task GetNewTimerDefaults(CancellationToken cancellationToken);
///
/// Gets the new timer defaults.
///
/// The program identifier.
/// The cancellation token.
/// Task{SeriesTimerInfoDto}.
Task GetNewTimerDefaults(string programId, CancellationToken cancellationToken);
///
/// Deletes the recording.
///
/// The identifier.
/// Task.
Task DeleteRecording(string id);
///
/// Deletes the recording.
///
/// The recording.
/// Task.
Task DeleteRecording(BaseItem recording);
///
/// Cancels the timer.
///
/// The identifier.
/// Task.
Task CancelTimer(string id);
///
/// Cancels the series timer.
///
/// The identifier.
/// Task.
Task CancelSeriesTimer(string id);
///
/// Adds the parts.
///
/// The services.
/// The tuner hosts.
/// The listing providers.
void AddParts(IEnumerable services, IEnumerable tunerHosts, IEnumerable listingProviders);
///
/// Gets the recording.
///
/// The identifier.
/// The options.
/// The cancellation token.
/// The user.
/// Task{RecordingInfoDto}.
Task GetRecording(string id, DtoOptions options, CancellationToken cancellationToken, User user = null);
///
/// Gets the timer.
///
/// The identifier.
/// The cancellation token.
/// Task{TimerInfoDto}.
Task GetTimer(string id, CancellationToken cancellationToken);
///
/// Gets the series timer.
///
/// The identifier.
/// The cancellation token.
/// Task{TimerInfoDto}.
Task GetSeriesTimer(string id, CancellationToken cancellationToken);
///
/// Gets the recordings.
///
/// The query.
/// The options.
/// The cancellation token.
/// QueryResult{RecordingInfoDto}.
Task> GetRecordings(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken);
Task> GetRecordingSeries(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken);
///
/// Gets the timers.
///
/// The query.
/// The cancellation token.
/// Task{QueryResult{TimerInfoDto}}.
Task> GetTimers(TimerQuery query, CancellationToken cancellationToken);
///
/// Gets the series timers.
///
/// The query.
/// The cancellation token.
/// Task{QueryResult{SeriesTimerInfoDto}}.
Task> GetSeriesTimers(SeriesTimerQuery query, CancellationToken cancellationToken);
///
/// Gets the channel.
///
/// The identifier.
/// Channel.
LiveTvChannel GetInternalChannel(string id);
///
/// Gets the recording.
///
/// The identifier.
/// The cancellation token.
/// LiveTvRecording.
Task GetInternalRecording(string id, CancellationToken cancellationToken);
///
/// Gets the recording stream.
///
/// The identifier.
/// The cancellation token.
/// Task{Stream}.
Task GetRecordingStream(string id, CancellationToken cancellationToken);
///
/// Gets the channel stream.
///
/// The identifier.
/// The media source identifier.
/// The cancellation token.
/// Task{StreamResponseInfo}.
Task> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken);
///
/// Gets the program.
///
/// The identifier.
/// The cancellation token.
/// The user.
/// Task{ProgramInfoDto}.
Task GetProgram(string id, CancellationToken cancellationToken, User user = null);
///
/// Gets the programs.
///
/// The query.
/// The options.
/// The cancellation token.
/// IEnumerable{ProgramInfo}.
Task> GetPrograms(ProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
///
/// Updates the timer.
///
/// The timer.
/// The cancellation token.
/// Task.
Task UpdateTimer(TimerInfoDto timer, CancellationToken cancellationToken);
///
/// Updates the timer.
///
/// The timer.
/// The cancellation token.
/// Task.
Task UpdateSeriesTimer(SeriesTimerInfoDto timer, CancellationToken cancellationToken);
///
/// Creates the timer.
///
/// The timer.
/// The cancellation token.
/// Task.
Task CreateTimer(TimerInfoDto timer, CancellationToken cancellationToken);
///
/// Creates the series timer.
///
/// The timer.
/// The cancellation token.
/// Task.
Task CreateSeriesTimer(SeriesTimerInfoDto timer, CancellationToken cancellationToken);
///
/// Gets the recording groups.
///
/// The query.
/// The cancellation token.
/// Task{QueryResult{RecordingGroupDto}}.
Task> GetRecordingGroups(RecordingGroupQuery query, CancellationToken cancellationToken);
///
/// Closes the live stream.
///
/// The identifier.
/// Task.
Task CloseLiveStream(string id);
///
/// Gets the guide information.
///
/// GuideInfo.
GuideInfo GetGuideInfo();
///
/// Gets the recommended programs.
///
/// The query.
/// The options.
/// The cancellation token.
/// Task{QueryResult{ProgramInfoDto}}.
Task> GetRecommendedPrograms(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
///
/// Gets the recommended programs internal.
///
/// Task<QueryResult<LiveTvProgram>>.
Task> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);
///
/// Gets the live tv information.
///
/// The cancellation token.
/// Task{LiveTvInfo}.
Task GetLiveTvInfo(CancellationToken cancellationToken);
///
/// Resets the tuner.
///
/// The identifier.
/// The cancellation token.
/// Task.
Task ResetTuner(string id, CancellationToken cancellationToken);
///
/// Gets the live tv folder.
///
/// The cancellation token.
/// BaseItemDto.
Task GetInternalLiveTvFolder(CancellationToken cancellationToken);
///
/// Gets the live tv folder.
///
/// The user identifier.
/// The cancellation token.
/// BaseItemDto.
Task GetLiveTvFolder(string userId, CancellationToken cancellationToken);
///
/// Gets the enabled users.
///
/// IEnumerable{User}.
IEnumerable GetEnabledUsers();
///
/// Gets the internal channels.
///
/// The query.
/// The cancellation token.
/// Task<QueryResult<LiveTvChannel>>.
Task> GetInternalChannels(LiveTvChannelQuery query,
CancellationToken cancellationToken);
///
/// Gets the internal recordings.
///
/// The query.
/// The cancellation token.
/// Task<QueryResult<BaseItem>>.
Task> GetInternalRecordings(RecordingQuery query, CancellationToken cancellationToken);
///
/// Gets the recording media sources.
///
Task> GetRecordingMediaSources(IHasMediaSources item, CancellationToken cancellationToken);
///
/// Gets the channel media sources.
///
Task> GetChannelMediaSources(IHasMediaSources item, CancellationToken cancellationToken);
///
/// Adds the information to recording dto.
///
/// The item.
/// The dto.
/// The user.
void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, User user = null);
///
/// Adds the information to program dto.
///
/// The programs.
/// The fields.
/// The user.
/// Task.
Task AddInfoToProgramDto(List> programs, List fields, User user = null);
///
/// Saves the tuner host.
///
Task SaveTunerHost(TunerHostInfo info, bool dataSourceChanged = true);
///
/// Saves the listing provider.
///
/// The information.
/// if set to true [validate login].
/// if set to true [validate listings].
/// Task.
Task SaveListingProvider(ListingsProviderInfo info, bool validateLogin, bool validateListings);
void DeleteListingsProvider(string id);
Task SetChannelMapping(string providerId, string tunerChannelNumber, string providerChannelNumber);
TunerChannelMapping GetTunerChannelMapping(ChannelInfo channel, List mappings, List providerChannels);
///
/// Gets the lineups.
///
/// Type of the provider.
/// The provider identifier.
/// The country.
/// The location.
/// Task<List<NameIdPair>>.
Task> GetLineups(string providerType, string providerId, string country, string location);
///
/// Gets the registration information.
///
/// The feature.
/// Task<MBRegistrationRecord>.
Task GetRegistrationInfo(string feature);
///
/// Adds the channel information.
///
/// The items.
/// The options.
/// The user.
void AddChannelInfo(List> items, DtoOptions options, User user);
///
/// Called when [recording file deleted].
///
/// The recording.
/// Task.
Task OnRecordingFileDeleted(BaseItem recording);
///
/// Gets the sat ini mappings.
///
/// List<NameValuePair>.
List GetSatIniMappings();
Task> GetSatChannelScanResult(TunerHostInfo info, CancellationToken cancellationToken);
Task> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken);
Task> GetChannelsFromListingsProviderData(string id, CancellationToken cancellationToken);
List ListingProviders { get; }
event EventHandler> SeriesTimerCancelled;
event EventHandler> TimerCancelled;
event EventHandler> TimerCreated;
event EventHandler> SeriesTimerCreated;
}
}