using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Subtitles
{
public interface ISubtitleProvider
{
///
/// Gets the name.
///
/// The name.
string Name { get; }
///
/// Gets the supported media types.
///
/// The supported media types.
IEnumerable SupportedMediaTypes { get; }
///
/// Searches the subtitles.
///
/// The request.
/// The cancellation token.
/// Task{IEnumerable{RemoteSubtitleInfo}}.
Task> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken);
///
/// Gets the subtitles.
///
/// The identifier.
/// The cancellation token.
/// Task{SubtitleResponse}.
Task GetSubtitles(string id, CancellationToken cancellationToken);
}
public enum SubtitleMediaType
{
Episode = 0,
Movie = 1
}
public class SubtitleResponse
{
public string Language { get; set; }
public string Format { get; set; }
public Stream Stream { get; set; }
}
public class SubtitleSearchRequest : IHasProviderIds
{
public string Language { get; set; }
public SubtitleMediaType ContentType { get; set; }
public string MediaPath { get; set; }
public string SeriesName { get; set; }
public string Name { get; set; }
public int? IndexNumber { get; set; }
public int? IndexNumberEnd { get; set; }
public int? ParentIndexNumber { get; set; }
public int? ProductionYear { get; set; }
public Dictionary ProviderIds { get; set; }
public SubtitleSearchRequest()
{
ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase);
}
}
}