From 0d605b8672ece5129e833a2e9cde11a8aaf1b62a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 11 May 2014 18:38:10 -0400 Subject: update subtitle interface --- .../Chapters/ChapterResponse.cs | 19 ++++++++++ .../Chapters/ChapterSearchRequest.cs | 29 +++++++++++++++ .../Chapters/IChapterProvider.cs | 39 ++++++++++++++++++++ .../MediaBrowser.Controller.csproj | 6 ++++ .../Providers/VideoContentType.cs | 19 ++++++++++ .../Subtitles/ISubtitleProvider.cs | 42 ++-------------------- .../Subtitles/SubtitleResponse.cs | 11 ++++++ .../Subtitles/SubtitleSearchRequest.cs | 29 +++++++++++++++ 8 files changed, 155 insertions(+), 39 deletions(-) create mode 100644 MediaBrowser.Controller/Chapters/ChapterResponse.cs create mode 100644 MediaBrowser.Controller/Chapters/ChapterSearchRequest.cs create mode 100644 MediaBrowser.Controller/Chapters/IChapterProvider.cs create mode 100644 MediaBrowser.Controller/Providers/VideoContentType.cs create mode 100644 MediaBrowser.Controller/Subtitles/SubtitleResponse.cs create mode 100644 MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Chapters/ChapterResponse.cs b/MediaBrowser.Controller/Chapters/ChapterResponse.cs new file mode 100644 index 0000000000..3c1b8ed079 --- /dev/null +++ b/MediaBrowser.Controller/Chapters/ChapterResponse.cs @@ -0,0 +1,19 @@ +using MediaBrowser.Model.Chapters; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Chapters +{ + public class ChapterResponse + { + /// + /// Gets or sets the chapters. + /// + /// The chapters. + public List Chapters { get; set; } + + public ChapterResponse() + { + Chapters = new List(); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Controller/Chapters/ChapterSearchRequest.cs b/MediaBrowser.Controller/Chapters/ChapterSearchRequest.cs new file mode 100644 index 0000000000..9a53d68ea8 --- /dev/null +++ b/MediaBrowser.Controller/Chapters/ChapterSearchRequest.cs @@ -0,0 +1,29 @@ +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Entities; +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Chapters +{ + public class ChapterSearchRequest : 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 ProviderIds { get; set; } + + public ChapterSearchRequest() + { + ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Controller/Chapters/IChapterProvider.cs b/MediaBrowser.Controller/Chapters/IChapterProvider.cs new file mode 100644 index 0000000000..a7505347b8 --- /dev/null +++ b/MediaBrowser.Controller/Chapters/IChapterProvider.cs @@ -0,0 +1,39 @@ +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Chapters; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Chapters +{ + public interface IChapterProvider + { + /// + /// Gets the name. + /// + /// The name. + string Name { get; } + + /// + /// Gets the supported media types. + /// + /// The supported media types. + IEnumerable SupportedMediaTypes { get; } + + /// + /// Searches the specified request. + /// + /// The request. + /// The cancellation token. + /// Task{IEnumerable{RemoteChapterResult}}. + Task> Search(ChapterSearchRequest request, CancellationToken cancellationToken); + + /// + /// Gets the chapters. + /// + /// The identifier. + /// The cancellation token. + /// Task{ChapterResponse}. + Task GetChapters(string id, CancellationToken cancellationToken); + } +} diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 6a7557e3a5..c7c4c5b5f6 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -77,6 +77,9 @@ + + + @@ -191,6 +194,7 @@ + @@ -269,6 +273,8 @@ + + diff --git a/MediaBrowser.Controller/Providers/VideoContentType.cs b/MediaBrowser.Controller/Providers/VideoContentType.cs new file mode 100644 index 0000000000..903c77612e --- /dev/null +++ b/MediaBrowser.Controller/Providers/VideoContentType.cs @@ -0,0 +1,19 @@ + +namespace MediaBrowser.Controller.Providers +{ + /// + /// Enum VideoContentType + /// + public enum VideoContentType + { + /// + /// The episode + /// + Episode = 0, + + /// + /// The movie + /// + Movie = 1 + } +} diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs b/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs index 1409b7d503..dceea0cc69 100644 --- a/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs +++ b/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs @@ -1,8 +1,6 @@ -using MediaBrowser.Model.Entities; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Providers; -using System; using System.Collections.Generic; -using System.IO; using System.Threading; using System.Threading.Tasks; @@ -20,7 +18,7 @@ namespace MediaBrowser.Controller.Subtitles /// Gets the supported media types. /// /// The supported media types. - IEnumerable SupportedMediaTypes { get; } + IEnumerable SupportedMediaTypes { get; } /// /// Searches the subtitles. @@ -28,7 +26,7 @@ namespace MediaBrowser.Controller.Subtitles /// The request. /// The cancellation token. /// Task{IEnumerable{RemoteSubtitleInfo}}. - Task> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken); + Task> Search(SubtitleSearchRequest request, CancellationToken cancellationToken); /// /// Gets the subtitles. @@ -38,38 +36,4 @@ namespace MediaBrowser.Controller.Subtitles /// 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); - } - } } 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 ProviderIds { get; set; } + + public SubtitleSearchRequest() + { + ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); + } + } +} \ No newline at end of file -- cgit v1.2.3