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 | |
| parent | 8f3a6279e173dcbaaa05a56556afb410ee12dd4d (diff) | |
| parent | b9b568de13d81f9db1a8502d50940475c1d79c72 (diff) | |
Merge pull request #3 from MediaBrowser/master
Sync with Master
Diffstat (limited to 'MediaBrowser.Controller')
51 files changed, 646 insertions, 265 deletions
diff --git a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs index a0999593f..72a996b19 100644 --- a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs @@ -8,6 +8,8 @@ namespace MediaBrowser.Controller.Channels { public string ExternalId { get; set; } + public string ChannelId { get; set; } + public ChannelItemType ChannelItemType { get; set; } public bool IsInfiniteStream { get; set; } diff --git a/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs b/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs index 67f0ec65f..b20dcf620 100644 --- a/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs @@ -7,6 +7,8 @@ namespace MediaBrowser.Controller.Channels { public string ExternalId { get; set; } + public string ChannelId { get; set; } + public ChannelItemType ChannelItemType { get; set; } public string OriginalImageUrl { get; set; } diff --git a/MediaBrowser.Controller/Channels/ChannelInfo.cs b/MediaBrowser.Controller/Channels/ChannelInfo.cs new file mode 100644 index 000000000..fd3a169a2 --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelInfo.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Channels +{ + public class ChannelInfo + { + /// <summary> + /// Gets the home page URL. + /// </summary> + /// <value>The home page URL.</value> + public string HomePageUrl { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether this instance can search. + /// </summary> + /// <value><c>true</c> if this instance can search; otherwise, <c>false</c>.</value> + public bool CanSearch { get; set; } + + public List<ChannelMediaType> MediaTypes { get; set; } + + public List<ChannelMediaContentType> ContentTypes { get; set; } + + public ChannelInfo() + { + MediaTypes = new List<ChannelMediaType>(); + ContentTypes = new List<ChannelMediaContentType>(); + } + } + +} diff --git a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs index 104204eb0..7bb8d15fc 100644 --- a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs +++ b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs @@ -52,45 +52,4 @@ namespace MediaBrowser.Controller.Channels ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); } } - - public enum ChannelItemType - { - Media = 0, - - Category = 1 - } - - public enum ChannelMediaType - { - Audio = 0, - - Video = 1 - } - - public enum ChannelMediaContentType - { - Clip = 0, - - Podcast = 1, - - Trailer = 2, - - Movie = 3, - - Episode = 4, - - Song = 5 - } - - public class ChannelMediaInfo - { - public string Path { get; set; } - - public Dictionary<string, string> RequiredHttpHeaders { get; set; } - - public ChannelMediaInfo() - { - RequiredHttpHeaders = new Dictionary<string, string>(); - } - } } diff --git a/MediaBrowser.Controller/Channels/ChannelItemResult.cs b/MediaBrowser.Controller/Channels/ChannelItemResult.cs new file mode 100644 index 000000000..c6d33996e --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelItemResult.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Channels +{ + public class ChannelItemResult + { + public List<ChannelItemInfo> Items { get; set; } + + public TimeSpan CacheLength { get; set; } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ChannelItemType.cs b/MediaBrowser.Controller/Channels/ChannelItemType.cs new file mode 100644 index 000000000..ba9d7f414 --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelItemType.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Controller.Channels +{ + public enum ChannelItemType + { + Media = 0, + + Category = 1 + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ChannelMediaContentType.cs b/MediaBrowser.Controller/Channels/ChannelMediaContentType.cs new file mode 100644 index 000000000..2aad8e0d9 --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelMediaContentType.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Controller.Channels +{ + public enum ChannelMediaContentType + { + Clip = 0, + + Podcast = 1, + + Trailer = 2, + + Movie = 3, + + Episode = 4, + + Song = 5 + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs new file mode 100644 index 000000000..8105bf43c --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Channels +{ + public class ChannelMediaInfo + { + public string Path { get; set; } + + public Dictionary<string, string> RequiredHttpHeaders { get; set; } + + public string Container { get; set; } + public string AudioCodec { get; set; } + public string VideoCodec { get; set; } + + public int? AudioBitrate { get; set; } + public int? VideoBitrate { get; set; } + public int? Width { get; set; } + public int? Height { get; set; } + public int? AudioChannels { get; set; } + + public ChannelMediaInfo() + { + RequiredHttpHeaders = new Dictionary<string, string>(); + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ChannelMediaType.cs b/MediaBrowser.Controller/Channels/ChannelMediaType.cs new file mode 100644 index 000000000..a03e27498 --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelMediaType.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Controller.Channels +{ + public enum ChannelMediaType + { + Audio = 0, + + Video = 1 + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ChannelSearchInfo.cs b/MediaBrowser.Controller/Channels/ChannelSearchInfo.cs new file mode 100644 index 000000000..bf7461327 --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelSearchInfo.cs @@ -0,0 +1,7 @@ +namespace MediaBrowser.Controller.Channels +{ + public class ChannelSearchInfo + { + public string SearchTerm { get; set; } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs index 0bf05f965..0d2bd933b 100644 --- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs @@ -10,6 +10,8 @@ namespace MediaBrowser.Controller.Channels { public string ExternalId { get; set; } + public string ChannelId { get; set; } + public ChannelItemType ChannelItemType { get; set; } public bool IsInfiniteStream { get; set; } diff --git a/MediaBrowser.Controller/Channels/IChannel.cs b/MediaBrowser.Controller/Channels/IChannel.cs index 0c4be8630..bd0bd64ea 100644 --- a/MediaBrowser.Controller/Channels/IChannel.cs +++ b/MediaBrowser.Controller/Channels/IChannel.cs @@ -1,7 +1,6 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; -using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -60,48 +59,4 @@ namespace MediaBrowser.Controller.Channels /// <returns>IEnumerable{ImageType}.</returns> IEnumerable<ImageType> GetSupportedChannelImages(); } - - public class ChannelInfo - { - /// <summary> - /// Gets the home page URL. - /// </summary> - /// <value>The home page URL.</value> - public string HomePageUrl { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance can search. - /// </summary> - /// <value><c>true</c> if this instance can search; otherwise, <c>false</c>.</value> - public bool CanSearch { get; set; } - - public List<ChannelMediaType> MediaTypes { get; set; } - - public List<ChannelMediaContentType> ContentTypes { get; set; } - - public ChannelInfo() - { - MediaTypes = new List<ChannelMediaType>(); - ContentTypes = new List<ChannelMediaContentType>(); - } - } - - public class ChannelSearchInfo - { - public string SearchTerm { get; set; } - } - - public class InternalChannelItemQuery - { - public string CategoryId { get; set; } - - public User User { get; set; } - } - - public class ChannelItemResult - { - public List<ChannelItemInfo> Items { get; set; } - - public TimeSpan CacheLength { get; set; } - } } diff --git a/MediaBrowser.Controller/Channels/IChannelFactory.cs b/MediaBrowser.Controller/Channels/IChannelFactory.cs new file mode 100644 index 000000000..e275227ff --- /dev/null +++ b/MediaBrowser.Controller/Channels/IChannelFactory.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Channels +{ + public interface IChannelFactory + { + IEnumerable<IChannel> GetChannels(); + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/IChannelItem.cs b/MediaBrowser.Controller/Channels/IChannelItem.cs index a05ef8e29..fc088b888 100644 --- a/MediaBrowser.Controller/Channels/IChannelItem.cs +++ b/MediaBrowser.Controller/Channels/IChannelItem.cs @@ -4,17 +4,12 @@ namespace MediaBrowser.Controller.Channels { public interface IChannelItem : IHasImages { + string ChannelId { get; set; } + string ExternalId { get; set; } ChannelItemType ChannelItemType { get; set; } string OriginalImageUrl { get; set; } } - - public interface IChannelMediaItem : IChannelItem - { - bool IsInfiniteStream { get; set; } - - ChannelMediaContentType ContentType { get; set; } - } } diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs index b34e77415..05f9afcf0 100644 --- a/MediaBrowser.Controller/Channels/IChannelManager.cs +++ b/MediaBrowser.Controller/Channels/IChannelManager.cs @@ -13,7 +13,8 @@ namespace MediaBrowser.Controller.Channels /// Adds the parts. /// </summary> /// <param name="channels">The channels.</param> - void AddParts(IEnumerable<IChannel> channels); + /// <param name="factories">The factories.</param> + void AddParts(IEnumerable<IChannel> channels, IEnumerable<IChannelFactory> factories); /// <summary> /// Gets the channels. diff --git a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs b/MediaBrowser.Controller/Channels/IChannelMediaItem.cs new file mode 100644 index 000000000..3a2c076e0 --- /dev/null +++ b/MediaBrowser.Controller/Channels/IChannelMediaItem.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Controller.Channels +{ + public interface IChannelMediaItem : IChannelItem + { + bool IsInfiniteStream { get; set; } + + ChannelMediaContentType ContentType { get; set; } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs b/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs new file mode 100644 index 000000000..21100ebdd --- /dev/null +++ b/MediaBrowser.Controller/Channels/InternalChannelItemQuery.cs @@ -0,0 +1,11 @@ +using MediaBrowser.Controller.Entities; + +namespace MediaBrowser.Controller.Channels +{ + public class InternalChannelItemQuery + { + public string CategoryId { get; set; } + + public User User { get; set; } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Chapters/ChapterResponse.cs b/MediaBrowser.Controller/Chapters/ChapterResponse.cs new file mode 100644 index 000000000..3c1b8ed07 --- /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 + { + /// <summary> + /// Gets or sets the chapters. + /// </summary> + /// <value>The chapters.</value> + public List<RemoteChapterInfo> Chapters { get; set; } + + public ChapterResponse() + { + Chapters = new List<RemoteChapterInfo>(); + } + } +}
\ 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 000000000..9a53d68ea --- /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<string, string> ProviderIds { get; set; } + + public ChapterSearchRequest() + { + ProviderIds = new Dictionary<string, string>(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 000000000..a7505347b --- /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 + { + /// <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 specified request. + /// </summary> + /// <param name="request">The request.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task{IEnumerable{RemoteChapterResult}}.</returns> + Task<IEnumerable<RemoteChapterResult>> Search(ChapterSearchRequest request, CancellationToken cancellationToken); + + /// <summary> + /// Gets the chapters. + /// </summary> + /// <param name="id">The identifier.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task{ChapterResponse}.</returns> + Task<ChapterResponse> GetChapters(string id, CancellationToken cancellationToken); + } +} diff --git a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs index 810376f6c..6a2343a00 100644 --- a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs +++ b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs @@ -1,5 +1,7 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Events; +using System; namespace MediaBrowser.Controller.Configuration { @@ -9,6 +11,11 @@ namespace MediaBrowser.Controller.Configuration public interface IServerConfigurationManager : IConfigurationManager { /// <summary> + /// Occurs when [configuration updating]. + /// </summary> + event EventHandler<GenericEventArgs<ServerConfiguration>> ConfigurationUpdating; + + /// <summary> /// Gets the application paths. /// </summary> /// <value>The application paths.</value> diff --git a/MediaBrowser.Controller/Dlna/ControlRequest.cs b/MediaBrowser.Controller/Dlna/ControlRequest.cs index 1bb5ddf8a..7020cc0d9 100644 --- a/MediaBrowser.Controller/Dlna/ControlRequest.cs +++ b/MediaBrowser.Controller/Dlna/ControlRequest.cs @@ -17,18 +17,4 @@ namespace MediaBrowser.Controller.Dlna Headers = new Dictionary<string, string>(); } } - - public class ControlResponse - { - public IDictionary<string, string> Headers { get; set; } - - public string Xml { get; set; } - - public bool IsSuccessful { get; set; } - - public ControlResponse() - { - Headers = new Dictionary<string, string>(); - } - } } diff --git a/MediaBrowser.Controller/Dlna/ControlResponse.cs b/MediaBrowser.Controller/Dlna/ControlResponse.cs new file mode 100644 index 000000000..8d19a8109 --- /dev/null +++ b/MediaBrowser.Controller/Dlna/ControlResponse.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Dlna +{ + public class ControlResponse + { + public IDictionary<string, string> Headers { get; set; } + + public string Xml { get; set; } + + public bool IsSuccessful { get; set; } + + public ControlResponse() + { + Headers = new Dictionary<string, string>(); + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs index ad5e622fc..9c42e0581 100644 --- a/MediaBrowser.Controller/Drawing/IImageProcessor.cs +++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs @@ -55,7 +55,7 @@ namespace MediaBrowser.Controller.Drawing /// <param name="item">The item.</param> /// <param name="image">The image.</param> /// <returns>Guid.</returns> - Guid GetImageCacheTag(IHasImages item, ItemImageInfo image); + string GetImageCacheTag(IHasImages item, ItemImageInfo image); /// <summary> /// Gets the image cache tag. @@ -66,7 +66,7 @@ namespace MediaBrowser.Controller.Drawing /// <param name="dateModified">The date modified.</param> /// <param name="imageEnhancers">The image enhancers.</param> /// <returns>Guid.</returns> - Guid GetImageCacheTag(IHasImages item, ImageType imageType, string originalImagePath, DateTime dateModified, + string GetImageCacheTag(IHasImages item, ImageType imageType, string originalImagePath, DateTime dateModified, List<IImageEnhancer> imageEnhancers); /// <summary> @@ -86,24 +86,4 @@ namespace MediaBrowser.Controller.Drawing /// <returns>Task{System.String}.</returns> Task<string> GetEnhancedImage(IHasImages item, ImageType imageType, int imageIndex); } - - public static class ImageProcessorExtensions - { - public static Guid? GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType) - { - return processor.GetImageCacheTag(item, imageType, 0); - } - - public static Guid? GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType, int imageIndex) - { - var imageInfo = item.GetImageInfo(imageType, imageIndex); - - if (imageInfo == null) - { - return null; - } - - return processor.GetImageCacheTag(item, imageInfo); - } - } } diff --git a/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs new file mode 100644 index 000000000..c5601c49f --- /dev/null +++ b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs @@ -0,0 +1,25 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Controller.Drawing +{ + public static class ImageProcessorExtensions + { + public static string GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType) + { + return processor.GetImageCacheTag(item, imageType, 0); + } + + public static string GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType, int imageIndex) + { + var imageInfo = item.GetImageInfo(imageType, imageIndex); + + if (imageInfo == null) + { + return null; + } + + return processor.GetImageCacheTag(item, imageInfo); + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 503d1513c..be761ef66 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -305,13 +305,7 @@ namespace MediaBrowser.Controller.Entities.TV if (!ParentIndexNumber.HasValue && !string.IsNullOrEmpty(Path)) { - ParentIndexNumber = TVUtils.GetSeasonNumberFromPath(Path); - - // If a change was made record it - if (ParentIndexNumber.HasValue) - { - hasChanges = true; - } + ParentIndexNumber = TVUtils.GetSeasonNumberFromEpisodeFile(Path); } // If a change was made record it diff --git a/MediaBrowser.Controller/Library/IIntroProvider.cs b/MediaBrowser.Controller/Library/IIntroProvider.cs index 224ca2271..a83d3c5eb 100644 --- a/MediaBrowser.Controller/Library/IIntroProvider.cs +++ b/MediaBrowser.Controller/Library/IIntroProvider.cs @@ -1,5 +1,4 @@ using MediaBrowser.Controller.Entities; -using System; using System.Collections.Generic; namespace MediaBrowser.Controller.Library @@ -23,19 +22,4 @@ namespace MediaBrowser.Controller.Library /// <returns>IEnumerable{System.String}.</returns> IEnumerable<string> GetAllIntroFiles(); } - - public class IntroInfo - { - /// <summary> - /// Gets or sets the path. - /// </summary> - /// <value>The path.</value> - public string Path { get; set; } - - /// <summary> - /// Gets or sets the item id. - /// </summary> - /// <value>The item id.</value> - public Guid? ItemId { get; set; } - } } diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 7529f1e0d..69dea5e74 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -333,20 +333,4 @@ namespace MediaBrowser.Controller.Library /// <returns>IEnumerable{BaseItem}.</returns> IEnumerable<BaseItem> ReplaceVideosWithPrimaryVersions(IEnumerable<BaseItem> items); } - - public static class LibraryManagerExtensions - { - public static Task DeleteItem(this ILibraryManager manager, BaseItem item) - { - return manager.DeleteItem(item, new DeleteOptions - { - DeleteFileLocation = true - }); - } - - public static BaseItem GetItemById(this ILibraryManager manager, string id) - { - return manager.GetItemById(new Guid(id)); - } - } }
\ No newline at end of file diff --git a/MediaBrowser.Controller/Library/IMetadataFileSaver.cs b/MediaBrowser.Controller/Library/IMetadataFileSaver.cs new file mode 100644 index 000000000..0883da48f --- /dev/null +++ b/MediaBrowser.Controller/Library/IMetadataFileSaver.cs @@ -0,0 +1,14 @@ +using MediaBrowser.Controller.Entities; + +namespace MediaBrowser.Controller.Library +{ + public interface IMetadataFileSaver : IMetadataSaver + { + /// <summary> + /// Gets the save path. + /// </summary> + /// <param name="item">The item.</param> + /// <returns>System.String.</returns> + string GetSavePath(IHasMetadata item); + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Library/IMetadataSaver.cs b/MediaBrowser.Controller/Library/IMetadataSaver.cs index cfee9d206..ce8feb4c6 100644 --- a/MediaBrowser.Controller/Library/IMetadataSaver.cs +++ b/MediaBrowser.Controller/Library/IMetadataSaver.cs @@ -31,14 +31,4 @@ namespace MediaBrowser.Controller.Library /// <returns>Task.</returns> void Save(IHasMetadata item, CancellationToken cancellationToken); } - - public interface IMetadataFileSaver : IMetadataSaver - { - /// <summary> - /// Gets the save path. - /// </summary> - /// <param name="item">The item.</param> - /// <returns>System.String.</returns> - string GetSavePath(IHasMetadata item); - } } diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs index c3b0748cf..0a0174b6d 100644 --- a/MediaBrowser.Controller/Library/IUserManager.cs +++ b/MediaBrowser.Controller/Library/IUserManager.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Common.Events; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Events; using System; using System.Collections.Generic; using System.Threading; diff --git a/MediaBrowser.Controller/Library/IntroInfo.cs b/MediaBrowser.Controller/Library/IntroInfo.cs new file mode 100644 index 000000000..d0e61d0f0 --- /dev/null +++ b/MediaBrowser.Controller/Library/IntroInfo.cs @@ -0,0 +1,19 @@ +using System; + +namespace MediaBrowser.Controller.Library +{ + public class IntroInfo + { + /// <summary> + /// Gets or sets the path. + /// </summary> + /// <value>The path.</value> + public string Path { get; set; } + + /// <summary> + /// Gets or sets the item id. + /// </summary> + /// <value>The item id.</value> + public Guid? ItemId { get; set; } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs b/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs new file mode 100644 index 000000000..dd1c9c07a --- /dev/null +++ b/MediaBrowser.Controller/Library/LibraryManagerExtensions.cs @@ -0,0 +1,22 @@ +using System; +using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; + +namespace MediaBrowser.Controller.Library +{ + public static class LibraryManagerExtensions + { + public static Task DeleteItem(this ILibraryManager manager, BaseItem item) + { + return manager.DeleteItem(item, new DeleteOptions + { + DeleteFileLocation = true + }); + } + + public static BaseItem GetItemById(this ILibraryManager manager, string id) + { + return manager.GetItemById(new Guid(id)); + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs b/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs index 7482607ff..7b7b625bf 100644 --- a/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs +++ b/MediaBrowser.Controller/Library/PlaybackProgressEventArgs.cs @@ -24,13 +24,4 @@ namespace MediaBrowser.Controller.Library Users = new List<User>(); } } - - public class PlaybackStopEventArgs : PlaybackProgressEventArgs - { - /// <summary> - /// Gets or sets a value indicating whether [played to completion]. - /// </summary> - /// <value><c>true</c> if [played to completion]; otherwise, <c>false</c>.</value> - public bool PlayedToCompletion { get; set; } - } } diff --git a/MediaBrowser.Controller/Library/PlaybackStopEventArgs.cs b/MediaBrowser.Controller/Library/PlaybackStopEventArgs.cs new file mode 100644 index 000000000..b0f6799fc --- /dev/null +++ b/MediaBrowser.Controller/Library/PlaybackStopEventArgs.cs @@ -0,0 +1,11 @@ +namespace MediaBrowser.Controller.Library +{ + public class PlaybackStopEventArgs : PlaybackProgressEventArgs + { + /// <summary> + /// Gets or sets a value indicating whether [played to completion]. + /// </summary> + /// <value><c>true</c> if [played to completion]; otherwise, <c>false</c>.</value> + public bool PlayedToCompletion { get; set; } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/LiveTv/LiveTvConflictException.cs b/MediaBrowser.Controller/LiveTv/LiveTvConflictException.cs new file mode 100644 index 000000000..682150d35 --- /dev/null +++ b/MediaBrowser.Controller/LiveTv/LiveTvConflictException.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Controller.LiveTv +{ + /// <summary> + /// Class LiveTvConflictException. + /// </summary> + public class LiveTvConflictException : LiveTvException + { + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/LiveTv/LiveTvException.cs b/MediaBrowser.Controller/LiveTv/LiveTvException.cs index 0a68180ca..b0a6f75b1 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvException.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvException.cs @@ -8,11 +8,4 @@ namespace MediaBrowser.Controller.LiveTv public class LiveTvException : Exception { } - - /// <summary> - /// Class LiveTvConflictException. - /// </summary> - public class LiveTvConflictException : LiveTvException - { - } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs b/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs index da6b8ab17..0cb064aba 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs @@ -40,60 +40,4 @@ namespace MediaBrowser.Controller.LiveTv Tuners = new List<LiveTvTunerInfo>(); } } - - public class LiveTvTunerInfo - { - /// <summary> - /// Gets or sets the type of the source. - /// </summary> - /// <value>The type of the source.</value> - public string SourceType { get; set; } - - /// <summary> - /// Gets or sets the name. - /// </summary> - /// <value>The name.</value> - public string Name { get; set; } - - /// <summary> - /// Gets or sets the identifier. - /// </summary> - /// <value>The identifier.</value> - public string Id { get; set; } - - /// <summary> - /// Gets or sets the status. - /// </summary> - /// <value>The status.</value> - public LiveTvTunerStatus Status { get; set; } - - /// <summary> - /// Gets or sets the channel identifier. - /// </summary> - /// <value>The channel identifier.</value> - public string ChannelId { get; set; } - - /// <summary> - /// Gets or sets the recording identifier. - /// </summary> - /// <value>The recording identifier.</value> - public string RecordingId { get; set; } - - /// <summary> - /// Gets or sets the name of the program. - /// </summary> - /// <value>The name of the program.</value> - public string ProgramName { get; set; } - - /// <summary> - /// Gets or sets the clients. - /// </summary> - /// <value>The clients.</value> - public List<string> Clients { get; set; } - - public LiveTvTunerInfo() - { - Clients = new List<string>(); - } - } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs b/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs new file mode 100644 index 000000000..cdf2f0ef5 --- /dev/null +++ b/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using MediaBrowser.Model.LiveTv; + +namespace MediaBrowser.Controller.LiveTv +{ + public class LiveTvTunerInfo + { + /// <summary> + /// Gets or sets the type of the source. + /// </summary> + /// <value>The type of the source.</value> + public string SourceType { get; set; } + + /// <summary> + /// Gets or sets the name. + /// </summary> + /// <value>The name.</value> + public string Name { get; set; } + + /// <summary> + /// Gets or sets the identifier. + /// </summary> + /// <value>The identifier.</value> + public string Id { get; set; } + + /// <summary> + /// Gets or sets the status. + /// </summary> + /// <value>The status.</value> + public LiveTvTunerStatus Status { get; set; } + + /// <summary> + /// Gets or sets the channel identifier. + /// </summary> + /// <value>The channel identifier.</value> + public string ChannelId { get; set; } + + /// <summary> + /// Gets or sets the recording identifier. + /// </summary> + /// <value>The recording identifier.</value> + public string RecordingId { get; set; } + + /// <summary> + /// Gets or sets the name of the program. + /// </summary> + /// <value>The name of the program.</value> + public string ProgramName { get; set; } + + /// <summary> + /// Gets or sets the clients. + /// </summary> + /// <value>The clients.</value> + public List<string> Clients { get; set; } + + public LiveTvTunerInfo() + { + Clients = new List<string>(); + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/LiveTv/EventArgs.cs b/MediaBrowser.Controller/LiveTv/RecordingStatusChangedEventArgs.cs index 90ea329fe..90ea329fe 100644 --- a/MediaBrowser.Controller/LiveTv/EventArgs.cs +++ b/MediaBrowser.Controller/LiveTv/RecordingStatusChangedEventArgs.cs diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index b54ad2272..97158c112 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -69,16 +69,30 @@ <Link>Properties\SharedVersion.cs</Link> </Compile> <Compile Include="Channels\ChannelCategoryItem.cs" /> + <Compile Include="Channels\ChannelInfo.cs" /> <Compile Include="Channels\ChannelItemInfo.cs" /> + <Compile Include="Channels\ChannelItemResult.cs" /> + <Compile Include="Channels\ChannelItemType.cs" /> + <Compile Include="Channels\ChannelMediaContentType.cs" /> + <Compile Include="Channels\ChannelMediaInfo.cs" /> + <Compile Include="Channels\ChannelMediaType.cs" /> + <Compile Include="Channels\ChannelSearchInfo.cs" /> <Compile Include="Channels\IChannel.cs" /> + <Compile Include="Channels\IChannelFactory.cs" /> <Compile Include="Channels\IChannelManager.cs" /> <Compile Include="Channels\IChannelItem.cs" /> <Compile Include="Channels\ChannelAudioItem.cs" /> <Compile Include="Channels\ChannelVideoItem.cs" /> <Compile Include="Channels\Channel.cs" /> + <Compile Include="Channels\IChannelMediaItem.cs" /> + <Compile Include="Channels\InternalChannelItemQuery.cs" /> + <Compile Include="Chapters\ChapterSearchRequest.cs" /> + <Compile Include="Chapters\IChapterProvider.cs" /> + <Compile Include="Chapters\ChapterResponse.cs" /> <Compile Include="Collections\CollectionCreationOptions.cs" /> <Compile Include="Collections\ICollectionManager.cs" /> <Compile Include="Dlna\ControlRequest.cs" /> + <Compile Include="Dlna\ControlResponse.cs" /> <Compile Include="Dlna\DlnaIconResponse.cs" /> <Compile Include="Dlna\EventSubscriptionResponse.cs" /> <Compile Include="Dlna\IContentDirectory.cs" /> @@ -87,6 +101,7 @@ <Compile Include="Drawing\IImageProcessor.cs" /> <Compile Include="Drawing\ImageFormat.cs" /> <Compile Include="Drawing\ImageProcessingOptions.cs" /> + <Compile Include="Drawing\ImageProcessorExtensions.cs" /> <Compile Include="Dto\IDtoService.cs" /> <Compile Include="Entities\AdultVideo.cs" /> <Compile Include="Entities\Audio\IHasAlbumArtist.cs" /> @@ -131,12 +146,16 @@ <Compile Include="FileOrganization\IFileOrganizationService.cs" /> <Compile Include="Library\DeleteOptions.cs" /> <Compile Include="Library\ILibraryPostScanTask.cs" /> + <Compile Include="Library\IMetadataFileSaver.cs" /> <Compile Include="Library\IMetadataSaver.cs" /> <Compile Include="Library\IMusicManager.cs" /> + <Compile Include="Library\IntroInfo.cs" /> <Compile Include="Library\ItemUpdateType.cs" /> <Compile Include="Library\IUserDataManager.cs" /> + <Compile Include="Library\LibraryManagerExtensions.cs" /> + <Compile Include="Library\PlaybackStopEventArgs.cs" /> <Compile Include="Library\UserDataSaveEventArgs.cs" /> - <Compile Include="LiveTv\EventArgs.cs" /> + <Compile Include="LiveTv\RecordingStatusChangedEventArgs.cs" /> <Compile Include="LiveTv\ILiveTvRecording.cs" /> <Compile Include="LiveTv\LiveStreamInfo.cs" /> <Compile Include="LiveTv\LiveTvAudioRecording.cs" /> @@ -144,8 +163,10 @@ <Compile Include="LiveTv\ChannelInfo.cs" /> <Compile Include="LiveTv\ILiveTvManager.cs" /> <Compile Include="LiveTv\ILiveTvService.cs" /> + <Compile Include="LiveTv\LiveTvConflictException.cs" /> <Compile Include="LiveTv\LiveTvException.cs" /> <Compile Include="LiveTv\LiveTvServiceStatusInfo.cs" /> + <Compile Include="LiveTv\LiveTvTunerInfo.cs" /> <Compile Include="LiveTv\StreamResponseInfo.cs" /> <Compile Include="LiveTv\LiveTvProgram.cs" /> <Compile Include="LiveTv\LiveTvVideoRecording.cs" /> @@ -190,6 +211,10 @@ <Compile Include="Providers\IMetadataProvider.cs" /> <Compile Include="Providers\IMetadataService.cs" /> <Compile Include="Providers\IRemoteMetadataProvider.cs" /> + <Compile Include="Providers\VideoContentType.cs" /> + <Compile Include="Security\IEncryptionManager.cs" /> + <Compile Include="Subtitles\ISubtitleManager.cs" /> + <Compile Include="Subtitles\ISubtitleProvider.cs" /> <Compile Include="Providers\ItemLookupInfo.cs" /> <Compile Include="Providers\MetadataRefreshOptions.cs" /> <Compile Include="Providers\NameParser.cs" /> @@ -265,6 +290,8 @@ <Compile Include="Sorting\IUserBaseItemComparer.cs" /> <Compile Include="Providers\BaseItemXmlParser.cs" /> <Compile Include="Sorting\SortExtensions.cs" /> + <Compile Include="Subtitles\SubtitleResponse.cs" /> + <Compile Include="Subtitles\SubtitleSearchRequest.cs" /> <Compile Include="Themes\IAppThemeManager.cs" /> <Compile Include="Themes\InternalThemeImage.cs" /> </ItemGroup> diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs index 521bf7a81..6a37626b7 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs @@ -187,7 +187,9 @@ namespace MediaBrowser.Controller.MediaEncoding } else if (string.Equals(streamInfo.codec_type, "video", StringComparison.OrdinalIgnoreCase)) { - stream.Type = MediaStreamType.Video; + stream.Type = (streamInfo.codec_name ?? string.Empty).IndexOf("mjpeg", StringComparison.OrdinalIgnoreCase) != -1 + ? MediaStreamType.EmbeddedImage + : MediaStreamType.Video; stream.Width = streamInfo.width; stream.Height = streamInfo.height; diff --git a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs index 4e56932ec..84fedebce 100644 --- a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs +++ b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs @@ -34,6 +34,6 @@ namespace MediaBrowser.Controller.Persistence /// <param name="userId">The user id.</param> /// <param name="client">The client.</param> /// <returns>Task{DisplayPreferences}.</returns> - DisplayPreferences GetDisplayPreferences(Guid displayPreferencesId, Guid userId, string client); + DisplayPreferences GetDisplayPreferences(string displayPreferencesId, Guid userId, string client); } } diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 9d41b6d25..6f70df435 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -11,6 +11,7 @@ namespace MediaBrowser.Controller.Providers { List<FileSystemInfo> GetFileSystemEntries(string path); IEnumerable<FileSystemInfo> GetFiles(string path); + IEnumerable<FileSystemInfo> GetFiles(string path, bool clearCache); FileSystemInfo GetFile(string path); } @@ -27,8 +28,20 @@ namespace MediaBrowser.Controller.Providers public List<FileSystemInfo> GetFileSystemEntries(string path) { + return GetFileSystemEntries(path, false); + } + + private List<FileSystemInfo> GetFileSystemEntries(string path, bool clearCache) + { List<FileSystemInfo> entries; + if (clearCache) + { + List<FileSystemInfo> removed; + + _cache.TryRemove(path, out removed); + } + if (!_cache.TryGetValue(path, out entries)) { //_logger.Debug("Getting files for " + path); @@ -50,7 +63,12 @@ namespace MediaBrowser.Controller.Providers public IEnumerable<FileSystemInfo> GetFiles(string path) { - return GetFileSystemEntries(path).Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory); + return GetFiles(path, false); + } + + public IEnumerable<FileSystemInfo> GetFiles(string path, bool clearCache) + { + return GetFileSystemEntries(path, clearCache).Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory); } public FileSystemInfo GetFile(string path) diff --git a/MediaBrowser.Controller/Providers/VideoContentType.cs b/MediaBrowser.Controller/Providers/VideoContentType.cs new file mode 100644 index 000000000..903c77612 --- /dev/null +++ b/MediaBrowser.Controller/Providers/VideoContentType.cs @@ -0,0 +1,19 @@ + +namespace MediaBrowser.Controller.Providers +{ + /// <summary> + /// Enum VideoContentType + /// </summary> + public enum VideoContentType + { + /// <summary> + /// The episode + /// </summary> + Episode = 0, + + /// <summary> + /// The movie + /// </summary> + Movie = 1 + } +} diff --git a/MediaBrowser.Controller/Security/IEncryptionManager.cs b/MediaBrowser.Controller/Security/IEncryptionManager.cs new file mode 100644 index 000000000..bb4f77d83 --- /dev/null +++ b/MediaBrowser.Controller/Security/IEncryptionManager.cs @@ -0,0 +1,20 @@ + +namespace MediaBrowser.Controller.Security +{ + public interface IEncryptionManager + { + /// <summary> + /// Encrypts the string. + /// </summary> + /// <param name="value">The value.</param> + /// <returns>System.String.</returns> + string EncryptString(string value); + + /// <summary> + /// Decrypts the string. + /// </summary> + /// <param name="value">The value.</param> + /// <returns>System.String.</returns> + string DecryptString(string value); + } +} diff --git a/MediaBrowser.Controller/Session/ISessionController.cs b/MediaBrowser.Controller/Session/ISessionController.cs index d4612acb5..9c818284d 100644 --- a/MediaBrowser.Controller/Session/ISessionController.cs +++ b/MediaBrowser.Controller/Session/ISessionController.cs @@ -20,14 +20,6 @@ namespace MediaBrowser.Controller.Session bool IsSessionActive { get; } /// <summary> - /// Sends the message command. - /// </summary> - /// <param name="command">The command.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken); - - /// <summary> /// Sends the play command. /// </summary> /// <param name="command">The command.</param> diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs new file mode 100644 index 000000000..8b0ef223c --- /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 000000000..dceea0cc6 --- /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 000000000..69e92c1f5 --- /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 000000000..e83387129 --- /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 |
