2020-08-22 12:56:24 -07:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-13 13:01:16 -07:00
|
|
|
using System;
|
2018-12-27 16:27:57 -07:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
2019-01-13 12:25:32 -07:00
|
|
|
using MediaBrowser.Controller.Entities;
|
2018-12-27 16:27:57 -07:00
|
|
|
using MediaBrowser.Model.Configuration;
|
2019-01-13 12:25:32 -07:00
|
|
|
using MediaBrowser.Model.Providers;
|
2018-12-27 16:27:57 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Subtitles
|
|
|
|
{
|
|
|
|
public interface ISubtitleManager
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Occurs when [subtitle download failure].
|
|
|
|
/// </summary>
|
|
|
|
event EventHandler<SubtitleDownloadFailureEventArgs> SubtitleDownloadFailure;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Searches the subtitles.
|
|
|
|
/// </summary>
|
2021-08-13 20:34:36 -07:00
|
|
|
/// <param name="video">The video.</param>
|
|
|
|
/// <param name="language">Subtitle language.</param>
|
|
|
|
/// <param name="isPerfectMatch">Require perfect match.</param>
|
2021-10-19 12:06:05 -07:00
|
|
|
/// <param name="isAutomated">Request is automated.</param>
|
2021-08-13 20:34:36 -07:00
|
|
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
|
|
|
/// <returns>Subtitles, wrapped in task.</returns>
|
2019-09-10 13:37:53 -07:00
|
|
|
Task<RemoteSubtitleInfo[]> SearchSubtitles(
|
|
|
|
Video video,
|
2018-12-27 16:27:57 -07:00
|
|
|
string language,
|
|
|
|
bool? isPerfectMatch,
|
2021-10-19 12:06:05 -07:00
|
|
|
bool isAutomated,
|
2018-12-27 16:27:57 -07:00
|
|
|
CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Searches the subtitles.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The request.</param>
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
2019-09-10 13:37:53 -07:00
|
|
|
/// <returns>Task{RemoteSubtitleInfo[]}.</returns>
|
|
|
|
Task<RemoteSubtitleInfo[]> SearchSubtitles(
|
|
|
|
SubtitleSearchRequest request,
|
2018-12-27 16:27:57 -07:00
|
|
|
CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Downloads the subtitles.
|
|
|
|
/// </summary>
|
2021-08-13 20:34:36 -07:00
|
|
|
/// <param name="video">The video.</param>
|
|
|
|
/// <param name="subtitleId">Subtitle ID.</param>
|
|
|
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
|
|
|
/// <returns>A task.</returns>
|
2018-12-27 16:27:57 -07:00
|
|
|
Task DownloadSubtitles(Video video, string subtitleId, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Downloads the subtitles.
|
|
|
|
/// </summary>
|
2021-08-13 20:34:36 -07:00
|
|
|
/// <param name="video">The video.</param>
|
|
|
|
/// <param name="libraryOptions">Library options to use.</param>
|
|
|
|
/// <param name="subtitleId">Subtitle ID.</param>
|
|
|
|
/// <param name="cancellationToken">CancellationToken to use for the operation.</param>
|
|
|
|
/// <returns>A task.</returns>
|
2018-12-27 16:27:57 -07:00
|
|
|
Task DownloadSubtitles(Video video, LibraryOptions libraryOptions, string subtitleId, CancellationToken cancellationToken);
|
|
|
|
|
2020-05-08 12:53:38 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Upload new subtitle.
|
|
|
|
/// </summary>
|
2020-09-11 15:11:19 -07:00
|
|
|
/// <param name="video">The video the subtitle belongs to.</param>
|
|
|
|
/// <param name="response">The subtitle response.</param>
|
|
|
|
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
2020-05-08 12:53:38 -07:00
|
|
|
Task UploadSubtitle(Video video, SubtitleResponse response);
|
|
|
|
|
2018-12-27 16:27:57 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the remote subtitles.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">The identifier.</param>
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
2019-09-10 13:37:53 -07:00
|
|
|
/// <returns><see cref="Task{SubtitleResponse}" />.</returns>
|
2018-12-27 16:27:57 -07:00
|
|
|
Task<SubtitleResponse> GetRemoteSubtitles(string id, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Deletes the subtitles.
|
|
|
|
/// </summary>
|
2021-08-13 20:34:36 -07:00
|
|
|
/// <param name="item">Media item.</param>
|
|
|
|
/// <param name="index">Subtitle index.</param>
|
|
|
|
/// <returns>A task.</returns>
|
2018-12-27 16:27:57 -07:00
|
|
|
Task DeleteSubtitles(BaseItem item, int index);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the providers.
|
|
|
|
/// </summary>
|
2021-08-13 20:34:36 -07:00
|
|
|
/// <param name="item">The media item.</param>
|
|
|
|
/// <returns>Subtitles providers.</returns>
|
2018-12-27 16:27:57 -07:00
|
|
|
SubtitleProviderInfo[] GetSupportedProviders(BaseItem item);
|
|
|
|
}
|
|
|
|
}
|