diff options
| author | 7illusions <z@7illusions.com> | 2014-05-12 16:55:07 +0200 |
|---|---|---|
| committer | 7illusions <z@7illusions.com> | 2014-05-12 16:55:07 +0200 |
| commit | baf5cf2544fcaad2246923f60caaf3fed4a94aaf (patch) | |
| tree | a808b700095f876e437b95c432c0220e241f9fda /MediaBrowser.Controller/Subtitles | |
| parent | 8f3a6279e173dcbaaa05a56556afb410ee12dd4d (diff) | |
| parent | b9b568de13d81f9db1a8502d50940475c1d79c72 (diff) | |
Merge pull request #3 from MediaBrowser/master
Sync with Master
Diffstat (limited to 'MediaBrowser.Controller/Subtitles')
4 files changed, 129 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs new file mode 100644 index 0000000000..8b0ef223c3 --- /dev/null +++ b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs @@ -0,0 +1,50 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Providers; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Subtitles +{ + public interface ISubtitleManager + { + /// <summary> + /// Adds the parts. + /// </summary> + /// <param name="subtitleProviders">The subtitle providers.</param> + void AddParts(IEnumerable<ISubtitleProvider> subtitleProviders); + + /// <summary> + /// Searches the subtitles. + /// </summary> + /// <param name="video">The video.</param> + /// <param name="language">The language.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task{IEnumerable{RemoteSubtitleInfo}}.</returns> + Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(Video video, + string language, + CancellationToken cancellationToken); + + /// <summary> + /// Searches the subtitles. + /// </summary> + /// <param name="request">The request.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task{IEnumerable{RemoteSubtitleInfo}}.</returns> + Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(SubtitleSearchRequest request, + CancellationToken cancellationToken); + + /// <summary> + /// Downloads the subtitles. + /// </summary> + /// <param name="video">The video.</param> + /// <param name="subtitleId">The subtitle identifier.</param> + /// <param name="providerName">Name of the provider.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task.</returns> + Task DownloadSubtitles(Video video, + string subtitleId, + string providerName, + CancellationToken cancellationToken); + } +} diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs b/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs new file mode 100644 index 0000000000..dceea0cc69 --- /dev/null +++ b/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs @@ -0,0 +1,39 @@ +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Providers; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Subtitles +{ + 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<VideoContentType> SupportedMediaTypes { get; } + + /// <summary> + /// Searches the subtitles. + /// </summary> + /// <param name="request">The request.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task{IEnumerable{RemoteSubtitleInfo}}.</returns> + Task<IEnumerable<RemoteSubtitleInfo>> Search(SubtitleSearchRequest request, CancellationToken cancellationToken); + + /// <summary> + /// Gets the subtitles. + /// </summary> + /// <param name="id">The identifier.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task{SubtitleResponse}.</returns> + Task<SubtitleResponse> GetSubtitles(string id, CancellationToken cancellationToken); + } +} diff --git a/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs b/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs new file mode 100644 index 0000000000..69e92c1f58 --- /dev/null +++ b/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs @@ -0,0 +1,11 @@ +using System.IO; + +namespace MediaBrowser.Controller.Subtitles +{ + public class SubtitleResponse + { + public string Language { get; set; } + public string Format { get; set; } + public Stream Stream { get; set; } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs b/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs new file mode 100644 index 0000000000..e833871298 --- /dev/null +++ b/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs @@ -0,0 +1,29 @@ +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Entities; +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Subtitles +{ + public class SubtitleSearchRequest : IHasProviderIds + { + public string Language { get; set; } + + public VideoContentType 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 long? RuntimeTicks { get; set; } + public Dictionary<string, string> ProviderIds { get; set; } + + public SubtitleSearchRequest() + { + ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + } + } +}
\ No newline at end of file |
