jellyfin/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs

76 lines
2.3 KiB
C#
Raw Normal View History

2014-05-05 16:45:45 +02:00
using MediaBrowser.Model.Entities;
2014-05-07 04:28:19 +02:00
using MediaBrowser.Model.Providers;
2014-05-05 16:45:45 +02:00
using System;
using System.Collections.Generic;
2014-05-05 06:36:45 +02:00
using System.IO;
using System.Threading;
using System.Threading.Tasks;
2014-05-07 04:28:19 +02:00
namespace MediaBrowser.Controller.Subtitles
2014-05-05 06:36:45 +02:00
{
public interface ISubtitleProvider
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
string Name { get; }
/// <summary>
/// Gets the supported media types.
/// </summary>
/// <value>The supported media types.</value>
IEnumerable<SubtitleMediaType> SupportedMediaTypes { get; }
/// <summary>
2014-05-07 04:28:19 +02:00
/// Searches the subtitles.
2014-05-05 06:36:45 +02:00
/// </summary>
/// <param name="request">The request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
2014-05-07 04:28:19 +02:00
/// <returns>Task{IEnumerable{RemoteSubtitleInfo}}.</returns>
Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken);
/// <summary>
/// Gets the subtitles.
/// </summary>
/// <param name="id">The identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
2014-05-05 06:36:45 +02:00
/// <returns>Task{SubtitleResponse}.</returns>
2014-05-07 04:28:19 +02:00
Task<SubtitleResponse> GetSubtitles(string id, CancellationToken cancellationToken);
2014-05-05 06:36:45 +02:00
}
public enum SubtitleMediaType
{
Episode = 0,
Movie = 1
}
public class SubtitleResponse
{
2014-05-07 04:28:19 +02:00
public string Language { get; set; }
2014-05-05 06:36:45 +02:00
public string Format { get; set; }
public Stream Stream { get; set; }
}
2014-05-07 04:28:19 +02:00
public class SubtitleSearchRequest : IHasProviderIds
2014-05-05 06:36:45 +02:00
{
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; }
2014-05-05 06:36:45 +02:00
public int? IndexNumber { get; set; }
2014-05-05 16:45:45 +02:00
public int? IndexNumberEnd { get; set; }
2014-05-05 06:36:45 +02:00
public int? ParentIndexNumber { get; set; }
2014-05-05 16:45:45 +02:00
public int? ProductionYear { get; set; }
public Dictionary<string, string> ProviderIds { get; set; }
2014-05-07 04:28:19 +02:00
public SubtitleSearchRequest()
2014-05-05 16:45:45 +02:00
{
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
2014-05-05 06:36:45 +02:00
}
}