From c3f2021cadc56d4cca2be0ce855dac01830eb0b0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 4 May 2014 10:19:46 -0400 Subject: left align web client content --- .../Library/Validators/BoxSetPostScanTask.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations/Library/Validators') diff --git a/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs b/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs index f02c907c6..86d88f7e0 100644 --- a/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs +++ b/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs @@ -27,7 +27,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators foreach (var boxset in boxsets) { - foreach (var child in boxset.GetLinkedChildren().OfType()) + foreach (var child in boxset.Children.Concat(boxset.GetLinkedChildren()).OfType()) { var boxsetIdList = child.BoxSetIdList.ToList(); if (!boxsetIdList.Contains(boxset.Id)) -- cgit v1.2.3 From 0d025f7fb620bf2a24ca9aa4e5994f132e02e7c0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 6 May 2014 22:28:19 -0400 Subject: beginning remote subtitle downloading --- MediaBrowser.Api/ChannelService.cs | 2 +- MediaBrowser.Api/Images/ImageByNameService.cs | 90 ++++++++++++- MediaBrowser.Api/Images/ImageService.cs | 4 +- MediaBrowser.Api/ItemLookupService.cs | 27 +++- MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs | 2 +- MediaBrowser.Api/UserLibrary/ItemsService.cs | 3 + .../HttpClientManager/HttpClientManager.cs | 13 +- .../ScheduledTasks/Tasks/DeleteCacheFileTask.cs | 6 +- MediaBrowser.Common/Net/HttpRequestOptions.cs | 16 +-- .../MediaBrowser.Controller.csproj | 3 +- .../Providers/ISubtitleProvider.cs | 66 ---------- .../Subtitles/ISubtitleManager.cs | 50 ++++++++ .../Subtitles/ISubtitleProvider.cs | 75 +++++++++++ MediaBrowser.Dlna/PlayTo/Device.cs | 4 + MediaBrowser.Dlna/PlayTo/DlnaController.cs | 31 +++++ .../MediaBrowser.MediaEncoding.csproj | 2 +- .../Subtitles/ISubtitleParser.cs | 2 +- MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs | 4 +- MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs | 4 +- .../Subtitles/SubtitleInfo.cs | 22 ---- .../Subtitles/SubtitleTrackInfo.cs | 22 ++++ .../MediaBrowser.Model.Portable.csproj | 3 + .../MediaBrowser.Model.net35.csproj | 3 + MediaBrowser.Model/ApiClient/IApiClient.cs | 2 +- .../Configuration/ServerConfiguration.cs | 17 +++ MediaBrowser.Model/Dto/StreamOptions.cs | 2 +- MediaBrowser.Model/MediaBrowser.Model.csproj | 1 + MediaBrowser.Model/Providers/RemoteSubtitleInfo.cs | 19 +++ MediaBrowser.Model/Querying/ItemFilter.cs | 4 + .../MediaBrowser.Providers.csproj | 2 + .../MediaInfo/FFProbeProvider.cs | 14 +- .../MediaInfo/FFProbeVideoInfo.cs | 57 +++++++-- .../MediaInfo/SubtitleDownloader.cs | 140 ++++++++++++++++++++ .../Subtitles/OpenSubtitleDownloader.cs | 138 +++++++++++--------- .../Subtitles/SubtitleManager.cs | 141 +++++++++++++++++++++ .../Channels/ChannelManager.cs | 2 +- .../Collections/CollectionManager.cs | 8 +- .../HttpServer/ServerLogger.cs | 6 +- .../Library/Validators/PeoplePostScanTask.cs | 44 ------- .../Localization/LocalizationManager.cs | 47 ++----- .../Localization/Server/server.json | 81 +++++++++++- .../Localization/countries.json | 1 + .../Localization/cultures.json | 1 + .../MediaBrowser.Server.Implementations.csproj | 3 +- MediaBrowser.ServerApplication/ApplicationHost.cs | 11 +- .../FFMpeg/FFMpegDownloadInfo.cs | 81 +++++++----- .../FFMpeg/FFMpegDownloader.cs | 135 +++++++++++--------- .../FFMpeg/FFMpegInfo.cs | 2 +- .../MediaBrowser.WebDashboard.csproj | 3 + OpenSubtitlesHandler/OpenSubtitles.cs | 52 ++++++++ OpenSubtitlesHandler/Utilities.cs | 20 ++- 51 files changed, 1112 insertions(+), 376 deletions(-) delete mode 100644 MediaBrowser.Controller/Providers/ISubtitleProvider.cs create mode 100644 MediaBrowser.Controller/Subtitles/ISubtitleManager.cs create mode 100644 MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs delete mode 100644 MediaBrowser.MediaEncoding/Subtitles/SubtitleInfo.cs create mode 100644 MediaBrowser.MediaEncoding/Subtitles/SubtitleTrackInfo.cs create mode 100644 MediaBrowser.Model/Providers/RemoteSubtitleInfo.cs create mode 100644 MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs create mode 100644 MediaBrowser.Providers/Subtitles/SubtitleManager.cs delete mode 100644 MediaBrowser.Server.Implementations/Library/Validators/PeoplePostScanTask.cs create mode 100644 MediaBrowser.Server.Implementations/Localization/countries.json create mode 100644 MediaBrowser.Server.Implementations/Localization/cultures.json (limited to 'MediaBrowser.Server.Implementations/Library/Validators') diff --git a/MediaBrowser.Api/ChannelService.cs b/MediaBrowser.Api/ChannelService.cs index a0795c14d..9fa4eec4a 100644 --- a/MediaBrowser.Api/ChannelService.cs +++ b/MediaBrowser.Api/ChannelService.cs @@ -67,7 +67,7 @@ namespace MediaBrowser.Api [ApiMember(Name = "SortOrder", Description = "Sort Order - Ascending,Descending", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public SortOrder? SortOrder { get; set; } - [ApiMember(Name = "Filters", Description = "Optional. Specify additional filters to apply. This allows multiple, comma delimeted. Options: IsFolder, IsNotFolder, IsUnplayed, IsPlayed, IsFavorite, IsRecentlyAdded, IsResumable, Likes, Dislikes", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + [ApiMember(Name = "Filters", Description = "Optional. Specify additional filters to apply. This allows multiple, comma delimeted. Options: IsFolder, IsNotFolder, IsUnplayed, IsPlayed, IsFavorite, IsResumable, Likes, Dislikes", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string Filters { get; set; } [ApiMember(Name = "SortBy", Description = "Optional. Specify one or more sort orders, comma delimeted. Options: Album, AlbumArtist, Artist, Budget, CommunityRating, CriticRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Revenue, Runtime", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.cs index 44a69f6de..6dda2ae7a 100644 --- a/MediaBrowser.Api/Images/ImageByNameService.cs +++ b/MediaBrowser.Api/Images/ImageByNameService.cs @@ -1,8 +1,10 @@ using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.IO; using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; using ServiceStack; using System; +using System.Collections.Generic; using System.IO; using System.Linq; @@ -70,6 +72,32 @@ namespace MediaBrowser.Api.Images public string Theme { get; set; } } + [Route("/Images/MediaInfo", "GET")] + [Api(Description = "Gets all media info image by name")] + public class GetMediaInfoImages : IReturn> + { + } + + [Route("/Images/Ratings", "GET")] + [Api(Description = "Gets all rating images by name")] + public class GetRatingImages : IReturn> + { + } + + [Route("/Images/General", "GET")] + [Api(Description = "Gets all general images by name")] + public class GetGeneralImages : IReturn> + { + } + + public class ImageByNameInfo + { + public string Name { get; set; } + public string Theme { get; set; } + public long FileLength { get; set; } + public string Format { get; set; } + } + /// /// Class ImageByNameService /// @@ -89,6 +117,60 @@ namespace MediaBrowser.Api.Images _appPaths = appPaths; } + public object Get(GetMediaInfoImages request) + { + return ToOptimizedResult(GetImageList(_appPaths.MediaInfoImagesPath)); + } + + public object Get(GetRatingImages request) + { + return ToOptimizedResult(GetImageList(_appPaths.RatingsPath)); + } + + public object Get(GetGeneralImages request) + { + return ToOptimizedResult(GetImageList(_appPaths.GeneralPath)); + } + + private List GetImageList(string path) + { + try + { + return new DirectoryInfo(path) + .GetFiles("*", SearchOption.AllDirectories) + .Where(i => BaseItem.SupportedImageExtensions.Contains(i.Extension, StringComparer.Ordinal)) + .Select(i => new ImageByNameInfo + { + Name = Path.GetFileNameWithoutExtension(i.FullName), + FileLength = i.Length, + Theme = GetThemeName(i.FullName, path), + Format = i.Extension.ToLower().TrimStart('.') + }) + .OrderBy(i => i.Name) + .ToList(); + } + catch (DirectoryNotFoundException) + { + return new List(); + } + } + + private string GetThemeName(string path, string rootImagePath) + { + var parentName = Path.GetDirectoryName(path); + + if (string.Equals(parentName, rootImagePath, StringComparison.OrdinalIgnoreCase)) + { + return null; + } + + parentName = Path.GetFileName(parentName); + + return string.Equals(parentName, "all", StringComparison.OrdinalIgnoreCase) ? + null : + parentName; + } + /// /// Gets the specified request. /// @@ -118,7 +200,8 @@ namespace MediaBrowser.Api.Images if (Directory.Exists(themeFolder)) { - var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, request.Name + i)) + var path = BaseItem.SupportedImageExtensions + .Select(i => Path.Combine(themeFolder, request.Name + i)) .FirstOrDefault(File.Exists); if (!string.IsNullOrEmpty(path)) @@ -134,7 +217,8 @@ namespace MediaBrowser.Api.Images // Avoid implicitly captured closure var currentRequest = request; - var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, currentRequest.Name + i)) + var path = BaseItem.SupportedImageExtensions + .Select(i => Path.Combine(allFolder, currentRequest.Name + i)) .FirstOrDefault(File.Exists); if (!string.IsNullOrEmpty(path)) @@ -175,7 +259,7 @@ namespace MediaBrowser.Api.Images var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, currentRequest.Name + i)) .FirstOrDefault(File.Exists); - + if (!string.IsNullOrEmpty(path)) { return ToStaticFileResult(path); diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index a5bb291ae..ce3eaf053 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -1,5 +1,4 @@ -using System.Globalization; -using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Extensions; using MediaBrowser.Common.IO; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Entities; @@ -14,6 +13,7 @@ using ServiceStack.Text.Controller; using ServiceStack.Web; using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Threading; diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.cs index b600c3b46..86fdd6da8 100644 --- a/MediaBrowser.Api/ItemLookupService.cs +++ b/MediaBrowser.Api/ItemLookupService.cs @@ -1,13 +1,13 @@ using MediaBrowser.Common.Extensions; using MediaBrowser.Common.IO; using MediaBrowser.Controller; -using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; +using MediaBrowser.Controller.Subtitles; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Providers; using ServiceStack; @@ -32,6 +32,16 @@ namespace MediaBrowser.Api public string Id { get; set; } } + [Route("/Items/{Id}/RemoteSearch/Subtitles/{Language}", "GET")] + public class SearchRemoteSubtitles : IReturn> + { + [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Id { get; set; } + + [ApiMember(Name = "Language", Description = "Language", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Language { get; set; } + } + [Route("/Items/RemoteSearch/Movie", "POST")] [Api(Description = "Gets external id infos for an item")] public class GetMovieRemoteSearchResults : RemoteSearchQuery, IReturn> @@ -107,19 +117,28 @@ namespace MediaBrowser.Api public class ItemLookupService : BaseApiService { - private readonly IDtoService _dtoService; private readonly IProviderManager _providerManager; private readonly IServerApplicationPaths _appPaths; private readonly IFileSystem _fileSystem; private readonly ILibraryManager _libraryManager; + private readonly ISubtitleManager _subtitleManager; - public ItemLookupService(IDtoService dtoService, IProviderManager providerManager, IServerApplicationPaths appPaths, IFileSystem fileSystem, ILibraryManager libraryManager) + public ItemLookupService(IProviderManager providerManager, IServerApplicationPaths appPaths, IFileSystem fileSystem, ILibraryManager libraryManager, ISubtitleManager subtitleManager) { - _dtoService = dtoService; _providerManager = providerManager; _appPaths = appPaths; _fileSystem = fileSystem; _libraryManager = libraryManager; + _subtitleManager = subtitleManager; + } + + public object Get(SearchRemoteSubtitles request) + { + var video = (Video)_libraryManager.GetItemById(request.Id); + + var response = _subtitleManager.SearchSubtitles(video, request.Language, CancellationToken.None).Result; + + return ToOptimizedResult(response); } public object Get(GetExternalIdInfos request) diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs index f1fe904f3..cc76ee95f 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs @@ -69,7 +69,7 @@ namespace MediaBrowser.Api.UserLibrary /// Filters to apply to the results /// /// The filters. - [ApiMember(Name = "Filters", Description = "Optional. Specify additional filters to apply. This allows multiple, comma delimeted. Options: IsFolder, IsNotFolder, IsUnplayed, IsPlayed, IsFavorite, IsRecentlyAdded, IsResumable, Likes, Dislikes", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + [ApiMember(Name = "Filters", Description = "Optional. Specify additional filters to apply. This allows multiple, comma delimeted. Options: IsFolder, IsNotFolder, IsUnplayed, IsPlayed, IsFavorite, IsResumable, Likes, Dislikes", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string Filters { get; set; } /// diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 1cd819197..c7f36e6ac 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -521,6 +521,9 @@ namespace MediaBrowser.Api.UserLibrary case ItemFilter.IsNotFolder: return items.Where(item => !item.IsFolder); + + case ItemFilter.IsRecentlyAdded: + return items.Where(item => (DateTime.UtcNow - item.DateCreated).TotalDays <= 10); } return items; diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index a88f457c5..0a9f0ff8a 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -114,9 +114,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None; - request.CachePolicy = options.CachePolicy == Net.HttpRequestCachePolicy.None ? - new RequestCachePolicy(RequestCacheLevel.BypassCache) : - new RequestCachePolicy(RequestCacheLevel.Revalidate); + request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache); request.ConnectionGroupName = GetHostFromUrl(options.Url); request.KeepAlive = true; @@ -124,6 +122,11 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.Pipelined = true; request.Timeout = 20000; + if (!string.IsNullOrEmpty(options.Host)) + { + request.Host = options.Host; + } + #if !__MonoCS__ // This is a hack to prevent KeepAlive from getting disabled internally by the HttpWebRequest // May need to remove this for mono @@ -234,9 +237,11 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager !string.IsNullOrEmpty(options.RequestContent) || string.Equals(httpMethod, "post", StringComparison.OrdinalIgnoreCase)) { - var bytes = options.RequestContentBytes ?? Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty); + var bytes = options.RequestContentBytes ?? + Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty); httpWebRequest.ContentType = options.RequestContentType ?? "application/x-www-form-urlencoded"; + httpWebRequest.ContentLength = bytes.Length; httpWebRequest.GetRequestStream().Write(bytes, 0, bytes.Length); } diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs index a5b8de554..dbeedfed5 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs @@ -25,7 +25,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks private readonly ILogger _logger; private readonly IFileSystem _fileSystem; - + /// /// Initializes a new instance of the class. /// @@ -74,9 +74,11 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks progress.Report(90); + minDateModified = DateTime.UtcNow.AddDays(-3); + try { - DeleteCacheFilesFromDirectory(cancellationToken, ApplicationPaths.TempDirectory, DateTime.MaxValue, progress); + DeleteCacheFilesFromDirectory(cancellationToken, ApplicationPaths.TempDirectory, minDateModified, progress); } catch (DirectoryNotFoundException) { diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs index 11152b30f..192264eed 100644 --- a/MediaBrowser.Common/Net/HttpRequestOptions.cs +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -52,6 +52,12 @@ namespace MediaBrowser.Common.Net } } + /// + /// Gets or sets the host. + /// + /// The host. + public string Host { get; set; } + /// /// Gets or sets the progress. /// @@ -76,8 +82,6 @@ namespace MediaBrowser.Common.Net public bool LogRequest { get; set; } public bool LogErrorResponseBody { get; set; } - - public HttpRequestCachePolicy CachePolicy { get; set; } private string GetHeaderValue(string name) { @@ -96,17 +100,9 @@ namespace MediaBrowser.Common.Net EnableHttpCompression = true; BufferContent = true; - CachePolicy = HttpRequestCachePolicy.None; - RequestHeaders = new Dictionary(StringComparer.OrdinalIgnoreCase); LogRequest = true; } } - - public enum HttpRequestCachePolicy - { - None = 1, - Validate = 2 - } } diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 5e259359f..6a3709dda 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -191,7 +191,8 @@ - + + diff --git a/MediaBrowser.Controller/Providers/ISubtitleProvider.cs b/MediaBrowser.Controller/Providers/ISubtitleProvider.cs deleted file mode 100644 index 09ca27e30..000000000 --- a/MediaBrowser.Controller/Providers/ISubtitleProvider.cs +++ /dev/null @@ -1,66 +0,0 @@ -using MediaBrowser.Model.Entities; -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.Providers -{ - public interface ISubtitleProvider - { - /// - /// Gets the name. - /// - /// The name. - string Name { get; } - - /// - /// Gets the supported media types. - /// - /// The supported media types. - IEnumerable SupportedMediaTypes { get; } - - /// - /// Gets the subtitles. - /// - /// The request. - /// The cancellation token. - /// Task{SubtitleResponse}. - Task GetSubtitles(SubtitleRequest request, CancellationToken cancellationToken); - } - - public enum SubtitleMediaType - { - Episode = 0, - Movie = 1 - } - - public class SubtitleResponse - { - public string Format { get; set; } - public bool HasContent { get; set; } - public Stream Stream { get; set; } - } - - public class SubtitleRequest : 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 SubtitleRequest() - { - ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - } -} 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 + { + /// + /// Adds the parts. + /// + /// The subtitle providers. + void AddParts(IEnumerable subtitleProviders); + + /// + /// Searches the subtitles. + /// + /// The video. + /// The language. + /// The cancellation token. + /// Task{IEnumerable{RemoteSubtitleInfo}}. + Task> SearchSubtitles(Video video, + string language, + CancellationToken cancellationToken); + + /// + /// Searches the subtitles. + /// + /// The request. + /// The cancellation token. + /// Task{IEnumerable{RemoteSubtitleInfo}}. + Task> SearchSubtitles(SubtitleSearchRequest request, + CancellationToken cancellationToken); + + /// + /// Downloads the subtitles. + /// + /// The video. + /// The subtitle identifier. + /// Name of the provider. + /// The cancellation token. + /// Task. + 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..1409b7d50 --- /dev/null +++ b/MediaBrowser.Controller/Subtitles/ISubtitleProvider.cs @@ -0,0 +1,75 @@ +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); + } + } +} diff --git a/MediaBrowser.Dlna/PlayTo/Device.cs b/MediaBrowser.Dlna/PlayTo/Device.cs index 1c7ed13b6..3e5e877cd 100644 --- a/MediaBrowser.Dlna/PlayTo/Device.cs +++ b/MediaBrowser.Dlna/PlayTo/Device.cs @@ -77,6 +77,8 @@ namespace MediaBrowser.Dlna.PlayTo private readonly ILogger _logger; private readonly IServerConfigurationManager _config; + public DateTime DateLastActivity { get; private set; } + public Device(DeviceInfo deviceProperties, IHttpClient httpClient, ILogger logger, IServerConfigurationManager config) { Properties = deviceProperties; @@ -386,6 +388,8 @@ namespace MediaBrowser.Dlna.PlayTo { var transportState = await GetTransportInfo().ConfigureAwait(false); + DateLastActivity = DateTime.UtcNow; + if (transportState.HasValue) { // If we're not playing anything no need to get additional data diff --git a/MediaBrowser.Dlna/PlayTo/DlnaController.cs b/MediaBrowser.Dlna/PlayTo/DlnaController.cs index fb5e0bf34..673a7c245 100644 --- a/MediaBrowser.Dlna/PlayTo/DlnaController.cs +++ b/MediaBrowser.Dlna/PlayTo/DlnaController.cs @@ -51,6 +51,8 @@ namespace MediaBrowser.Dlna.PlayTo } } + private Timer _updateTimer; + public PlayToController(SessionInfo session, ISessionManager sessionManager, IItemRepository itemRepository, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IDtoService dtoService, IImageProcessor imageProcessor, SsdpHandler ssdpHandler, string serverAddress) { _session = session; @@ -75,6 +77,24 @@ namespace MediaBrowser.Dlna.PlayTo _device.Start(); _ssdpHandler.MessageReceived += _SsdpHandler_MessageReceived; + + _updateTimer = new Timer(updateTimer_Elapsed, null, 60000, 60000); + } + + private async void updateTimer_Elapsed(object state) + { + if (DateTime.UtcNow >= _device.DateLastActivity.AddSeconds(60)) + { + try + { + // Session is inactive, mark it for Disposal and don't start the elapsed timer. + await _sessionManager.ReportSessionEnded(_session.Id).ConfigureAwait(false); + } + catch (Exception ex) + { + _logger.ErrorException("Error in ReportSessionEnded", ex); + } + } } private string GetServerAddress() @@ -571,10 +591,21 @@ namespace MediaBrowser.Dlna.PlayTo _device.PlaybackStopped -= _device_PlaybackStopped; _ssdpHandler.MessageReceived -= _SsdpHandler_MessageReceived; + DisposeUpdateTimer(); + _device.Dispose(); } } + private void DisposeUpdateTimer() + { + if (_updateTimer != null) + { + _updateTimer.Dispose(); + _updateTimer = null; + } + } + private readonly CultureInfo _usCulture = new CultureInfo("en-US"); public Task SendGeneralCommand(GeneralCommand command, CancellationToken cancellationToken) diff --git a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj index 291bb0222..19287b0cb 100644 --- a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj +++ b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj @@ -64,7 +64,7 @@ - + diff --git a/MediaBrowser.MediaEncoding/Subtitles/ISubtitleParser.cs b/MediaBrowser.MediaEncoding/Subtitles/ISubtitleParser.cs index 5e7ad6699..b983bc5d4 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/ISubtitleParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/ISubtitleParser.cs @@ -4,6 +4,6 @@ namespace MediaBrowser.MediaEncoding.Subtitles { public interface ISubtitleParser { - SubtitleInfo Parse(Stream stream); + SubtitleTrackInfo Parse(Stream stream); } } diff --git a/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs index af0009a82..410c0bbdd 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs @@ -7,9 +7,9 @@ using System.Threading.Tasks; namespace MediaBrowser.MediaEncoding.Subtitles { - public class SrtParser + public class SrtParser : ISubtitleParser { - public SubtitleInfo Parse(Stream stream) + public SubtitleTrackInfo Parse(Stream stream) { throw new NotImplementedException(); } diff --git a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs index e134416b1..ca7e58371 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs @@ -7,9 +7,9 @@ using System.Threading.Tasks; namespace MediaBrowser.MediaEncoding.Subtitles { - public class SsaParser + public class SsaParser : ISubtitleParser { - public SubtitleInfo Parse(Stream stream) + public SubtitleTrackInfo Parse(Stream stream) { throw new NotImplementedException(); } diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleInfo.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleInfo.cs deleted file mode 100644 index 812b0c7d4..000000000 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections.Generic; - -namespace MediaBrowser.MediaEncoding.Subtitles -{ - public class SubtitleInfo - { - public List TrackEvents { get; set; } - - public SubtitleInfo() - { - TrackEvents = new List(); - } - } - - public class SubtitleTrackEvent - { - public string Id { get; set; } - public string Text { get; set; } - public long StartPositionTicks { get; set; } - public long EndPositionTicks { get; set; } - } -} diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleTrackInfo.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleTrackInfo.cs new file mode 100644 index 000000000..67d70ed6e --- /dev/null +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleTrackInfo.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace MediaBrowser.MediaEncoding.Subtitles +{ + public class SubtitleTrackInfo + { + public List TrackEvents { get; set; } + + public SubtitleTrackInfo() + { + TrackEvents = new List(); + } + } + + public class SubtitleTrackEvent + { + public string Id { get; set; } + public string Text { get; set; } + public long StartPositionTicks { get; set; } + public long EndPositionTicks { get; set; } + } +} diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index e8a802725..991fe3b2a 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -416,6 +416,9 @@ Providers\RemoteSearchResult.cs + + Providers\RemoteSubtitleInfo.cs + Querying\ArtistsQuery.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index 5fb5fae74..771e739bc 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -403,6 +403,9 @@ Providers\RemoteSearchResult.cs + + Providers\RemoteSubtitleInfo.cs + Querying\ArtistsQuery.cs diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index dd1603d01..c9f5f3ae7 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -760,7 +760,7 @@ namespace MediaBrowser.Model.ApiClient /// /// The options. /// System.String. - string GetSubtitleUrl(SubtitleOptions options); + string GetSubtitleUrl(SubtitleDownloadOptions options); /// /// Gets an image url that can be used to download an image from the api diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 0fb9db6c0..486268e2b 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -221,6 +221,8 @@ namespace MediaBrowser.Model.Configuration public NotificationOptions NotificationOptions { get; set; } + public SubtitleOptions SubtitleOptions { get; set; } + /// /// Initializes a new instance of the class. /// @@ -284,6 +286,8 @@ namespace MediaBrowser.Model.Configuration UICulture = "en-us"; NotificationOptions = new NotificationOptions(); + + SubtitleOptions = new SubtitleOptions(); } } @@ -311,4 +315,17 @@ namespace MediaBrowser.Model.Configuration public string From { get; set; } public string To { get; set; } } + + public class SubtitleOptions + { + public bool RequireExternalSubtitles { get; set; } + public string[] SubtitleDownloadLanguages { get; set; } + public bool DownloadMovieSubtitles { get; set; } + public bool DownloadEpisodeSubtitles { get; set; } + + public SubtitleOptions() + { + SubtitleDownloadLanguages = new string[] { }; + } + } } diff --git a/MediaBrowser.Model/Dto/StreamOptions.cs b/MediaBrowser.Model/Dto/StreamOptions.cs index b1ead2ca3..861fa4e01 100644 --- a/MediaBrowser.Model/Dto/StreamOptions.cs +++ b/MediaBrowser.Model/Dto/StreamOptions.cs @@ -159,7 +159,7 @@ public string DeviceId { get; set; } } - public class SubtitleOptions + public class SubtitleDownloadOptions { /// /// Gets or sets the item identifier. diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 877eb5444..aaa29d21c 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -139,6 +139,7 @@ + diff --git a/MediaBrowser.Model/Providers/RemoteSubtitleInfo.cs b/MediaBrowser.Model/Providers/RemoteSubtitleInfo.cs new file mode 100644 index 000000000..dab9a57a8 --- /dev/null +++ b/MediaBrowser.Model/Providers/RemoteSubtitleInfo.cs @@ -0,0 +1,19 @@ +using System; + +namespace MediaBrowser.Model.Providers +{ + public class RemoteSubtitleInfo + { + public string Language { get; set; } + public string Id { get; set; } + public string ProviderName { get; set; } + public string Name { get; set; } + public string Format { get; set; } + public string Author { get; set; } + public string Comment { get; set; } + public DateTime? DateCreated { get; set; } + public float? CommunityRating { get; set; } + public int? DownloadCount { get; set; } + public bool? IsHashMatch { get; set; } + } +} diff --git a/MediaBrowser.Model/Querying/ItemFilter.cs b/MediaBrowser.Model/Querying/ItemFilter.cs index 2e88a98c9..d30978ebf 100644 --- a/MediaBrowser.Model/Querying/ItemFilter.cs +++ b/MediaBrowser.Model/Querying/ItemFilter.cs @@ -27,6 +27,10 @@ namespace MediaBrowser.Model.Querying /// IsFavorite = 5, /// + /// The is recently added + /// + IsRecentlyAdded = 6, + /// /// The item is resumable /// IsResumable = 7, diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj index b19966718..43402123c 100644 --- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj +++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj @@ -108,6 +108,7 @@ + @@ -187,6 +188,7 @@ + diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs index 7a71a7551..3c03e11b3 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs @@ -1,5 +1,6 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.IO; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.Movies; @@ -10,15 +11,16 @@ using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; +using MediaBrowser.Controller.Subtitles; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.Serialization; using System; +using System.Linq; using System.Threading; using System.Threading.Tasks; -using System.Linq; namespace MediaBrowser.Providers.MediaInfo { @@ -45,6 +47,8 @@ namespace MediaBrowser.Providers.MediaInfo private readonly IJsonSerializer _json; private readonly IEncodingManager _encodingManager; private readonly IFileSystem _fileSystem; + private readonly IServerConfigurationManager _config; + private readonly ISubtitleManager _subtitleManager; public string Name { @@ -96,7 +100,7 @@ namespace MediaBrowser.Providers.MediaInfo return FetchAudioInfo(item, cancellationToken); } - public FFProbeProvider(ILogger logger, IIsoManager isoManager, IMediaEncoder mediaEncoder, IItemRepository itemRepo, IBlurayExaminer blurayExaminer, ILocalizationManager localization, IApplicationPaths appPaths, IJsonSerializer json, IEncodingManager encodingManager, IFileSystem fileSystem) + public FFProbeProvider(ILogger logger, IIsoManager isoManager, IMediaEncoder mediaEncoder, IItemRepository itemRepo, IBlurayExaminer blurayExaminer, ILocalizationManager localization, IApplicationPaths appPaths, IJsonSerializer json, IEncodingManager encodingManager, IFileSystem fileSystem, IServerConfigurationManager config, ISubtitleManager subtitleManager) { _logger = logger; _isoManager = isoManager; @@ -108,6 +112,8 @@ namespace MediaBrowser.Providers.MediaInfo _json = json; _encodingManager = encodingManager; _fileSystem = fileSystem; + _config = config; + _subtitleManager = subtitleManager; } private readonly Task _cachedTask = Task.FromResult(ItemUpdateType.None); @@ -134,7 +140,7 @@ namespace MediaBrowser.Providers.MediaInfo return _cachedTask; } - var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem); + var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager); return prober.ProbeVideo(item, directoryService, cancellationToken); } @@ -165,7 +171,7 @@ namespace MediaBrowser.Providers.MediaInfo if (video != null && !video.IsPlaceHolder) { - var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem); + var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager); return !video.SubtitleFiles.SequenceEqual(prober.GetSubtitleFiles(video, directoryService).Select(i => i.FullName).OrderBy(i => i), StringComparer.OrdinalIgnoreCase); } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index a7d4a480e..a2897ef9c 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -2,12 +2,16 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; using MediaBrowser.Common.IO; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; +using MediaBrowser.Controller.Subtitles; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; @@ -35,10 +39,12 @@ namespace MediaBrowser.Providers.MediaInfo private readonly IJsonSerializer _json; private readonly IEncodingManager _encodingManager; private readonly IFileSystem _fileSystem; + private readonly IServerConfigurationManager _config; + private readonly ISubtitleManager _subtitleManager; private readonly CultureInfo _usCulture = new CultureInfo("en-US"); - public FFProbeVideoInfo(ILogger logger, IIsoManager isoManager, IMediaEncoder mediaEncoder, IItemRepository itemRepo, IBlurayExaminer blurayExaminer, ILocalizationManager localization, IApplicationPaths appPaths, IJsonSerializer json, IEncodingManager encodingManager, IFileSystem fileSystem) + public FFProbeVideoInfo(ILogger logger, IIsoManager isoManager, IMediaEncoder mediaEncoder, IItemRepository itemRepo, IBlurayExaminer blurayExaminer, ILocalizationManager localization, IApplicationPaths appPaths, IJsonSerializer json, IEncodingManager encodingManager, IFileSystem fileSystem, IServerConfigurationManager config, ISubtitleManager subtitleManager) { _logger = logger; _isoManager = isoManager; @@ -50,6 +56,8 @@ namespace MediaBrowser.Providers.MediaInfo _json = json; _encodingManager = encodingManager; _fileSystem = fileSystem; + _config = config; + _subtitleManager = subtitleManager; } public async Task ProbeVideo(T item, IDirectoryService directoryService, CancellationToken cancellationToken) @@ -118,7 +126,7 @@ namespace MediaBrowser.Providers.MediaInfo cancellationToken.ThrowIfCancellationRequested(); var idString = item.Id.ToString("N"); - var cachePath = Path.Combine(_appPaths.CachePath, + var cachePath = Path.Combine(_appPaths.CachePath, "ffprobe-video", idString.Substring(0, 2), idString, "v" + SchemaVersion + _mediaEncoder.Version + item.DateModified.Ticks.ToString(_usCulture) + ".json"); @@ -200,7 +208,7 @@ namespace MediaBrowser.Providers.MediaInfo FetchBdInfo(video, chapters, mediaStreams, blurayInfo); } - AddExternalSubtitles(video, mediaStreams, directoryService); + await AddExternalSubtitles(video, mediaStreams, directoryService, cancellationToken).ConfigureAwait(false); FetchWtvInfo(video, data); @@ -247,7 +255,7 @@ namespace MediaBrowser.Providers.MediaInfo } } - info.StartPositionTicks = chapter.start/100; + info.StartPositionTicks = chapter.start / 100; return info; } @@ -450,11 +458,42 @@ namespace MediaBrowser.Providers.MediaInfo /// /// The video. /// The current streams. - private void AddExternalSubtitles(Video video, List currentStreams, IDirectoryService directoryService) + private async Task AddExternalSubtitles(Video video, List currentStreams, IDirectoryService directoryService, CancellationToken cancellationToken) + { + var externalSubtitleStreams = GetExternalSubtitleStreams(video, currentStreams.Count, directoryService).ToList(); + + if ((_config.Configuration.SubtitleOptions.DownloadEpisodeSubtitles && + video is Episode) || + (_config.Configuration.SubtitleOptions.DownloadMovieSubtitles && + video is Movie)) + { + var downloadedLanguages = await new SubtitleDownloader(_logger, + _subtitleManager) + .DownloadSubtitles(video, + currentStreams, + externalSubtitleStreams, + _config.Configuration.SubtitleOptions.RequireExternalSubtitles, + _config.Configuration.SubtitleOptions.SubtitleDownloadLanguages, + cancellationToken).ConfigureAwait(false); + + // Rescan + if (downloadedLanguages.Count > 0) + { + externalSubtitleStreams = GetExternalSubtitleStreams(video, currentStreams.Count, directoryService).ToList(); + } + } + + video.SubtitleFiles = externalSubtitleStreams.Select(i => i.Path).OrderBy(i => i).ToList(); + + currentStreams.AddRange(externalSubtitleStreams); + } + + private IEnumerable GetExternalSubtitleStreams(Video video, + int startIndex, + IDirectoryService directoryService) { var files = GetSubtitleFiles(video, directoryService); - var startIndex = currentStreams.Count; var streams = new List(); var videoFileNameWithoutExtension = Path.GetFileNameWithoutExtension(video.Path); @@ -504,9 +543,7 @@ namespace MediaBrowser.Providers.MediaInfo } } - video.SubtitleFiles = streams.Select(i => i.Path).OrderBy(i => i).ToList(); - - currentStreams.AddRange(streams); + return streams; } /// @@ -627,7 +664,7 @@ namespace MediaBrowser.Providers.MediaInfo { var path = mount == null ? item.Path : mount.MountedPath; var dvd = new Dvd(path); - + var primaryTitle = dvd.Titles.OrderByDescending(GetRuntime).FirstOrDefault(); byte? titleNumber = null; diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs b/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs new file mode 100644 index 000000000..7f7ccda19 --- /dev/null +++ b/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs @@ -0,0 +1,140 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Controller.Entities.TV; +using MediaBrowser.Controller.Subtitles; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Providers.MediaInfo +{ + public class SubtitleDownloader + { + private readonly ILogger _logger; + private readonly ISubtitleManager _subtitleManager; + + public SubtitleDownloader(ILogger logger, ISubtitleManager subtitleManager) + { + _logger = logger; + _subtitleManager = subtitleManager; + } + + public async Task> DownloadSubtitles(Video video, + List internalSubtitleStreams, + List externalSubtitleStreams, + bool forceExternal, + IEnumerable languages, + CancellationToken cancellationToken) + { + if (video.LocationType != LocationType.FileSystem || + video.VideoType != VideoType.VideoFile) + { + return new List(); + } + + SubtitleMediaType mediaType; + + if (video is Episode) + { + mediaType = SubtitleMediaType.Episode; + } + else if (video is Movie) + { + mediaType = SubtitleMediaType.Movie; + } + else + { + // These are the only supported types + return new List(); + } + + var downloadedLanguages = new List(); + + foreach (var lang in languages) + { + try + { + var downloaded = await DownloadSubtitles(video, internalSubtitleStreams, externalSubtitleStreams, forceExternal, lang, mediaType, cancellationToken) + .ConfigureAwait(false); + + if (downloaded) + { + downloadedLanguages.Add(lang); + } + } + catch (Exception ex) + { + _logger.ErrorException("Error downloading subtitles", ex); + } + } + + return downloadedLanguages; + } + + private async Task DownloadSubtitles(Video video, + IEnumerable internalSubtitleStreams, + IEnumerable externalSubtitleStreams, + bool forceExternal, + string language, + SubtitleMediaType mediaType, + CancellationToken cancellationToken) + { + // There's already subtitles for this language + if (externalSubtitleStreams.Any(i => string.Equals(i.Language, language, StringComparison.OrdinalIgnoreCase))) + { + return false; + } + + // There's an internal subtitle stream for this language + if (!forceExternal && internalSubtitleStreams.Any(i => string.Equals(i.Language, language, StringComparison.OrdinalIgnoreCase))) + { + return false; + } + + var request = new SubtitleSearchRequest + { + ContentType = mediaType, + IndexNumber = video.IndexNumber, + Language = language, + MediaPath = video.Path, + Name = video.Name, + ParentIndexNumber = video.ParentIndexNumber, + ProductionYear = video.ProductionYear, + ProviderIds = video.ProviderIds + }; + + var episode = video as Episode; + + if (episode != null) + { + request.IndexNumberEnd = episode.IndexNumberEnd; + request.SeriesName = episode.SeriesName; + } + + try + { + var searchResults = await _subtitleManager.SearchSubtitles(request, cancellationToken).ConfigureAwait(false); + + var result = searchResults.FirstOrDefault(); + + if (result != null) + { + await _subtitleManager.DownloadSubtitles(video, result.Id, result.ProviderName, cancellationToken) + .ConfigureAwait(false); + + return true; + } + } + catch (Exception ex) + { + _logger.ErrorException("Error downloading subtitles", ex); + } + + return false; + } + } +} diff --git a/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs b/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs index 7309513d6..929cccd5a 100644 --- a/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs +++ b/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs @@ -1,8 +1,10 @@ -using MediaBrowser.Common.Net; +using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Providers; +using MediaBrowser.Controller.Subtitles; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; -using MediaBrowser.Model.MediaInfo; +using MediaBrowser.Model.Providers; using OpenSubtitlesHandler; using System; using System.Collections.Generic; @@ -20,9 +22,9 @@ namespace MediaBrowser.Providers.Subtitles private readonly IHttpClient _httpClient; private readonly CultureInfo _usCulture = new CultureInfo("en-US"); - public OpenSubtitleDownloader(ILogger logger, IHttpClient httpClient) + public OpenSubtitleDownloader(ILogManager logManager, IHttpClient httpClient) { - _logger = logger; + _logger = logManager.GetLogger(GetType().Name); _httpClient = httpClient; } @@ -36,39 +38,71 @@ namespace MediaBrowser.Providers.Subtitles get { return new[] { SubtitleMediaType.Episode, SubtitleMediaType.Movie }; } } - public Task GetSubtitles(SubtitleRequest request, CancellationToken cancellationToken) + public Task GetSubtitles(string id, CancellationToken cancellationToken) { - return GetSubtitlesInternal(request, cancellationToken); + return GetSubtitlesInternal(id, cancellationToken); } - private async Task GetSubtitlesInternal(SubtitleRequest request, + private async Task GetSubtitlesInternal(string id, CancellationToken cancellationToken) { - var response = new SubtitleResponse(); + if (string.IsNullOrWhiteSpace(id)) + { + throw new ArgumentNullException("id"); + } + + var idParts = id.Split(new[] { '-' }, 3); + + var format = idParts[0]; + var language = idParts[1]; + var ossId = idParts[2]; + + var downloadsList = new[] { int.Parse(ossId, _usCulture) }; + + var resultDownLoad = OpenSubtitles.DownloadSubtitles(downloadsList); + if (!(resultDownLoad is MethodResponseSubtitleDownload)) + { + throw new ApplicationException("Invalid response type"); + } + var res = ((MethodResponseSubtitleDownload)resultDownLoad).Results.First(); + var data = Convert.FromBase64String(res.Data); + + return new SubtitleResponse + { + Format = format, + Language = language, + + Stream = new MemoryStream(Utilities.Decompress(new MemoryStream(data))) + }; + } + + public async Task> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken) + { var imdbIdText = request.GetProviderId(MetadataProviders.Imdb); long imdbId; if (string.IsNullOrWhiteSpace(imdbIdText) || - long.TryParse(imdbIdText.TrimStart('t'), NumberStyles.Any, _usCulture, out imdbId)) + !long.TryParse(imdbIdText.TrimStart('t'), NumberStyles.Any, _usCulture, out imdbId)) { - return response; + _logger.Debug("Imdb id missing"); + return new List(); } - + switch (request.ContentType) { case SubtitleMediaType.Episode: if (!request.IndexNumber.HasValue || !request.ParentIndexNumber.HasValue || string.IsNullOrEmpty(request.SeriesName)) { - _logger.Debug("Information Missing"); - return response; + _logger.Debug("Episode information missing"); + return new List(); } break; case SubtitleMediaType.Movie: if (string.IsNullOrEmpty(request.Name)) { - _logger.Debug("Information Missing"); - return response; + _logger.Debug("Movie name missing"); + return new List(); } break; } @@ -76,16 +110,18 @@ namespace MediaBrowser.Providers.Subtitles if (string.IsNullOrEmpty(request.MediaPath)) { _logger.Debug("Path Missing"); - return response; + return new List(); } Utilities.HttpClient = _httpClient; OpenSubtitles.SetUserAgent("OS Test User Agent"); - var loginResponse = OpenSubtitles.LogIn("", "", "en"); + + var loginResponse = await OpenSubtitles.LogInAsync("", "", "en", cancellationToken).ConfigureAwait(false); + if (!(loginResponse is MethodResponseLogIn)) { _logger.Debug("Login error"); - return response; + return new List(); } var subLanguageId = request.Language; @@ -105,54 +141,42 @@ namespace MediaBrowser.Providers.Subtitles var result = OpenSubtitles.SearchSubtitles(parms.ToArray()); if (!(result is MethodResponseSubtitleSearch)) { - _logger.Debug("invalid response type"); - return null; + _logger.Debug("Invalid response type"); + return new List(); } Predicate mediaFilter = x => request.ContentType == SubtitleMediaType.Episode - ? int.Parse(x.SeriesSeason) == request.ParentIndexNumber && int.Parse(x.SeriesEpisode) == request.IndexNumber - : long.Parse(x.IDMovieImdb) == imdbId; + ? int.Parse(x.SeriesSeason, _usCulture) == request.ParentIndexNumber && int.Parse(x.SeriesEpisode, _usCulture) == request.IndexNumber + : long.Parse(x.IDMovieImdb, _usCulture) == imdbId; var results = ((MethodResponseSubtitleSearch)result).Results; - var bestResult = results.Where(x => x.SubBad == "0" && mediaFilter(x)) - .OrderBy(x => x.MovieHash == hash) - .ThenBy(x => Math.Abs(long.Parse(x.MovieByteSize) - movieByteSize)) - .ThenByDescending(x => int.Parse(x.SubDownloadsCnt)) - .ThenByDescending(x => double.Parse(x.SubRating)) - .ToList(); - - if (!bestResult.Any()) - { - _logger.Debug("No Subtitles"); - return response; - } - - _logger.Debug("Found " + bestResult.Count + " subtitles."); - var subtitle = bestResult.First(); - var downloadsList = new[] { int.Parse(subtitle.IDSubtitleFile) }; + // Avoid implicitly captured closure + var hasCopy = hash; - var resultDownLoad = OpenSubtitles.DownloadSubtitles(downloadsList); - if (!(resultDownLoad is MethodResponseSubtitleDownload)) - { - _logger.Debug("invalid response type"); - return response; - } - if (!((MethodResponseSubtitleDownload)resultDownLoad).Results.Any()) - { - _logger.Debug("No Subtitle Downloads"); - return response; - } - - var res = ((MethodResponseSubtitleDownload)resultDownLoad).Results.First(); - var data = Convert.FromBase64String(res.Data); - - response.HasContent = true; - response.Format = subtitle.SubFormat.ToUpper(); - response.Stream = new MemoryStream(Utilities.Decompress(new MemoryStream(data))); - return response; + return results.Where(x => x.SubBad == "0" && mediaFilter(x)) + .OrderBy(x => x.MovieHash == hash) + .ThenBy(x => Math.Abs(long.Parse(x.MovieByteSize, _usCulture) - movieByteSize)) + .ThenByDescending(x => int.Parse(x.SubDownloadsCnt, _usCulture)) + .ThenByDescending(x => double.Parse(x.SubRating, _usCulture)) + .Select(i => new RemoteSubtitleInfo + { + Author = i.UserNickName, + Comment = i.SubAuthorComment, + CommunityRating = float.Parse(i.SubRating, _usCulture), + DownloadCount = int.Parse(i.SubDownloadsCnt, _usCulture), + Format = i.SubFormat, + ProviderName = Name, + Language = i.SubLanguageID, + + Id = i.SubFormat + "-" + i.SubLanguageID + "-" + i.IDSubtitle, + + Name = i.SubFileName, + DateCreated = DateTime.Parse(i.SubAddDate, _usCulture), + IsHashMatch = i.MovieHash == hasCopy + }); } } } diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs new file mode 100644 index 000000000..6951e8bd0 --- /dev/null +++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs @@ -0,0 +1,141 @@ +using MediaBrowser.Common.IO; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Controller.Entities.TV; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Subtitles; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Logging; +using MediaBrowser.Model.Providers; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Providers.Subtitles +{ + public class SubtitleManager : ISubtitleManager + { + private ISubtitleProvider[] _subtitleProviders; + private readonly ILogger _logger; + private readonly IFileSystem _fileSystem; + private readonly ILibraryMonitor _monitor; + + public SubtitleManager(ILogger logger, IFileSystem fileSystem, ILibraryMonitor monitor) + { + _logger = logger; + _fileSystem = fileSystem; + _monitor = monitor; + } + + public void AddParts(IEnumerable subtitleProviders) + { + _subtitleProviders = subtitleProviders.ToArray(); + } + + public async Task> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken) + { + var providers = _subtitleProviders + .Where(i => i.SupportedMediaTypes.Contains(request.ContentType)) + .ToList(); + + var tasks = providers.Select(async i => + { + try + { + return await i.SearchSubtitles(request, cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + _logger.ErrorException("Error downloading subtitles from {0}", ex, i.Name); + return new List(); + } + }); + + var results = await Task.WhenAll(tasks).ConfigureAwait(false); + + return results.SelectMany(i => i); + } + + public async Task DownloadSubtitles(Video video, + string subtitleId, + string providerName, + CancellationToken cancellationToken) + { + var provider = _subtitleProviders.First(i => string.Equals(i.Name, providerName, StringComparison.OrdinalIgnoreCase)); + + var response = await provider.GetSubtitles(subtitleId, cancellationToken).ConfigureAwait(false); + + using (var stream = response.Stream) + { + var savePath = Path.Combine(Path.GetDirectoryName(video.Path), + Path.GetFileNameWithoutExtension(video.Path) + "." + response.Language.ToLower() + "." + response.Format.ToLower()); + + _logger.Info("Saving subtitles to {0}", savePath); + + _monitor.ReportFileSystemChangeBeginning(savePath); + + try + { + using (var fs = _fileSystem.GetFileStream(savePath, FileMode.Create, FileAccess.Write, FileShare.Read, true)) + { + await stream.CopyToAsync(fs).ConfigureAwait(false); + } + } + finally + { + _monitor.ReportFileSystemChangeComplete(savePath, false); + } + } + } + + public Task> SearchSubtitles(Video video, string language, CancellationToken cancellationToken) + { + if (video.LocationType != LocationType.FileSystem || + video.VideoType != VideoType.VideoFile) + { + return Task.FromResult>(new List()); + } + + SubtitleMediaType mediaType; + + if (video is Episode) + { + mediaType = SubtitleMediaType.Episode; + } + else if (video is Movie) + { + mediaType = SubtitleMediaType.Movie; + } + else + { + // These are the only supported types + return Task.FromResult>(new List()); + } + + var request = new SubtitleSearchRequest + { + ContentType = mediaType, + IndexNumber = video.IndexNumber, + Language = language, + MediaPath = video.Path, + Name = video.Name, + ParentIndexNumber = video.ParentIndexNumber, + ProductionYear = video.ProductionYear, + ProviderIds = video.ProviderIds + }; + + var episode = video as Episode; + + if (episode != null) + { + request.IndexNumberEnd = episode.IndexNumberEnd; + request.SeriesName = episode.SeriesName; + } + + return SearchSubtitles(request, cancellationToken); + } + } +} diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index f516c0878..748bc4b9c 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -327,7 +327,7 @@ namespace MediaBrowser.Server.Implementations.Channels var categoryKey = string.IsNullOrWhiteSpace(categoryId) ? "root" : categoryId.GetMD5().ToString("N"); - return Path.Combine(_config.ApplicationPaths.CachePath, channelId, categoryKey, user.Id.ToString("N") + ".json"); + return Path.Combine(_config.ApplicationPaths.CachePath, "channels", channelId, categoryKey, user.Id.ToString("N") + ".json"); } private async Task> GetReturnItems(IEnumerable items, User user, ChannelItemQuery query, CancellationToken cancellationToken) diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs index 653cbacb6..adcf3edba 100644 --- a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs +++ b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs @@ -93,7 +93,13 @@ namespace MediaBrowser.Server.Implementations.Collections // Find an actual physical folder if (folder is CollectionFolder) { - return _libraryManager.RootFolder.Children.OfType().First(i => folder.PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)); + var child = _libraryManager.RootFolder.Children.OfType() + .FirstOrDefault(i => folder.PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)); + + if (child != null) + { + return child; + } } } diff --git a/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs b/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs index 011e64df2..7a4f922ed 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs @@ -206,7 +206,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer /// The message. public void Warn(object message) { - _logger.Warn(GetMesssage(message)); + // Hide StringMapTypeDeserializer messages + // _logger.Warn(GetMesssage(message)); } /// @@ -216,7 +217,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer /// The args. public void WarnFormat(string format, params object[] args) { - _logger.Warn(format, args); + // Hide StringMapTypeDeserializer messages + // _logger.Warn(format, args); } /// diff --git a/MediaBrowser.Server.Implementations/Library/Validators/PeoplePostScanTask.cs b/MediaBrowser.Server.Implementations/Library/Validators/PeoplePostScanTask.cs deleted file mode 100644 index d11e62a1a..000000000 --- a/MediaBrowser.Server.Implementations/Library/Validators/PeoplePostScanTask.cs +++ /dev/null @@ -1,44 +0,0 @@ -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Logging; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Server.Implementations.Library.Validators -{ - class PeoplePostScanTask : ILibraryPostScanTask - { - /// - /// The _library manager - /// - private readonly ILibraryManager _libraryManager; - - /// - /// The _logger - /// - private readonly ILogger _logger; - - public PeoplePostScanTask(ILibraryManager libraryManager, ILogger logger) - { - _libraryManager = libraryManager; - _logger = logger; - } - - /// - /// Runs the specified progress. - /// - /// The progress. - /// The cancellation token. - /// Task. - public Task Run(IProgress progress, CancellationToken cancellationToken) - { - return new PeopleValidator(_libraryManager, _logger).ValidatePeople(cancellationToken, new MetadataRefreshOptions - { - ImageRefreshMode = ImageRefreshMode.ValidationOnly, - MetadataRefreshMode = MetadataRefreshMode.None - - }, progress); - } - } -} diff --git a/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs b/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs index 629d21df6..8eaaaacc0 100644 --- a/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs +++ b/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs @@ -5,7 +5,6 @@ using MediaBrowser.Controller.Localization; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.Serialization; -using MoreLinq; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -106,16 +105,13 @@ namespace MediaBrowser.Server.Implementations.Localization /// IEnumerable{CultureDto}. public IEnumerable GetCultures() { - return CultureInfo.GetCultures(CultureTypes.AllCultures) - .OrderBy(c => c.DisplayName) - .DistinctBy(c => c.TwoLetterISOLanguageName + c.ThreeLetterISOLanguageName) - .Select(c => new CultureDto - { - Name = c.Name, - DisplayName = c.DisplayName, - ThreeLetterISOLanguageName = c.ThreeLetterISOLanguageName, - TwoLetterISOLanguageName = c.TwoLetterISOLanguageName - }); + var type = GetType(); + var path = type.Namespace + ".cultures.json"; + + using (var stream = type.Assembly.GetManifestResourceStream(path)) + { + return _jsonSerializer.DeserializeFromStream>(stream); + } } /// @@ -124,28 +120,13 @@ namespace MediaBrowser.Server.Implementations.Localization /// IEnumerable{CountryInfo}. public IEnumerable GetCountries() { - return CultureInfo.GetCultures(CultureTypes.SpecificCultures) - .Select(c => - { - try - { - return new RegionInfo(c.LCID); - } - catch (CultureNotFoundException) - { - return null; - } - }) - .Where(i => i != null) - .OrderBy(c => c.DisplayName) - .DistinctBy(c => c.TwoLetterISORegionName) - .Select(c => new CountryInfo - { - Name = c.Name, - DisplayName = c.DisplayName, - TwoLetterISORegionName = c.TwoLetterISORegionName, - ThreeLetterISORegionName = c.ThreeLetterISORegionName - }); + var type = GetType(); + var path = type.Namespace + ".countries.json"; + + using (var stream = type.Assembly.GetManifestResourceStream(path)) + { + return _jsonSerializer.DeserializeFromStream>(stream); + } } /// diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 0c99b3a57..c2e29649f 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -627,5 +627,84 @@ "OptionSpecialFeatures": "Special Features", "HeaderCollections": "Collections", "HeaderChannels": "Channels", - "HeaderMyLibrary": "My Library" + "HeaderMyLibrary": "My Library", + "LabelProfileCodecsHelp": "Separated by comma. This can be left empty to apply to all codecs.", + "LabelProfileContainersHelp": "Separated by comma. This can be left empty to apply to all containers.", + "HeaderResponseProfile": "Response Profile", + "LabelType": "Type:", + "LabelProfileContainer": "Container:", + "LabelProfileVideoCodecs": "Video codecs:", + "LabelProfileAudioCodecs": "Audio codecs:", + "LabelProfileCodecs": "Codecs:", + "HeaderDirectPlayProfile": "Direct Play Profile", + "HeaderTranscodingProfile": "Transcoding Profile", + "HeaderCodecProfile": "Codec Profile", + "HeaderCodecProfileHelp": "Define additional conditions that must be met in order for a codec to be direct played.", + "HeaderContainerProfile": "Container Profile", + "HeaderContainerProfileHelp": "Define additional conditions that must be met in order for a file to be direct played.", + "OptionProfileVideo": "Video", + "OptionProfileAudio": "Audio", + "OptionProfileVideoAudio": "Video Audio", + "OptionProfilePhoto": "Photo", + "LabelUserLibrary": "User library:", + "LabelUserLibraryHelp": "Select which user library to display to the device. Leave empty to inherit the default setting.", + "OptionPlainStorageFolders": "Display all folders as plain storage folders", + "OptionPlainStorageFoldersHelp": "If enabled, all folders are represented in DIDL as \"object.container.storageFolder\" instead of a more specific type, such as \"object.container.person.musicArtist\".", + "OptionPlainVideoItems": "Display all videos as plain video items", + "OptionPlainVideoItemsHelp": "If enabled, all videos are represented in DIDL as \"object.item.videoItem\" instead of a more specific type, such as \"object.item.videoItem.movie\".", + "LabelSupportedMediaTypes": "Supported Media Types:", + "TabIdentification": "Identification", + "TabDirectPlay": "Direct Play", + "TabContainers": "Containers", + "TabCodecs": "Codecs", + "TabResponses": "Responses", + "HeaderProfileInformation": "Profile Information", + "LabelEmbedAlbumArtDidl": "Embed album art in Didl", + "LabelEmbedAlbumArtDidlHelp": "Some devices prefer this method for obtaining album art. Others may fail to play with this option enabled.", + "LabelAlbumArtPN": "Album art PN:", + "LabelAlbumArtHelp": "PN used for album art, within the dlna:profileID attribute on upnp:albumArtURI. Some clients require a specific value, regardless of the size of the image.", + "LabelAlbumArtMaxWidth": "Album art max width:", + "LabelAlbumArtMaxWidthHelp": "Max resolution of album art exposed via upnp:albumArtURI.", + "LabelAlbumArtMaxHeight": "Album art max height:", + "LabelAlbumArtMaxHeightHelp": "Max resolution of album art exposed via upnp:albumArtURI.", + "LabelIconMaxWidth": "Icon max width:", + "LabelIconMaxWidthHelp": "Max resolution of icons exposed via upnp:icon.", + "LabelIconMaxHeight": "Icon max height:", + "LabelIconMaxHeightHelp": "Max resolution of icons exposed via upnp:icon.", + "LabelIdentificationFieldHelp": "A case-insensitive substring or regex expression.", + "HeaderProfileServerSettingsHelp": "These values control how Media Browser will present itself to the device.", + "LabelMaxBitrate": "Max bitrate:", + "LabelMaxBitrateHelp": "Specify a max bitrate in bandwidth constrained environments, or if the device imposes it's own limit.", + "OptionIgnoreTranscodeByteRangeRequests": "Ignore transcode byte range requests", + "OptionIgnoreTranscodeByteRangeRequestsHelp": "If enabled, these requests will be honored but will ignore the byte range header.", + "LabelFriendlyName": "Friendly name", + "LabelManufacturer": "Manufacturer", + "LabelManufacturerUrl": "Manufacturer url", + "LabelModelName": "Model name", + "LabelModelNumber": "Model number", + "LabelModelDescription": "Model description", + "LabelModelUrl": "Model url", + "LabelSerialNumber": "Serial number", + "LabelDeviceDescription": "Device description", + "HeaderIdentificationCriteriaHelp": "Enter at least one identification criteria.", + "HeaderDirectPlayProfileHelp": "Add direct play profiles to indicate which formats the device can handle natively.", + "HeaderTranscodingProfileHelp": "Add transcoding profiles to indicate which formats should be used when transcoding is required.", + "HeaderContainerProfileHelp": "Container profiles indicate the limitations of a device when playing specific formats. If a limitation applies then the media will be transcoded, even if the format is configured for direct play.", + "HeaderCodecProfileHelp": "Codec profiles indicate the limitations of a device when playing specific codecs. If a limitation applies then the media will be transcoded, even if the codec is configured for direct play.", + "HeaderResponseProfileHelp": "Response profiles provide a way to customize information sent to the device when playing certain kinds of media.", + "LabelXDlnaCap": "X-Dlna cap:", + "LabelXDlnaCapHelp": "Determines the content of the X_DLNACAP element in the urn:schemas-dlna-org:device-1-0 namespace.", + "LabelXDlnaDoc": "X-Dlna doc:", + "LabelXDlnaDocHelp": "Determines the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace.", + "LabelSonyAggregationFlags": "Sony aggregation flags:", + "LabelSonyAggregationFlagsHelp": "Determines the content of the aggregationFlags element in the urn:schemas-sonycom:av namespace.", + "LabelTranscodingContainer": "Container:", + "LabelTranscodingVideoCodec": "Video codec:", + "LabelTranscodingVideoProfile": "Video profile:", + "LabelTranscodingAudioCodec": "Audio codec:", + "OptionEnableM2tsMode": "Enable M2ts mode", + "OptionEnableM2tsModeHelp": "Enable m2ts mode when encoding to mpegts.", + "OptionEstimateContentLength": "Estimate content length when transcoding", + "OptionReportByteRangeSeekingWhenTranscoding": "Report that the server supports byte seeking when transcoding", + "OptionReportByteRangeSeekingWhenTranscodingHelp": "This is required for some devices that don't time seek very well." } \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Localization/countries.json b/MediaBrowser.Server.Implementations/Localization/countries.json new file mode 100644 index 000000000..e671b3685 --- /dev/null +++ b/MediaBrowser.Server.Implementations/Localization/countries.json @@ -0,0 +1 @@ +[{"Name":"AF","DisplayName":"Afghanistan","TwoLetterISORegionName":"AF","ThreeLetterISORegionName":"AFG"},{"Name":"AL","DisplayName":"Albania","TwoLetterISORegionName":"AL","ThreeLetterISORegionName":"ALB"},{"Name":"DZ","DisplayName":"Algeria","TwoLetterISORegionName":"DZ","ThreeLetterISORegionName":"DZA"},{"Name":"AR","DisplayName":"Argentina","TwoLetterISORegionName":"AR","ThreeLetterISORegionName":"ARG"},{"Name":"AM","DisplayName":"Armenia","TwoLetterISORegionName":"AM","ThreeLetterISORegionName":"ARM"},{"Name":"AU","DisplayName":"Australia","TwoLetterISORegionName":"AU","ThreeLetterISORegionName":"AUS"},{"Name":"AT","DisplayName":"Austria","TwoLetterISORegionName":"AT","ThreeLetterISORegionName":"AUT"},{"Name":"AZ","DisplayName":"Azerbaijan","TwoLetterISORegionName":"AZ","ThreeLetterISORegionName":"AZE"},{"Name":"BH","DisplayName":"Bahrain","TwoLetterISORegionName":"BH","ThreeLetterISORegionName":"BHR"},{"Name":"BD","DisplayName":"Bangladesh","TwoLetterISORegionName":"BD","ThreeLetterISORegionName":"BGD"},{"Name":"BY","DisplayName":"Belarus","TwoLetterISORegionName":"BY","ThreeLetterISORegionName":"BLR"},{"Name":"BE","DisplayName":"Belgium","TwoLetterISORegionName":"BE","ThreeLetterISORegionName":"BEL"},{"Name":"BZ","DisplayName":"Belize","TwoLetterISORegionName":"BZ","ThreeLetterISORegionName":"BLZ"},{"Name":"VE","DisplayName":"Bolivarian Republic of Venezuela","TwoLetterISORegionName":"VE","ThreeLetterISORegionName":"VEN"},{"Name":"BO","DisplayName":"Bolivia","TwoLetterISORegionName":"BO","ThreeLetterISORegionName":"BOL"},{"Name":"BA","DisplayName":"Bosnia and Herzegovina","TwoLetterISORegionName":"BA","ThreeLetterISORegionName":"BIH"},{"Name":"BW","DisplayName":"Botswana","TwoLetterISORegionName":"BW","ThreeLetterISORegionName":"BWA"},{"Name":"BR","DisplayName":"Brazil","TwoLetterISORegionName":"BR","ThreeLetterISORegionName":"BRA"},{"Name":"BN","DisplayName":"Brunei Darussalam","TwoLetterISORegionName":"BN","ThreeLetterISORegionName":"BRN"},{"Name":"BG","DisplayName":"Bulgaria","TwoLetterISORegionName":"BG","ThreeLetterISORegionName":"BGR"},{"Name":"KH","DisplayName":"Cambodia","TwoLetterISORegionName":"KH","ThreeLetterISORegionName":"KHM"},{"Name":"CM","DisplayName":"Cameroon","TwoLetterISORegionName":"CM","ThreeLetterISORegionName":"CMR"},{"Name":"CA","DisplayName":"Canada","TwoLetterISORegionName":"CA","ThreeLetterISORegionName":"CAN"},{"Name":"029","DisplayName":"Caribbean","TwoLetterISORegionName":"029","ThreeLetterISORegionName":"029"},{"Name":"CL","DisplayName":"Chile","TwoLetterISORegionName":"CL","ThreeLetterISORegionName":"CHL"},{"Name":"CO","DisplayName":"Colombia","TwoLetterISORegionName":"CO","ThreeLetterISORegionName":"COL"},{"Name":"CD","DisplayName":"Congo [DRC]","TwoLetterISORegionName":"CD","ThreeLetterISORegionName":"COD"},{"Name":"CR","DisplayName":"Costa Rica","TwoLetterISORegionName":"CR","ThreeLetterISORegionName":"CRI"},{"Name":"HR","DisplayName":"Croatia","TwoLetterISORegionName":"HR","ThreeLetterISORegionName":"HRV"},{"Name":"CZ","DisplayName":"Czech Republic","TwoLetterISORegionName":"CZ","ThreeLetterISORegionName":"CZE"},{"Name":"DK","DisplayName":"Denmark","TwoLetterISORegionName":"DK","ThreeLetterISORegionName":"DNK"},{"Name":"DO","DisplayName":"Dominican Republic","TwoLetterISORegionName":"DO","ThreeLetterISORegionName":"DOM"},{"Name":"EC","DisplayName":"Ecuador","TwoLetterISORegionName":"EC","ThreeLetterISORegionName":"ECU"},{"Name":"EG","DisplayName":"Egypt","TwoLetterISORegionName":"EG","ThreeLetterISORegionName":"EGY"},{"Name":"SV","DisplayName":"El Salvador","TwoLetterISORegionName":"SV","ThreeLetterISORegionName":"SLV"},{"Name":"ER","DisplayName":"Eritrea","TwoLetterISORegionName":"ER","ThreeLetterISORegionName":"ERI"},{"Name":"EE","DisplayName":"Estonia","TwoLetterISORegionName":"EE","ThreeLetterISORegionName":"EST"},{"Name":"ET","DisplayName":"Ethiopia","TwoLetterISORegionName":"ET","ThreeLetterISORegionName":"ETH"},{"Name":"FO","DisplayName":"Faroe Islands","TwoLetterISORegionName":"FO","ThreeLetterISORegionName":"FRO"},{"Name":"FI","DisplayName":"Finland","TwoLetterISORegionName":"FI","ThreeLetterISORegionName":"FIN"},{"Name":"FR","DisplayName":"France","TwoLetterISORegionName":"FR","ThreeLetterISORegionName":"FRA"},{"Name":"GE","DisplayName":"Georgia","TwoLetterISORegionName":"GE","ThreeLetterISORegionName":"GEO"},{"Name":"DE","DisplayName":"Germany","TwoLetterISORegionName":"DE","ThreeLetterISORegionName":"DEU"},{"Name":"GR","DisplayName":"Greece","TwoLetterISORegionName":"GR","ThreeLetterISORegionName":"GRC"},{"Name":"GL","DisplayName":"Greenland","TwoLetterISORegionName":"GL","ThreeLetterISORegionName":"GRL"},{"Name":"GT","DisplayName":"Guatemala","TwoLetterISORegionName":"GT","ThreeLetterISORegionName":"GTM"},{"Name":"HT","DisplayName":"Haiti","TwoLetterISORegionName":"HT","ThreeLetterISORegionName":"HTI"},{"Name":"HN","DisplayName":"Honduras","TwoLetterISORegionName":"HN","ThreeLetterISORegionName":"HND"},{"Name":"HK","DisplayName":"Hong Kong S.A.R.","TwoLetterISORegionName":"HK","ThreeLetterISORegionName":"HKG"},{"Name":"HU","DisplayName":"Hungary","TwoLetterISORegionName":"HU","ThreeLetterISORegionName":"HUN"},{"Name":"IS","DisplayName":"Iceland","TwoLetterISORegionName":"IS","ThreeLetterISORegionName":"ISL"},{"Name":"IN","DisplayName":"India","TwoLetterISORegionName":"IN","ThreeLetterISORegionName":"IND"},{"Name":"ID","DisplayName":"Indonesia","TwoLetterISORegionName":"ID","ThreeLetterISORegionName":"IDN"},{"Name":"IR","DisplayName":"Iran","TwoLetterISORegionName":"IR","ThreeLetterISORegionName":"IRN"},{"Name":"IQ","DisplayName":"Iraq","TwoLetterISORegionName":"IQ","ThreeLetterISORegionName":"IRQ"},{"Name":"IE","DisplayName":"Ireland","TwoLetterISORegionName":"IE","ThreeLetterISORegionName":"IRL"},{"Name":"PK","DisplayName":"Islamic Republic of Pakistan","TwoLetterISORegionName":"PK","ThreeLetterISORegionName":"PAK"},{"Name":"IL","DisplayName":"Israel","TwoLetterISORegionName":"IL","ThreeLetterISORegionName":"ISR"},{"Name":"IT","DisplayName":"Italy","TwoLetterISORegionName":"IT","ThreeLetterISORegionName":"ITA"},{"Name":"CI","DisplayName":"Ivory Coast","TwoLetterISORegionName":"CI","ThreeLetterISORegionName":"CIV"},{"Name":"JM","DisplayName":"Jamaica","TwoLetterISORegionName":"JM","ThreeLetterISORegionName":"JAM"},{"Name":"JP","DisplayName":"Japan","TwoLetterISORegionName":"JP","ThreeLetterISORegionName":"JPN"},{"Name":"JO","DisplayName":"Jordan","TwoLetterISORegionName":"JO","ThreeLetterISORegionName":"JOR"},{"Name":"KZ","DisplayName":"Kazakhstan","TwoLetterISORegionName":"KZ","ThreeLetterISORegionName":"KAZ"},{"Name":"KE","DisplayName":"Kenya","TwoLetterISORegionName":"KE","ThreeLetterISORegionName":"KEN"},{"Name":"KR","DisplayName":"Korea","TwoLetterISORegionName":"KR","ThreeLetterISORegionName":"KOR"},{"Name":"KW","DisplayName":"Kuwait","TwoLetterISORegionName":"KW","ThreeLetterISORegionName":"KWT"},{"Name":"KG","DisplayName":"Kyrgyzstan","TwoLetterISORegionName":"KG","ThreeLetterISORegionName":"KGZ"},{"Name":"LA","DisplayName":"Lao P.D.R.","TwoLetterISORegionName":"LA","ThreeLetterISORegionName":"LAO"},{"Name":"419","DisplayName":"Latin America","TwoLetterISORegionName":"419","ThreeLetterISORegionName":"419"},{"Name":"LV","DisplayName":"Latvia","TwoLetterISORegionName":"LV","ThreeLetterISORegionName":"LVA"},{"Name":"LB","DisplayName":"Lebanon","TwoLetterISORegionName":"LB","ThreeLetterISORegionName":"LBN"},{"Name":"LY","DisplayName":"Libya","TwoLetterISORegionName":"LY","ThreeLetterISORegionName":"LBY"},{"Name":"LI","DisplayName":"Liechtenstein","TwoLetterISORegionName":"LI","ThreeLetterISORegionName":"LIE"},{"Name":"LT","DisplayName":"Lithuania","TwoLetterISORegionName":"LT","ThreeLetterISORegionName":"LTU"},{"Name":"LU","DisplayName":"Luxembourg","TwoLetterISORegionName":"LU","ThreeLetterISORegionName":"LUX"},{"Name":"MO","DisplayName":"Macao S.A.R.","TwoLetterISORegionName":"MO","ThreeLetterISORegionName":"MAC"},{"Name":"MK","DisplayName":"Macedonia (FYROM)","TwoLetterISORegionName":"MK","ThreeLetterISORegionName":"MKD"},{"Name":"MY","DisplayName":"Malaysia","TwoLetterISORegionName":"MY","ThreeLetterISORegionName":"MYS"},{"Name":"MV","DisplayName":"Maldives","TwoLetterISORegionName":"MV","ThreeLetterISORegionName":"MDV"},{"Name":"ML","DisplayName":"Mali","TwoLetterISORegionName":"ML","ThreeLetterISORegionName":"MLI"},{"Name":"MT","DisplayName":"Malta","TwoLetterISORegionName":"MT","ThreeLetterISORegionName":"MLT"},{"Name":"MX","DisplayName":"Mexico","TwoLetterISORegionName":"MX","ThreeLetterISORegionName":"MEX"},{"Name":"MN","DisplayName":"Mongolia","TwoLetterISORegionName":"MN","ThreeLetterISORegionName":"MNG"},{"Name":"ME","DisplayName":"Montenegro","TwoLetterISORegionName":"ME","ThreeLetterISORegionName":"MNE"},{"Name":"MA","DisplayName":"Morocco","TwoLetterISORegionName":"MA","ThreeLetterISORegionName":"MAR"},{"Name":"NP","DisplayName":"Nepal","TwoLetterISORegionName":"NP","ThreeLetterISORegionName":"NPL"},{"Name":"NL","DisplayName":"Netherlands","TwoLetterISORegionName":"NL","ThreeLetterISORegionName":"NLD"},{"Name":"NZ","DisplayName":"New Zealand","TwoLetterISORegionName":"NZ","ThreeLetterISORegionName":"NZL"},{"Name":"NI","DisplayName":"Nicaragua","TwoLetterISORegionName":"NI","ThreeLetterISORegionName":"NIC"},{"Name":"NG","DisplayName":"Nigeria","TwoLetterISORegionName":"NG","ThreeLetterISORegionName":"NGA"},{"Name":"NO","DisplayName":"Norway","TwoLetterISORegionName":"NO","ThreeLetterISORegionName":"NOR"},{"Name":"OM","DisplayName":"Oman","TwoLetterISORegionName":"OM","ThreeLetterISORegionName":"OMN"},{"Name":"PA","DisplayName":"Panama","TwoLetterISORegionName":"PA","ThreeLetterISORegionName":"PAN"},{"Name":"PY","DisplayName":"Paraguay","TwoLetterISORegionName":"PY","ThreeLetterISORegionName":"PRY"},{"Name":"CN","DisplayName":"People's Republic of China","TwoLetterISORegionName":"CN","ThreeLetterISORegionName":"CHN"},{"Name":"PE","DisplayName":"Peru","TwoLetterISORegionName":"PE","ThreeLetterISORegionName":"PER"},{"Name":"PH","DisplayName":"Philippines","TwoLetterISORegionName":"PH","ThreeLetterISORegionName":"PHL"},{"Name":"PL","DisplayName":"Poland","TwoLetterISORegionName":"PL","ThreeLetterISORegionName":"POL"},{"Name":"PT","DisplayName":"Portugal","TwoLetterISORegionName":"PT","ThreeLetterISORegionName":"PRT"},{"Name":"MC","DisplayName":"Principality of Monaco","TwoLetterISORegionName":"MC","ThreeLetterISORegionName":"MCO"},{"Name":"PR","DisplayName":"Puerto Rico","TwoLetterISORegionName":"PR","ThreeLetterISORegionName":"PRI"},{"Name":"QA","DisplayName":"Qatar","TwoLetterISORegionName":"QA","ThreeLetterISORegionName":"QAT"},{"Name":"MD","DisplayName":"Republica Moldova","TwoLetterISORegionName":"MD","ThreeLetterISORegionName":"MDA"},{"Name":"RE","DisplayName":"Réunion","TwoLetterISORegionName":"RE","ThreeLetterISORegionName":"REU"},{"Name":"RO","DisplayName":"Romania","TwoLetterISORegionName":"RO","ThreeLetterISORegionName":"ROU"},{"Name":"RU","DisplayName":"Russia","TwoLetterISORegionName":"RU","ThreeLetterISORegionName":"RUS"},{"Name":"RW","DisplayName":"Rwanda","TwoLetterISORegionName":"RW","ThreeLetterISORegionName":"RWA"},{"Name":"SA","DisplayName":"Saudi Arabia","TwoLetterISORegionName":"SA","ThreeLetterISORegionName":"SAU"},{"Name":"SN","DisplayName":"Senegal","TwoLetterISORegionName":"SN","ThreeLetterISORegionName":"SEN"},{"Name":"RS","DisplayName":"Serbia","TwoLetterISORegionName":"RS","ThreeLetterISORegionName":"SRB"},{"Name":"CS","DisplayName":"Serbia and Montenegro (Former)","TwoLetterISORegionName":"CS","ThreeLetterISORegionName":"SCG"},{"Name":"SG","DisplayName":"Singapore","TwoLetterISORegionName":"SG","ThreeLetterISORegionName":"SGP"},{"Name":"SK","DisplayName":"Slovakia","TwoLetterISORegionName":"SK","ThreeLetterISORegionName":"SVK"},{"Name":"SI","DisplayName":"Slovenia","TwoLetterISORegionName":"SI","ThreeLetterISORegionName":"SVN"},{"Name":"SO","DisplayName":"Soomaaliya","TwoLetterISORegionName":"SO","ThreeLetterISORegionName":"SOM"},{"Name":"ZA","DisplayName":"South Africa","TwoLetterISORegionName":"ZA","ThreeLetterISORegionName":"ZAF"},{"Name":"ES","DisplayName":"Spain","TwoLetterISORegionName":"ES","ThreeLetterISORegionName":"ESP"},{"Name":"LK","DisplayName":"Sri Lanka","TwoLetterISORegionName":"LK","ThreeLetterISORegionName":"LKA"},{"Name":"SE","DisplayName":"Sweden","TwoLetterISORegionName":"SE","ThreeLetterISORegionName":"SWE"},{"Name":"CH","DisplayName":"Switzerland","TwoLetterISORegionName":"CH","ThreeLetterISORegionName":"CHE"},{"Name":"SY","DisplayName":"Syria","TwoLetterISORegionName":"SY","ThreeLetterISORegionName":"SYR"},{"Name":"TW","DisplayName":"Taiwan","TwoLetterISORegionName":"TW","ThreeLetterISORegionName":"TWN"},{"Name":"TJ","DisplayName":"Tajikistan","TwoLetterISORegionName":"TJ","ThreeLetterISORegionName":"TAJ"},{"Name":"TH","DisplayName":"Thailand","TwoLetterISORegionName":"TH","ThreeLetterISORegionName":"THA"},{"Name":"TT","DisplayName":"Trinidad and Tobago","TwoLetterISORegionName":"TT","ThreeLetterISORegionName":"TTO"},{"Name":"TN","DisplayName":"Tunisia","TwoLetterISORegionName":"TN","ThreeLetterISORegionName":"TUN"},{"Name":"TR","DisplayName":"Turkey","TwoLetterISORegionName":"TR","ThreeLetterISORegionName":"TUR"},{"Name":"TM","DisplayName":"Turkmenistan","TwoLetterISORegionName":"TM","ThreeLetterISORegionName":"TKM"},{"Name":"AE","DisplayName":"U.A.E.","TwoLetterISORegionName":"AE","ThreeLetterISORegionName":"ARE"},{"Name":"UA","DisplayName":"Ukraine","TwoLetterISORegionName":"UA","ThreeLetterISORegionName":"UKR"},{"Name":"GB","DisplayName":"United Kingdom","TwoLetterISORegionName":"GB","ThreeLetterISORegionName":"GBR"},{"Name":"US","DisplayName":"United States","TwoLetterISORegionName":"US","ThreeLetterISORegionName":"USA"},{"Name":"UY","DisplayName":"Uruguay","TwoLetterISORegionName":"UY","ThreeLetterISORegionName":"URY"},{"Name":"UZ","DisplayName":"Uzbekistan","TwoLetterISORegionName":"UZ","ThreeLetterISORegionName":"UZB"},{"Name":"VN","DisplayName":"Vietnam","TwoLetterISORegionName":"VN","ThreeLetterISORegionName":"VNM"},{"Name":"YE","DisplayName":"Yemen","TwoLetterISORegionName":"YE","ThreeLetterISORegionName":"YEM"},{"Name":"ZW","DisplayName":"Zimbabwe","TwoLetterISORegionName":"ZW","ThreeLetterISORegionName":"ZWE"}] \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Localization/cultures.json b/MediaBrowser.Server.Implementations/Localization/cultures.json new file mode 100644 index 000000000..9d98b664b --- /dev/null +++ b/MediaBrowser.Server.Implementations/Localization/cultures.json @@ -0,0 +1 @@ +[{"Name":"af","DisplayName":"Afrikaans","TwoLetterISOLanguageName":"af","ThreeLetterISOLanguageName":"afr"},{"Name":"sq","DisplayName":"Albanian","TwoLetterISOLanguageName":"sq","ThreeLetterISOLanguageName":"sqi"},{"Name":"gsw","DisplayName":"Alsatian","TwoLetterISOLanguageName":"gsw","ThreeLetterISOLanguageName":"gsw"},{"Name":"am","DisplayName":"Amharic","TwoLetterISOLanguageName":"am","ThreeLetterISOLanguageName":"amh"},{"Name":"ar","DisplayName":"Arabic","TwoLetterISOLanguageName":"ar","ThreeLetterISOLanguageName":"ara"},{"Name":"hy","DisplayName":"Armenian","TwoLetterISOLanguageName":"hy","ThreeLetterISOLanguageName":"hye"},{"Name":"as","DisplayName":"Assamese","TwoLetterISOLanguageName":"as","ThreeLetterISOLanguageName":"asm"},{"Name":"az","DisplayName":"Azeri","TwoLetterISOLanguageName":"az","ThreeLetterISOLanguageName":"aze"},{"Name":"jv","DisplayName":"Basa Jawa","TwoLetterISOLanguageName":"jv","ThreeLetterISOLanguageName":"jav"},{"Name":"ba","DisplayName":"Bashkir","TwoLetterISOLanguageName":"ba","ThreeLetterISOLanguageName":"bak"},{"Name":"eu","DisplayName":"Basque","TwoLetterISOLanguageName":"eu","ThreeLetterISOLanguageName":"eus"},{"Name":"be","DisplayName":"Belarusian","TwoLetterISOLanguageName":"be","ThreeLetterISOLanguageName":"bel"},{"Name":"bn","DisplayName":"Bengali","TwoLetterISOLanguageName":"bn","ThreeLetterISOLanguageName":"bng"},{"Name":"bs","DisplayName":"Bosnian","TwoLetterISOLanguageName":"bs","ThreeLetterISOLanguageName":"bsb"},{"Name":"bs-Cyrl","DisplayName":"Bosnian (Cyrillic)","TwoLetterISOLanguageName":"bs","ThreeLetterISOLanguageName":"bsc"},{"Name":"br","DisplayName":"Breton","TwoLetterISOLanguageName":"br","ThreeLetterISOLanguageName":"bre"},{"Name":"bg","DisplayName":"Bulgarian","TwoLetterISOLanguageName":"bg","ThreeLetterISOLanguageName":"bul"},{"Name":"my","DisplayName":"Burmese","TwoLetterISOLanguageName":"my","ThreeLetterISOLanguageName":"mya"},{"Name":"ca","DisplayName":"Catalan","TwoLetterISOLanguageName":"ca","ThreeLetterISOLanguageName":"cat"},{"Name":"tzm-Tfng-MA","DisplayName":"Central Atlas Tamazight (Tifinagh, Morocco)","TwoLetterISOLanguageName":"tzm","ThreeLetterISOLanguageName":"tzm"},{"Name":"ku","DisplayName":"Central Kurdish","TwoLetterISOLanguageName":"ku","ThreeLetterISOLanguageName":"kur"},{"Name":"chr","DisplayName":"Cherokee","TwoLetterISOLanguageName":"chr","ThreeLetterISOLanguageName":"chr"},{"Name":"zh","DisplayName":"Chinese","TwoLetterISOLanguageName":"zh","ThreeLetterISOLanguageName":"zho"},{"Name":"sn","DisplayName":"chiShona","TwoLetterISOLanguageName":"sn","ThreeLetterISOLanguageName":"sna"},{"Name":"co","DisplayName":"Corsican","TwoLetterISOLanguageName":"co","ThreeLetterISOLanguageName":"cos"},{"Name":"hr","DisplayName":"Croatian","TwoLetterISOLanguageName":"hr","ThreeLetterISOLanguageName":"hrv"},{"Name":"hr-BA","DisplayName":"Croatian (Latin, Bosnia and Herzegovina)","TwoLetterISOLanguageName":"hr","ThreeLetterISOLanguageName":"hrb"},{"Name":"cs","DisplayName":"Czech","TwoLetterISOLanguageName":"cs","ThreeLetterISOLanguageName":"ces"},{"Name":"da","DisplayName":"Danish","TwoLetterISOLanguageName":"da","ThreeLetterISOLanguageName":"dan"},{"Name":"prs","DisplayName":"Dari","TwoLetterISOLanguageName":"prs","ThreeLetterISOLanguageName":"prs"},{"Name":"dv","DisplayName":"Divehi","TwoLetterISOLanguageName":"dv","ThreeLetterISOLanguageName":"div"},{"Name":"nl","DisplayName":"Dutch","TwoLetterISOLanguageName":"nl","ThreeLetterISOLanguageName":"nld"},{"Name":"en","DisplayName":"English","TwoLetterISOLanguageName":"en","ThreeLetterISOLanguageName":"eng"},{"Name":"et","DisplayName":"Estonian","TwoLetterISOLanguageName":"et","ThreeLetterISOLanguageName":"est"},{"Name":"fo","DisplayName":"Faroese","TwoLetterISOLanguageName":"fo","ThreeLetterISOLanguageName":"fao"},{"Name":"fil","DisplayName":"Filipino","TwoLetterISOLanguageName":"fil","ThreeLetterISOLanguageName":"fil"},{"Name":"fi","DisplayName":"Finnish","TwoLetterISOLanguageName":"fi","ThreeLetterISOLanguageName":"fin"},{"Name":"fr","DisplayName":"French","TwoLetterISOLanguageName":"fr","ThreeLetterISOLanguageName":"fra"},{"Name":"fy","DisplayName":"Frisian","TwoLetterISOLanguageName":"fy","ThreeLetterISOLanguageName":"fry"},{"Name":"ff","DisplayName":"Fulah","TwoLetterISOLanguageName":"ff","ThreeLetterISOLanguageName":"ful"},{"Name":"gl","DisplayName":"Galician","TwoLetterISOLanguageName":"gl","ThreeLetterISOLanguageName":"glg"},{"Name":"ka","DisplayName":"Georgian","TwoLetterISOLanguageName":"ka","ThreeLetterISOLanguageName":"kat"},{"Name":"de","DisplayName":"German","TwoLetterISOLanguageName":"de","ThreeLetterISOLanguageName":"deu"},{"Name":"el","DisplayName":"Greek","TwoLetterISOLanguageName":"el","ThreeLetterISOLanguageName":"ell"},{"Name":"kl","DisplayName":"Greenlandic","TwoLetterISOLanguageName":"kl","ThreeLetterISOLanguageName":"kal"},{"Name":"gn","DisplayName":"Guarani","TwoLetterISOLanguageName":"gn","ThreeLetterISOLanguageName":"grn"},{"Name":"gu","DisplayName":"Gujarati","TwoLetterISOLanguageName":"gu","ThreeLetterISOLanguageName":"guj"},{"Name":"ha","DisplayName":"Hausa","TwoLetterISOLanguageName":"ha","ThreeLetterISOLanguageName":"hau"},{"Name":"haw","DisplayName":"Hawaiian","TwoLetterISOLanguageName":"haw","ThreeLetterISOLanguageName":"haw"},{"Name":"he","DisplayName":"Hebrew","TwoLetterISOLanguageName":"he","ThreeLetterISOLanguageName":"heb"},{"Name":"hi","DisplayName":"Hindi","TwoLetterISOLanguageName":"hi","ThreeLetterISOLanguageName":"hin"},{"Name":"hu","DisplayName":"Hungarian","TwoLetterISOLanguageName":"hu","ThreeLetterISOLanguageName":"hun"},{"Name":"is","DisplayName":"Icelandic","TwoLetterISOLanguageName":"is","ThreeLetterISOLanguageName":"isl"},{"Name":"ig","DisplayName":"Igbo","TwoLetterISOLanguageName":"ig","ThreeLetterISOLanguageName":"ibo"},{"Name":"id","DisplayName":"Indonesian","TwoLetterISOLanguageName":"id","ThreeLetterISOLanguageName":"ind"},{"Name":"iu","DisplayName":"Inuktitut","TwoLetterISOLanguageName":"iu","ThreeLetterISOLanguageName":"iku"},{"Name":"","DisplayName":"Invariant Language (Invariant Country)","TwoLetterISOLanguageName":"iv","ThreeLetterISOLanguageName":"ivl"},{"Name":"ga","DisplayName":"Irish","TwoLetterISOLanguageName":"ga","ThreeLetterISOLanguageName":"gle"},{"Name":"xh","DisplayName":"isiXhosa","TwoLetterISOLanguageName":"xh","ThreeLetterISOLanguageName":"xho"},{"Name":"zu","DisplayName":"isiZulu","TwoLetterISOLanguageName":"zu","ThreeLetterISOLanguageName":"zul"},{"Name":"it","DisplayName":"Italian","TwoLetterISOLanguageName":"it","ThreeLetterISOLanguageName":"ita"},{"Name":"ja","DisplayName":"Japanese","TwoLetterISOLanguageName":"ja","ThreeLetterISOLanguageName":"jpn"},{"Name":"kn","DisplayName":"Kannada","TwoLetterISOLanguageName":"kn","ThreeLetterISOLanguageName":"kan"},{"Name":"kk","DisplayName":"Kazakh","TwoLetterISOLanguageName":"kk","ThreeLetterISOLanguageName":"kaz"},{"Name":"km","DisplayName":"Khmer","TwoLetterISOLanguageName":"km","ThreeLetterISOLanguageName":"khm"},{"Name":"qut","DisplayName":"K'iche","TwoLetterISOLanguageName":"qut","ThreeLetterISOLanguageName":"qut"},{"Name":"rw","DisplayName":"Kinyarwanda","TwoLetterISOLanguageName":"rw","ThreeLetterISOLanguageName":"kin"},{"Name":"sw","DisplayName":"Kiswahili","TwoLetterISOLanguageName":"sw","ThreeLetterISOLanguageName":"swa"},{"Name":"kok","DisplayName":"Konkani","TwoLetterISOLanguageName":"kok","ThreeLetterISOLanguageName":"kok"},{"Name":"ko","DisplayName":"Korean","TwoLetterISOLanguageName":"ko","ThreeLetterISOLanguageName":"kor"},{"Name":"ky","DisplayName":"Kyrgyz","TwoLetterISOLanguageName":"ky","ThreeLetterISOLanguageName":"kir"},{"Name":"lo","DisplayName":"Lao","TwoLetterISOLanguageName":"lo","ThreeLetterISOLanguageName":"lao"},{"Name":"lv","DisplayName":"Latvian","TwoLetterISOLanguageName":"lv","ThreeLetterISOLanguageName":"lav"},{"Name":"lt","DisplayName":"Lithuanian","TwoLetterISOLanguageName":"lt","ThreeLetterISOLanguageName":"lit"},{"Name":"dsb","DisplayName":"Lower Sorbian","TwoLetterISOLanguageName":"dsb","ThreeLetterISOLanguageName":"dsb"},{"Name":"lb","DisplayName":"Luxembourgish","TwoLetterISOLanguageName":"lb","ThreeLetterISOLanguageName":"ltz"},{"Name":"mk-MK","DisplayName":"Macedonian (Former Yugoslav Republic of Macedonia)","TwoLetterISOLanguageName":"mk","ThreeLetterISOLanguageName":"mkd"},{"Name":"mg","DisplayName":"Malagasy","TwoLetterISOLanguageName":"mg","ThreeLetterISOLanguageName":"mlg"},{"Name":"ms","DisplayName":"Malay","TwoLetterISOLanguageName":"ms","ThreeLetterISOLanguageName":"msa"},{"Name":"ml","DisplayName":"Malayalam","TwoLetterISOLanguageName":"ml","ThreeLetterISOLanguageName":"mym"},{"Name":"mt","DisplayName":"Maltese","TwoLetterISOLanguageName":"mt","ThreeLetterISOLanguageName":"mlt"},{"Name":"mi","DisplayName":"Maori","TwoLetterISOLanguageName":"mi","ThreeLetterISOLanguageName":"mri"},{"Name":"arn","DisplayName":"Mapudungun","TwoLetterISOLanguageName":"arn","ThreeLetterISOLanguageName":"arn"},{"Name":"mr","DisplayName":"Marathi","TwoLetterISOLanguageName":"mr","ThreeLetterISOLanguageName":"mar"},{"Name":"moh","DisplayName":"Mohawk","TwoLetterISOLanguageName":"moh","ThreeLetterISOLanguageName":"moh"},{"Name":"mn","DisplayName":"Mongolian","TwoLetterISOLanguageName":"mn","ThreeLetterISOLanguageName":"mon"},{"Name":"ne","DisplayName":"Nepali","TwoLetterISOLanguageName":"ne","ThreeLetterISOLanguageName":"nep"},{"Name":"no","DisplayName":"Norwegian","TwoLetterISOLanguageName":"nb","ThreeLetterISOLanguageName":"nob"},{"Name":"nn","DisplayName":"Norwegian (Nynorsk)","TwoLetterISOLanguageName":"nn","ThreeLetterISOLanguageName":"nno"},{"Name":"oc","DisplayName":"Occitan","TwoLetterISOLanguageName":"oc","ThreeLetterISOLanguageName":"oci"},{"Name":"or","DisplayName":"Oriya","TwoLetterISOLanguageName":"or","ThreeLetterISOLanguageName":"ori"},{"Name":"om","DisplayName":"Oromo","TwoLetterISOLanguageName":"om","ThreeLetterISOLanguageName":"orm"},{"Name":"ps","DisplayName":"Pashto","TwoLetterISOLanguageName":"ps","ThreeLetterISOLanguageName":"pus"},{"Name":"fa","DisplayName":"Persian","TwoLetterISOLanguageName":"fa","ThreeLetterISOLanguageName":"fas"},{"Name":"pl","DisplayName":"Polish","TwoLetterISOLanguageName":"pl","ThreeLetterISOLanguageName":"pol"},{"Name":"pt-AO","DisplayName":"português (Angola)","TwoLetterISOLanguageName":"pt","ThreeLetterISOLanguageName":"por"},{"Name":"pa","DisplayName":"Punjabi","TwoLetterISOLanguageName":"pa","ThreeLetterISOLanguageName":"pan"},{"Name":"quz","DisplayName":"Quechua","TwoLetterISOLanguageName":"quz","ThreeLetterISOLanguageName":"qub"},{"Name":"quz-EC","DisplayName":"Quechua (Ecuador)","TwoLetterISOLanguageName":"quz","ThreeLetterISOLanguageName":"que"},{"Name":"quz-PE","DisplayName":"Quechua (Peru)","TwoLetterISOLanguageName":"quz","ThreeLetterISOLanguageName":"qup"},{"Name":"ro","DisplayName":"Romanian","TwoLetterISOLanguageName":"ro","ThreeLetterISOLanguageName":"ron"},{"Name":"rm","DisplayName":"Romansh","TwoLetterISOLanguageName":"rm","ThreeLetterISOLanguageName":"roh"},{"Name":"ru","DisplayName":"Russian","TwoLetterISOLanguageName":"ru","ThreeLetterISOLanguageName":"rus"},{"Name":"sah","DisplayName":"Sakha","TwoLetterISOLanguageName":"sah","ThreeLetterISOLanguageName":"sah"},{"Name":"smn","DisplayName":"Sami (Inari)","TwoLetterISOLanguageName":"smn","ThreeLetterISOLanguageName":"smn"},{"Name":"smj","DisplayName":"Sami (Lule)","TwoLetterISOLanguageName":"smj","ThreeLetterISOLanguageName":"smj"},{"Name":"se","DisplayName":"Sami (Northern)","TwoLetterISOLanguageName":"se","ThreeLetterISOLanguageName":"sme"},{"Name":"sms","DisplayName":"Sami (Skolt)","TwoLetterISOLanguageName":"sms","ThreeLetterISOLanguageName":"sms"},{"Name":"sma","DisplayName":"Sami (Southern)","TwoLetterISOLanguageName":"sma","ThreeLetterISOLanguageName":"sma"},{"Name":"sa","DisplayName":"Sanskrit","TwoLetterISOLanguageName":"sa","ThreeLetterISOLanguageName":"san"},{"Name":"gd","DisplayName":"Scottish Gaelic","TwoLetterISOLanguageName":"gd","ThreeLetterISOLanguageName":"gla"},{"Name":"sr","DisplayName":"Serbian","TwoLetterISOLanguageName":"sr","ThreeLetterISOLanguageName":"srp"},{"Name":"sr-Cyrl-BA","DisplayName":"Serbian (Cyrillic, Bosnia and Herzegovina)","TwoLetterISOLanguageName":"sr","ThreeLetterISOLanguageName":"srn"},{"Name":"sr-Latn-BA","DisplayName":"Serbian (Latin, Bosnia and Herzegovina)","TwoLetterISOLanguageName":"sr","ThreeLetterISOLanguageName":"srs"},{"Name":"nso","DisplayName":"Sesotho sa Leboa","TwoLetterISOLanguageName":"nso","ThreeLetterISOLanguageName":"nso"},{"Name":"tn","DisplayName":"Setswana","TwoLetterISOLanguageName":"tn","ThreeLetterISOLanguageName":"tsn"},{"Name":"sd","DisplayName":"Sindhi","TwoLetterISOLanguageName":"sd","ThreeLetterISOLanguageName":"sin"},{"Name":"si","DisplayName":"Sinhala","TwoLetterISOLanguageName":"si","ThreeLetterISOLanguageName":"sin"},{"Name":"sk","DisplayName":"Slovak","TwoLetterISOLanguageName":"sk","ThreeLetterISOLanguageName":"slk"},{"Name":"sl","DisplayName":"Slovenian","TwoLetterISOLanguageName":"sl","ThreeLetterISOLanguageName":"slv"},{"Name":"so","DisplayName":"Somali","TwoLetterISOLanguageName":"so","ThreeLetterISOLanguageName":"som"},{"Name":"st","DisplayName":"Southern Sotho","TwoLetterISOLanguageName":"st","ThreeLetterISOLanguageName":"sot"},{"Name":"es","DisplayName":"Spanish","TwoLetterISOLanguageName":"es","ThreeLetterISOLanguageName":"spa"},{"Name":"zgh","DisplayName":"Standard Morrocan Tamazight","TwoLetterISOLanguageName":"zgh","ThreeLetterISOLanguageName":"zgh"},{"Name":"sv","DisplayName":"Swedish","TwoLetterISOLanguageName":"sv","ThreeLetterISOLanguageName":"swe"},{"Name":"syr","DisplayName":"Syriac","TwoLetterISOLanguageName":"syr","ThreeLetterISOLanguageName":"syr"},{"Name":"tg","DisplayName":"Tajik","TwoLetterISOLanguageName":"tg","ThreeLetterISOLanguageName":"tgk"},{"Name":"ta","DisplayName":"Tamil","TwoLetterISOLanguageName":"ta","ThreeLetterISOLanguageName":"tam"},{"Name":"tt","DisplayName":"Tatar","TwoLetterISOLanguageName":"tt","ThreeLetterISOLanguageName":"tat"},{"Name":"te","DisplayName":"Telugu","TwoLetterISOLanguageName":"te","ThreeLetterISOLanguageName":"tel"},{"Name":"th","DisplayName":"Thai","TwoLetterISOLanguageName":"th","ThreeLetterISOLanguageName":"tha"},{"Name":"bo","DisplayName":"Tibetan","TwoLetterISOLanguageName":"bo","ThreeLetterISOLanguageName":"bod"},{"Name":"ti","DisplayName":"Tigrinya","TwoLetterISOLanguageName":"ti","ThreeLetterISOLanguageName":"tir"},{"Name":"ts","DisplayName":"Tsonga","TwoLetterISOLanguageName":"ts","ThreeLetterISOLanguageName":"tso"},{"Name":"tr","DisplayName":"Turkish","TwoLetterISOLanguageName":"tr","ThreeLetterISOLanguageName":"tur"},{"Name":"tk","DisplayName":"Turkmen","TwoLetterISOLanguageName":"tk","ThreeLetterISOLanguageName":"tuk"},{"Name":"uk","DisplayName":"Ukrainian","TwoLetterISOLanguageName":"uk","ThreeLetterISOLanguageName":"ukr"},{"Name":"hsb","DisplayName":"Upper Sorbian","TwoLetterISOLanguageName":"hsb","ThreeLetterISOLanguageName":"hsb"},{"Name":"ur","DisplayName":"Urdu","TwoLetterISOLanguageName":"ur","ThreeLetterISOLanguageName":"urd"},{"Name":"ug","DisplayName":"Uyghur","TwoLetterISOLanguageName":"ug","ThreeLetterISOLanguageName":"uig"},{"Name":"uz","DisplayName":"Uzbek","TwoLetterISOLanguageName":"uz","ThreeLetterISOLanguageName":"uzb"},{"Name":"vi","DisplayName":"Vietnamese","TwoLetterISOLanguageName":"vi","ThreeLetterISOLanguageName":"vie"},{"Name":"cy","DisplayName":"Welsh","TwoLetterISOLanguageName":"cy","ThreeLetterISOLanguageName":"cym"},{"Name":"wo","DisplayName":"Wolof","TwoLetterISOLanguageName":"wo","ThreeLetterISOLanguageName":"wol"},{"Name":"ii","DisplayName":"Yi","TwoLetterISOLanguageName":"ii","ThreeLetterISOLanguageName":"iii"},{"Name":"yo","DisplayName":"Yoruba","TwoLetterISOLanguageName":"yo","ThreeLetterISOLanguageName":"yor"}] \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 6e5e58d26..3532ee370 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -169,7 +169,6 @@ - @@ -328,6 +327,8 @@ + + diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index af400f850..c79d84e5a 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -31,11 +31,11 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Resolvers; using MediaBrowser.Controller.Session; using MediaBrowser.Controller.Sorting; +using MediaBrowser.Controller.Subtitles; using MediaBrowser.Controller.Themes; using MediaBrowser.Dlna; using MediaBrowser.Dlna.Eventing; using MediaBrowser.Dlna.Main; -using MediaBrowser.Dlna.PlayTo; using MediaBrowser.Dlna.Server; using MediaBrowser.MediaEncoding.BdInfo; using MediaBrowser.MediaEncoding.Encoder; @@ -44,6 +44,7 @@ using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.System; using MediaBrowser.Model.Updates; using MediaBrowser.Providers.Manager; +using MediaBrowser.Providers.Subtitles; using MediaBrowser.Server.Implementations; using MediaBrowser.Server.Implementations.Channels; using MediaBrowser.Server.Implementations.Collections; @@ -193,6 +194,7 @@ namespace MediaBrowser.ServerApplication private IProviderRepository ProviderRepository { get; set; } private INotificationManager NotificationManager { get; set; } + private ISubtitleManager SubtitleManager { get; set; } /// /// Initializes a new instance of the class. @@ -531,6 +533,9 @@ namespace MediaBrowser.ServerApplication NotificationManager = new NotificationManager(LogManager, UserManager, ServerConfigurationManager); RegisterSingleInstance(NotificationManager); + SubtitleManager = new SubtitleManager(LogManager.GetLogger("SubtitleManager"), FileSystemManager, LibraryMonitor); + RegisterSingleInstance(SubtitleManager); + var displayPreferencesTask = Task.Run(async () => await ConfigureDisplayPreferencesRepositories().ConfigureAwait(false)); var itemsTask = Task.Run(async () => await ConfigureItemRepositories().ConfigureAwait(false)); var userdataTask = Task.Run(async () => await ConfigureUserDataRepositories().ConfigureAwait(false)); @@ -566,7 +571,7 @@ namespace MediaBrowser.ServerApplication { var info = await new FFMpegDownloader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager).GetFFMpegInfo(progress).ConfigureAwait(false); - MediaEncoder = new MediaEncoder(LogManager.GetLogger("MediaEncoder"), ApplicationPaths, JsonSerializer, info.Path, info.ProbePath, info.Version, FileSystemManager); + MediaEncoder = new MediaEncoder(LogManager.GetLogger("MediaEncoder"), ApplicationPaths, JsonSerializer, info.EncoderPath, info.ProbePath, info.Version, FileSystemManager); RegisterSingleInstance(MediaEncoder); } @@ -710,6 +715,8 @@ namespace MediaBrowser.ServerApplication LiveTvManager.AddParts(GetExports()); + SubtitleManager.AddParts(GetExports()); + SessionManager.AddParts(GetExports()); ChannelManager.AddParts(GetExports(), GetExports()); diff --git a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs index c4f529754..19aa7a684 100644 --- a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs +++ b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs @@ -4,6 +4,8 @@ using Mono.Unix.Native; using System.Text.RegularExpressions; using System.IO; #endif +using System.IO; +using System.Text.RegularExpressions; namespace MediaBrowser.ServerApplication.FFMpeg { @@ -32,7 +34,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg switch (arg) { case "Version": - return "20140304"; + return "20140506"; case "FFMpegFilename": return "ffmpeg.exe"; case "FFProbeFilename": @@ -42,7 +44,6 @@ namespace MediaBrowser.ServerApplication.FFMpeg } break; - #if __MonoCS__ case PlatformID.Unix: if (PlatformDetection.IsMac) { @@ -69,7 +70,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg switch (arg) { case "Version": - return "20140304"; + return "20140506"; case "FFMpegFilename": return "ffmpeg"; case "FFProbeFilename": @@ -85,7 +86,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg switch (arg) { case "Version": - return "20140304"; + return "20140505"; case "FFMpegFilename": return "ffmpeg"; case "FFProbeFilename": @@ -98,7 +99,6 @@ namespace MediaBrowser.ServerApplication.FFMpeg } // Unsupported Unix platform return ""; -#endif } return ""; } @@ -106,18 +106,17 @@ namespace MediaBrowser.ServerApplication.FFMpeg private static string[] GetDownloadUrls() { var pid = Environment.OSVersion.Platform; - + switch (pid) { case PlatformID.Win32NT: return new[] { - "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20140304-git-f34cceb-win32-static.7z", - "https://www.dropbox.com/s/6brdetuzbld93jk/ffmpeg-20140304-git-f34cceb-win32-static.7z?dl=1" + "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20140506-git-2baf1c8-win32-static.7z", + "https://www.dropbox.com/s/lxlzxs0r83iatsv/ffmpeg-20140506-git-2baf1c8-win32-static.7z?dl=1" }; - - #if __MonoCS__ - case PlatformID.Unix: + + case PlatformID.Unix: if (PlatformDetection.IsMac && PlatformDetection.IsX86_64) { return new[] @@ -132,8 +131,8 @@ namespace MediaBrowser.ServerApplication.FFMpeg { return new[] { - "http://ffmpeg.gusari.org/static/32bit/ffmpeg.static.32bit.2014-03-04.tar.gz", - "https://www.dropbox.com/s/0l76mcauqqkta31/ffmpeg.static.32bit.2014-03-04.tar.gz?dl=1" + "http://ffmpeg.gusari.org/static/32bit/ffmpeg.static.32bit.latest.tar.gz", + "https://www.dropbox.com/s/k9s02pv5to6slfb/ffmpeg.static.32bit.2014-05-06.tar.gz?dl=1" }; } @@ -141,22 +140,20 @@ namespace MediaBrowser.ServerApplication.FFMpeg { return new[] { - "http://ffmpeg.gusari.org/static/64bit/ffmpeg.static.64bit.2014-03-04.tar.gz", - "https://www.dropbox.com/s/9wlxz440mdejuqe/ffmpeg.static.64bit.2014-03-04.tar.gz?dl=1" + "http://ffmpeg.gusari.org/static/64bit/ffmpeg.static.64bit.latest.tar.gz", + "https://www.dropbox.com/s/onuregwghywnzjo/ffmpeg.static.64bit.2014-05-05.tar.gz?dl=1" }; } } //No Unix version available - return new string[] {}; -#endif + return new string[] { }; } - return new string[] {}; + return new string[] { }; } } - #if __MonoCS__ public static class PlatformDetection { public readonly static bool IsWindows; @@ -166,34 +163,52 @@ namespace MediaBrowser.ServerApplication.FFMpeg public readonly static bool IsX86_64; public readonly static bool IsArm; - static PlatformDetection () + static PlatformDetection() { IsWindows = Path.DirectorySeparatorChar == '\\'; //Don't call uname on windows if (!IsWindows) { - Utsname uname; - var callResult = Syscall.uname(out uname); - if (callResult == 0) - { - IsMac = uname.sysname == "Darwin"; - IsLinux = !IsMac && uname.sysname == "Linux"; + var uname = GetUnixName(); - Regex archX86 = new Regex("(i|I)[3-6]86"); - IsX86 = archX86.IsMatch(uname.machine); - IsX86_64 = !IsX86 && uname.machine == "x86_64"; - IsArm = !IsX86 && !IsX86 && uname.machine.StartsWith("arm"); - } + IsMac = uname.sysname == "Darwin"; + IsLinux = uname.sysname == "Linux"; + + var archX86 = new Regex("(i|I)[3-6]86"); + IsX86 = archX86.IsMatch(uname.machine); + IsX86_64 = !IsX86 && uname.machine == "x86_64"; + IsArm = !IsX86 && !IsX86_64 && uname.machine.StartsWith("arm"); } else { - if (System.Environment.Is64BitOperatingSystem) + if (Environment.Is64BitOperatingSystem) IsX86_64 = true; else IsX86 = true; } } + + private static Uname GetUnixName() + { + var uname = new Uname(); + +#if __MonoCS__ + Utsname uname; + var callResult = Syscall.uname(out uname); + if (callResult == 0) + { + uname.sysname= uname.sysname; + uname.machine= uname.machine; + } +#endif + return uname; + } + } + + public class Uname + { + public string sysname = string.Empty; + public string machine = string.Empty; } - #endif } diff --git a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs index b9c45e0d9..c550cb27f 100644 --- a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs +++ b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs @@ -42,63 +42,86 @@ namespace MediaBrowser.ServerApplication.FFMpeg public async Task GetFFMpegInfo(IProgress progress) { - var versionedDirectoryPath = Path.Combine(GetMediaToolsPath(true), FFMpegDownloadInfo.Version); + var rootEncoderPath = Path.Combine(_appPaths.ProgramDataPath, "ffmpeg"); + var versionedDirectoryPath = Path.Combine(rootEncoderPath, FFMpegDownloadInfo.Version); var info = new FFMpegInfo { ProbePath = Path.Combine(versionedDirectoryPath, FFMpegDownloadInfo.FFProbeFilename), - Path = Path.Combine(versionedDirectoryPath, FFMpegDownloadInfo.FFMpegFilename), + EncoderPath = Path.Combine(versionedDirectoryPath, FFMpegDownloadInfo.FFMpegFilename), Version = FFMpegDownloadInfo.Version }; Directory.CreateDirectory(versionedDirectoryPath); - var tasks = new List(); - - double ffmpegPercent = 0; - double fontPercent = 0; - var syncLock = new object(); - - if (!File.Exists(info.ProbePath) || !File.Exists(info.Path)) + if (!File.Exists(info.ProbePath) || !File.Exists(info.EncoderPath)) { - var ffmpegProgress = new ActionableProgress(); - ffmpegProgress.RegisterAction(p => - { - ffmpegPercent = p; + // ffmpeg not present. See if there's an older version we can start with + var existingVersion = GetExistingVersion(info, rootEncoderPath); - lock (syncLock) - { - progress.Report((ffmpegPercent / 2) + (fontPercent / 2)); - } - }); + // No older version. Need to download and block until complete + if (existingVersion == null) + { + await DownloadFFMpeg(versionedDirectoryPath, progress).ConfigureAwait(false); + } + else + { + // Older version found. + // Start with that. Download new version in the background. + var newPath = versionedDirectoryPath; + Task.Run(() => DownloadFFMpegInBackground(newPath)); - tasks.Add(DownloadFFMpeg(info, ffmpegProgress)); - } - else - { - ffmpegPercent = 100; - progress.Report(50); + info = existingVersion; + versionedDirectoryPath = Path.GetDirectoryName(info.EncoderPath); + } } - var fontProgress = new ActionableProgress(); - fontProgress.RegisterAction(p => + await DownloadFonts(versionedDirectoryPath).ConfigureAwait(false); + + return info; + } + + private FFMpegInfo GetExistingVersion(FFMpegInfo info, string rootEncoderPath) + { + var encoderFilename = Path.GetFileName(info.EncoderPath); + var probeFilename = Path.GetFileName(info.ProbePath); + + foreach (var directory in Directory.EnumerateDirectories(rootEncoderPath, "*", SearchOption.TopDirectoryOnly) + .ToList()) { - fontPercent = p; + var allFiles = Directory.EnumerateFiles(directory, "*", SearchOption.AllDirectories).ToList(); - lock (syncLock) + var encoder = allFiles.FirstOrDefault(i => string.Equals(Path.GetFileName(i), encoderFilename, StringComparison.OrdinalIgnoreCase)); + var probe = allFiles.FirstOrDefault(i => string.Equals(Path.GetFileName(i), probeFilename, StringComparison.OrdinalIgnoreCase)); + + if (!string.IsNullOrWhiteSpace(encoder) && + !string.IsNullOrWhiteSpace(probe)) { - progress.Report((ffmpegPercent / 2) + (fontPercent / 2)); + return new FFMpegInfo + { + EncoderPath = encoder, + ProbePath = probe, + Version = Path.GetFileNameWithoutExtension(Path.GetDirectoryName(probe)) + }; } - }); - - tasks.Add(DownloadFonts(versionedDirectoryPath, fontProgress)); + } - await Task.WhenAll(tasks).ConfigureAwait(false); + return null; + } - return info; + private async void DownloadFFMpegInBackground(string directory) + { + try + { + await DownloadFFMpeg(directory, new Progress()).ConfigureAwait(false); + } + catch (Exception ex) + { + _logger.ErrorException("Error downloading ffmpeg", ex); + } } - private async Task DownloadFFMpeg(FFMpegInfo info, IProgress progress) + private async Task DownloadFFMpeg(string directory, IProgress progress) { foreach (var url in FFMpegDownloadInfo.FfMpegUrls) { @@ -114,7 +137,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg }).ConfigureAwait(false); - ExtractFFMpeg(tempFile, Path.GetDirectoryName(info.Path)); + ExtractFFMpeg(tempFile, directory); return; } catch (HttpException ex) @@ -132,7 +155,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg private void ExtractFFMpeg(string tempFile, string targetFolder) { - _logger.Debug("Extracting ffmpeg from {0}", tempFile); + _logger.Info("Extracting ffmpeg from {0}", tempFile); var tempFolder = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid().ToString()); @@ -171,6 +194,8 @@ namespace MediaBrowser.ServerApplication.FFMpeg private void ExtractArchive(string archivePath, string targetPath) { + _logger.Info("Extracting {0} to {1}", archivePath, targetPath); + if (string.Equals(FFMpegDownloadInfo.ArchiveType, "7z", StringComparison.OrdinalIgnoreCase)) { _zipClient.ExtractAllFrom7z(archivePath, targetPath, true); @@ -182,6 +207,8 @@ namespace MediaBrowser.ServerApplication.FFMpeg } private void Extract7zArchive(string archivePath, string targetPath) { + _logger.Info("Extracting {0} to {1}", archivePath, targetPath); + _zipClient.ExtractAllFrom7z(archivePath, targetPath, true); } @@ -201,7 +228,8 @@ namespace MediaBrowser.ServerApplication.FFMpeg /// Extracts the fonts. /// /// The target path. - private async Task DownloadFonts(string targetPath, IProgress progress) + /// Task. + private async Task DownloadFonts(string targetPath) { try { @@ -213,12 +241,19 @@ namespace MediaBrowser.ServerApplication.FFMpeg var fontFile = Path.Combine(fontsDirectory, fontFilename); - if (!File.Exists(fontFile)) + if (File.Exists(fontFile)) { - await DownloadFontFile(fontsDirectory, fontFilename, progress).ConfigureAwait(false); + await WriteFontConfigFile(fontsDirectory).ConfigureAwait(false); + } + else + { + // Kick this off, but no need to wait on it + Task.Run(async () => + { + await DownloadFontFile(fontsDirectory, fontFilename, new Progress()).ConfigureAwait(false); + await WriteFontConfigFile(fontsDirectory).ConfigureAwait(false); + }); } - - await WriteFontConfigFile(fontsDirectory).ConfigureAwait(false); } catch (HttpException ex) { @@ -230,8 +265,6 @@ namespace MediaBrowser.ServerApplication.FFMpeg // Don't let the server crash because of this _logger.ErrorException("Error writing ffmpeg font files", ex); } - - progress.Report(100); } /// @@ -325,19 +358,5 @@ namespace MediaBrowser.ServerApplication.FFMpeg } } } - - /// - /// Gets the media tools path. - /// - /// if set to true [create]. - /// System.String. - private string GetMediaToolsPath(bool create) - { - var path = Path.Combine(_appPaths.ProgramDataPath, "ffmpeg"); - - Directory.CreateDirectory(path); - - return path; - } } } diff --git a/MediaBrowser.ServerApplication/FFMpeg/FFMpegInfo.cs b/MediaBrowser.ServerApplication/FFMpeg/FFMpegInfo.cs index 147a9f771..1361277aa 100644 --- a/MediaBrowser.ServerApplication/FFMpeg/FFMpegInfo.cs +++ b/MediaBrowser.ServerApplication/FFMpeg/FFMpegInfo.cs @@ -9,7 +9,7 @@ /// Gets or sets the path. /// /// The path. - public string Path { get; set; } + public string EncoderPath { get; set; } /// /// Gets or sets the probe path. /// diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 4b9dad90a..3072413f9 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -217,6 +217,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/OpenSubtitlesHandler/OpenSubtitles.cs b/OpenSubtitlesHandler/OpenSubtitles.cs index ba3c461a1..5353586c8 100644 --- a/OpenSubtitlesHandler/OpenSubtitles.cs +++ b/OpenSubtitlesHandler/OpenSubtitles.cs @@ -20,6 +20,8 @@ using System; using System.Text; using System.Collections.Generic; using System.IO; +using System.Threading; +using System.Threading.Tasks; using OpenSubtitlesHandler.Console; using XmlRpcHandler; @@ -96,6 +98,56 @@ namespace OpenSubtitlesHandler } return new MethodResponseError("Fail", "Log in failed !"); } + + public static async Task LogInAsync(string userName, string password, string language, CancellationToken cancellationToken) + { + // Method call .. + List parms = new List(); + parms.Add(new XmlRpcValueBasic(userName)); + parms.Add(new XmlRpcValueBasic(password)); + parms.Add(new XmlRpcValueBasic(language)); + parms.Add(new XmlRpcValueBasic(XML_PRC_USERAGENT)); + XmlRpcMethodCall call = new XmlRpcMethodCall("LogIn", parms); + OSHConsole.WriteLine("Sending LogIn request to the server ...", DebugCode.Good); + + //File.WriteAllText(".\\request.txt", Encoding.UTF8.GetString(XmlRpcGenerator.Generate(call))); + // Send the request to the server + var stream = await Utilities.SendRequestAsync(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT, cancellationToken) + .ConfigureAwait(false); + + string response = Utilities.GetStreamString(stream); + + if (!response.Contains("ERROR:")) + { + // No error occur, get and decode the response. We expect Struct here. + XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response); + if (calls.Length > 0) + { + if (calls[0].Parameters.Count > 0) + { + XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + MethodResponseLogIn re = new MethodResponseLogIn("Success", "Log in successful."); + foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + { + switch (MEMBER.Name) + { + case "token": re.Token = TOKEN = MEMBER.Data.Data.ToString(); OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; + case "seconds": re.Seconds = (double)MEMBER.Data.Data; OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; + case "status": re.Status = MEMBER.Data.Data.ToString(); OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; + } + } + return re; + } + } + } + else + { + OSHConsole.WriteLine(response, DebugCode.Error); + return new MethodResponseError("Fail", response); + } + return new MethodResponseError("Fail", "Log in failed !"); + } + /// /// Log out from the server. Call this to terminate the session. /// diff --git a/OpenSubtitlesHandler/Utilities.cs b/OpenSubtitlesHandler/Utilities.cs index 5c72f4fde..7f0f93009 100644 --- a/OpenSubtitlesHandler/Utilities.cs +++ b/OpenSubtitlesHandler/Utilities.cs @@ -24,6 +24,7 @@ using System.IO; using System.IO.Compression; using System.Net; using System.Security.Cryptography; +using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Net; @@ -161,7 +162,7 @@ namespace OpenSubtitlesHandler /// Response of the server or stream of error message as string started with 'ERROR:' keyword. public static Stream SendRequest(byte[] request, string userAgent) { - return SendRequestAsync(request, userAgent).Result; + return SendRequestAsync(request, userAgent, CancellationToken.None).Result; //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(XML_RPC_SERVER); //req.ContentType = "text/xml"; @@ -190,16 +191,27 @@ namespace OpenSubtitlesHandler //} } - public static async Task SendRequestAsync(byte[] request, string userAgent) + public static async Task SendRequestAsync(byte[] request, string userAgent, CancellationToken cancellationToken) { var options = new HttpRequestOptions { RequestContentBytes = request, RequestContentType = "text/xml", - UserAgent = "xmlrpc-epi-php/0.2 (PHP)", - Url = XML_RPC_SERVER + UserAgent = userAgent, + Host = "api.opensubtitles.org:80", + Url = XML_RPC_SERVER, + + // Response parsing will fail with this enabled + EnableHttpCompression = false, + + CancellationToken = cancellationToken }; + if (string.IsNullOrEmpty(options.UserAgent)) + { + options.UserAgent = "xmlrpc-epi-php/0.2 (PHP)"; + } + var result = await HttpClient.Post(options).ConfigureAwait(false); return result.Content; -- cgit v1.2.3 From bb031f553b940d21fa89f319d294745484c2234e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 8 May 2014 16:26:20 -0400 Subject: fix portable and 3.5 project references --- .../MediaBrowser.Model.Portable.csproj | 299 +++++++++++++++- .../MediaBrowser.Model.net35.csproj | 292 +++++++++++++++- .../ApiClient/GeneralCommandEventArgs.cs | 23 ++ MediaBrowser.Model/ApiClient/ServerEventArgs.cs | 31 -- .../ApiClient/SessionUpdatesEventArgs.cs | 13 + MediaBrowser.Model/Channels/ChannelItemQuery.cs | 48 +++ MediaBrowser.Model/Channels/ChannelQuery.cs | 48 +-- MediaBrowser.Model/Configuration/AutoOrganize.cs | 40 --- .../Configuration/EncodingQuality.cs | 10 + MediaBrowser.Model/Configuration/ImageOption.cs | 29 ++ .../Configuration/ImageSavingConvention.cs | 8 + MediaBrowser.Model/Configuration/LiveTvOptions.cs | 7 + .../Configuration/MetadataOptions.cs | 25 -- MediaBrowser.Model/Configuration/MetadataPlugin.cs | 45 +-- .../Configuration/MetadataPluginSummary.cs | 32 ++ .../Configuration/MetadataPluginType.cs | 15 + .../Configuration/NotificationOption.cs | 54 +++ .../Configuration/NotificationOptions.cs | 76 ---- .../Configuration/NotificationType.cs | 19 + .../Configuration/PathSubstitution.cs | 8 + MediaBrowser.Model/Configuration/SendToUserType.cs | 9 + .../Configuration/ServerConfiguration.cs | 44 --- .../Configuration/SubtitleOptions.cs | 21 ++ .../Configuration/TvFileOrganizationOptions.cs | 40 +++ MediaBrowser.Model/Configuration/UnratedItem.cs | 16 + .../Configuration/UserConfiguration.cs | 14 - MediaBrowser.Model/Dlna/AudioOptions.cs | 33 ++ MediaBrowser.Model/Dlna/CodecProfile.cs | 52 --- MediaBrowser.Model/Dlna/CodecType.cs | 9 + MediaBrowser.Model/Dlna/DeviceIdentification.cs | 23 +- MediaBrowser.Model/Dlna/DeviceProfileInfo.cs | 6 - MediaBrowser.Model/Dlna/DeviceProfileType.cs | 8 + MediaBrowser.Model/Dlna/DirectPlayProfile.cs | 16 - MediaBrowser.Model/Dlna/DlnaFlags.cs | 21 ++ MediaBrowser.Model/Dlna/DlnaMaps.cs | 21 +- MediaBrowser.Model/Dlna/DlnaProfileType.cs | 9 + MediaBrowser.Model/Dlna/HeaderMatchType.cs | 9 + MediaBrowser.Model/Dlna/HttpHeaderInfo.cs | 16 + MediaBrowser.Model/Dlna/ProfileCondition.cs | 24 ++ MediaBrowser.Model/Dlna/ProfileConditionType.cs | 10 + MediaBrowser.Model/Dlna/ProfileConditionValue.cs | 19 + MediaBrowser.Model/Dlna/SearchCriteria.cs | 9 - MediaBrowser.Model/Dlna/SearchType.cs | 11 + MediaBrowser.Model/Dlna/StreamInfo.cs | 43 --- MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs | 8 + MediaBrowser.Model/Dlna/TranscodingProfile.cs | 6 - MediaBrowser.Model/Dlna/VideoOptions.cs | 17 + MediaBrowser.Model/Dlna/XmlAttribute.cs | 13 + MediaBrowser.Model/Drawing/DrawingUtils.cs | 83 +---- MediaBrowser.Model/Drawing/ImageSize.cs | 83 +++++ MediaBrowser.Model/Dto/IItemDto.cs | 6 - MediaBrowser.Model/Dto/MediaSourceInfo.cs | 42 +++ MediaBrowser.Model/Dto/MediaVersionInfo.cs | 42 --- MediaBrowser.Model/Dto/RatingType.cs | 8 + MediaBrowser.Model/Dto/RecommendationDto.cs | 15 - MediaBrowser.Model/Dto/RecommendationType.cs | 17 + MediaBrowser.Model/Dto/StreamOptions.cs | 112 ------ MediaBrowser.Model/Dto/SubtitleDownloadOptions.cs | 17 + MediaBrowser.Model/Dto/VideoStreamOptions.cs | 99 ++++++ MediaBrowser.Model/Entities/DisplayPreferences.cs | 30 -- MediaBrowser.Model/Entities/EmptyRequestResult.cs | 7 + MediaBrowser.Model/Entities/IHasProviderIds.cs | 101 +----- MediaBrowser.Model/Entities/IsoType.cs | 17 + MediaBrowser.Model/Entities/MediaInfo.cs | 26 ++ MediaBrowser.Model/Entities/MediaStream.cs | 48 +-- MediaBrowser.Model/Entities/MediaStreamType.cs | 25 ++ MediaBrowser.Model/Entities/MediaUrl.cs | 6 - MediaBrowser.Model/Entities/PackageReviewInfo.cs | 4 - .../Entities/ProviderIdsExtensions.cs | 103 ++++++ MediaBrowser.Model/Entities/RequestResult.cs | 7 - MediaBrowser.Model/Entities/ScrollDirection.cs | 17 + MediaBrowser.Model/Entities/SortOrder.cs | 17 + MediaBrowser.Model/Entities/VideoSize.cs | 8 + MediaBrowser.Model/Entities/VideoType.cs | 15 - .../EpisodeFileOrganizationRequest.cs | 17 + .../FileOrganization/FileOrganizationQuery.cs | 33 -- .../FileOrganization/FileOrganizationResult.cs | 14 - .../FileOrganizationResultQuery.cs | 18 + .../FileOrganization/FileOrganizerType.cs | 9 + .../FileOrganization/FileSortingStatus.cs | 9 + MediaBrowser.Model/Globalization/CountryInfo.cs | 6 - .../Globalization/LocalizatonOption.cs | 8 + MediaBrowser.Model/IO/FileSystemEntryInfo.cs | 23 -- MediaBrowser.Model/IO/FileSystemEntryType.cs | 25 ++ MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs | 108 ++++++ MediaBrowser.Model/LiveTv/DayPattern.cs | 9 + MediaBrowser.Model/LiveTv/GuideInfo.cs | 19 + MediaBrowser.Model/LiveTv/LiveTvInfo.cs | 49 +++ MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs | 139 +------- MediaBrowser.Model/LiveTv/LiveTvServiceStatus.cs | 8 + MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs | 66 ++++ MediaBrowser.Model/LiveTv/LiveTvTunerStatus.cs | 10 + MediaBrowser.Model/LiveTv/ProgramAudio.cs | 11 + MediaBrowser.Model/LiveTv/ProgramInfoDto.cs | 9 - MediaBrowser.Model/LiveTv/ProgramQuery.cs | 27 -- .../LiveTv/RecommendedProgramQuery.cs | 29 ++ MediaBrowser.Model/LiveTv/RecordingGroupQuery.cs | 11 + MediaBrowser.Model/LiveTv/RecordingQuery.cs | 43 +-- MediaBrowser.Model/LiveTv/RecordingStatus.cs | 7 - MediaBrowser.Model/LiveTv/SeriesTimerQuery.cs | 19 + MediaBrowser.Model/LiveTv/TimerInfoDto.cs | 108 +----- MediaBrowser.Model/LiveTv/TimerQuery.cs | 17 + MediaBrowser.Model/MediaBrowser.Model.csproj | 98 +++++- MediaBrowser.Model/MediaInfo/AudioCodec.cs | 8 + MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs | 7 - MediaBrowser.Model/MediaInfo/Constants.cs | 29 -- MediaBrowser.Model/MediaInfo/Container.cs | 8 + MediaBrowser.Model/MediaInfo/SubtitleFormat.cs | 7 + .../MediaInfo/TransportStreamTimestamp.cs | 9 + MediaBrowser.Model/MediaInfo/VideoCodec.cs | 12 + MediaBrowser.Model/News/NewsChannel.cs | 12 + MediaBrowser.Model/News/NewsItem.cs | 16 - MediaBrowser.Model/News/NewsQuery.cs | 9 + MediaBrowser.Model/Notifications/Notification.cs | 70 +--- .../Notifications/NotificationRequest.cs | 42 +++ .../Notifications/NotificationServiceInfo.cs | 8 + .../Notifications/NotificationTypeInfo.cs | 28 ++ MediaBrowser.Model/Providers/ExternalIdInfo.cs | 15 - MediaBrowser.Model/Providers/ExternalUrl.cs | 17 + MediaBrowser.Model/Providers/RemoteImageQuery.cs | 15 + MediaBrowser.Model/Providers/RemoteImageResult.cs | 12 - MediaBrowser.Model/Querying/AllThemeMediaResult.cs | 20 ++ MediaBrowser.Model/Querying/EpisodeQuery.cs | 20 -- MediaBrowser.Model/Querying/NextUpQuery.cs | 34 -- MediaBrowser.Model/Querying/SeasonQuery.cs | 22 ++ .../Querying/SimilarItemsByNameQuery.cs | 29 ++ MediaBrowser.Model/Querying/SimilarItemsQuery.cs | 27 -- MediaBrowser.Model/Querying/ThemeMediaResult.cs | 15 + MediaBrowser.Model/Querying/ThemeSongsResult.cs | 33 -- .../Querying/UpcomingEpisodesQuery.cs | 35 ++ MediaBrowser.Model/Session/ClientCapabilities.cs | 16 + MediaBrowser.Model/Session/GeneralCommand.cs | 36 -- MediaBrowser.Model/Session/GeneralCommandType.cs | 38 ++ MediaBrowser.Model/Session/PlayCommand.cs | 29 ++ MediaBrowser.Model/Session/PlayMethod.cs | 9 + MediaBrowser.Model/Session/PlayRequest.cs | 27 -- MediaBrowser.Model/Session/PlaybackProgressInfo.cs | 82 +++++ MediaBrowser.Model/Session/PlaybackReports.cs | 143 -------- MediaBrowser.Model/Session/PlaybackStartInfo.cs | 21 ++ MediaBrowser.Model/Session/PlaybackStopInfo.cs | 40 +++ MediaBrowser.Model/Session/PlayerStateInfo.cs | 59 ++++ MediaBrowser.Model/Session/PlaystateCommand.cs | 13 - MediaBrowser.Model/Session/PlaystateRequest.cs | 15 + MediaBrowser.Model/Session/SessionInfoDto.cs | 86 ----- MediaBrowser.Model/Session/SessionUserInfo.cs | 19 + MediaBrowser.Model/Themes/AppTheme.cs | 7 - MediaBrowser.Model/Themes/AppThemeInfo.cs | 9 + .../Collections/CollectionsDynamicFolder.cs | 27 -- .../Collections/ManualCollectionsFolder.cs | 31 ++ .../EntryPoints/Notifications/Notifications.cs | 381 +++++++++++++++++++++ .../EntryPoints/Notifications/Notifier.cs | 381 --------------------- .../HttpServer/DelReceiveWebRequest.cs | 6 + .../HttpServer/GetSwaggerResource.cs | 17 + .../HttpServer/HttpListenerHost.cs | 2 - .../HttpServer/ServerLogFactory.cs | 46 +++ .../HttpServer/ServerLogger.cs | 40 --- .../HttpServer/SwaggerService.cs | 14 - .../Library/Resolvers/BaseItemResolver.cs | 62 ---- .../Library/Resolvers/ItemResolver.cs | 62 ++++ .../Library/Validators/CountHelpers.cs | 171 --------- .../MediaBrowser.Server.Implementations.csproj | 10 +- .../Sorting/IsPlayedComparer.cs | 58 ++++ .../Sorting/IsUnplayedComparer.cs | 51 --- 163 files changed, 3386 insertions(+), 2734 deletions(-) create mode 100644 MediaBrowser.Model/ApiClient/GeneralCommandEventArgs.cs delete mode 100644 MediaBrowser.Model/ApiClient/ServerEventArgs.cs create mode 100644 MediaBrowser.Model/ApiClient/SessionUpdatesEventArgs.cs create mode 100644 MediaBrowser.Model/Channels/ChannelItemQuery.cs delete mode 100644 MediaBrowser.Model/Configuration/AutoOrganize.cs create mode 100644 MediaBrowser.Model/Configuration/EncodingQuality.cs create mode 100644 MediaBrowser.Model/Configuration/ImageOption.cs create mode 100644 MediaBrowser.Model/Configuration/ImageSavingConvention.cs create mode 100644 MediaBrowser.Model/Configuration/LiveTvOptions.cs create mode 100644 MediaBrowser.Model/Configuration/MetadataPluginSummary.cs create mode 100644 MediaBrowser.Model/Configuration/MetadataPluginType.cs create mode 100644 MediaBrowser.Model/Configuration/NotificationOption.cs create mode 100644 MediaBrowser.Model/Configuration/NotificationType.cs create mode 100644 MediaBrowser.Model/Configuration/PathSubstitution.cs create mode 100644 MediaBrowser.Model/Configuration/SendToUserType.cs create mode 100644 MediaBrowser.Model/Configuration/SubtitleOptions.cs create mode 100644 MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs create mode 100644 MediaBrowser.Model/Configuration/UnratedItem.cs create mode 100644 MediaBrowser.Model/Dlna/AudioOptions.cs create mode 100644 MediaBrowser.Model/Dlna/CodecType.cs create mode 100644 MediaBrowser.Model/Dlna/DeviceProfileType.cs create mode 100644 MediaBrowser.Model/Dlna/DlnaFlags.cs create mode 100644 MediaBrowser.Model/Dlna/DlnaProfileType.cs create mode 100644 MediaBrowser.Model/Dlna/HeaderMatchType.cs create mode 100644 MediaBrowser.Model/Dlna/HttpHeaderInfo.cs create mode 100644 MediaBrowser.Model/Dlna/ProfileCondition.cs create mode 100644 MediaBrowser.Model/Dlna/ProfileConditionType.cs create mode 100644 MediaBrowser.Model/Dlna/ProfileConditionValue.cs create mode 100644 MediaBrowser.Model/Dlna/SearchType.cs create mode 100644 MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs create mode 100644 MediaBrowser.Model/Dlna/VideoOptions.cs create mode 100644 MediaBrowser.Model/Dlna/XmlAttribute.cs create mode 100644 MediaBrowser.Model/Drawing/ImageSize.cs create mode 100644 MediaBrowser.Model/Dto/MediaSourceInfo.cs delete mode 100644 MediaBrowser.Model/Dto/MediaVersionInfo.cs create mode 100644 MediaBrowser.Model/Dto/RatingType.cs create mode 100644 MediaBrowser.Model/Dto/RecommendationType.cs create mode 100644 MediaBrowser.Model/Dto/SubtitleDownloadOptions.cs create mode 100644 MediaBrowser.Model/Dto/VideoStreamOptions.cs create mode 100644 MediaBrowser.Model/Entities/EmptyRequestResult.cs create mode 100644 MediaBrowser.Model/Entities/IsoType.cs create mode 100644 MediaBrowser.Model/Entities/MediaInfo.cs create mode 100644 MediaBrowser.Model/Entities/MediaStreamType.cs create mode 100644 MediaBrowser.Model/Entities/ProviderIdsExtensions.cs delete mode 100644 MediaBrowser.Model/Entities/RequestResult.cs create mode 100644 MediaBrowser.Model/Entities/ScrollDirection.cs create mode 100644 MediaBrowser.Model/Entities/SortOrder.cs create mode 100644 MediaBrowser.Model/Entities/VideoSize.cs create mode 100644 MediaBrowser.Model/FileOrganization/EpisodeFileOrganizationRequest.cs delete mode 100644 MediaBrowser.Model/FileOrganization/FileOrganizationQuery.cs create mode 100644 MediaBrowser.Model/FileOrganization/FileOrganizationResultQuery.cs create mode 100644 MediaBrowser.Model/FileOrganization/FileOrganizerType.cs create mode 100644 MediaBrowser.Model/FileOrganization/FileSortingStatus.cs create mode 100644 MediaBrowser.Model/Globalization/LocalizatonOption.cs create mode 100644 MediaBrowser.Model/IO/FileSystemEntryType.cs create mode 100644 MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs create mode 100644 MediaBrowser.Model/LiveTv/DayPattern.cs create mode 100644 MediaBrowser.Model/LiveTv/GuideInfo.cs create mode 100644 MediaBrowser.Model/LiveTv/LiveTvInfo.cs create mode 100644 MediaBrowser.Model/LiveTv/LiveTvServiceStatus.cs create mode 100644 MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs create mode 100644 MediaBrowser.Model/LiveTv/LiveTvTunerStatus.cs create mode 100644 MediaBrowser.Model/LiveTv/ProgramAudio.cs create mode 100644 MediaBrowser.Model/LiveTv/RecommendedProgramQuery.cs create mode 100644 MediaBrowser.Model/LiveTv/RecordingGroupQuery.cs create mode 100644 MediaBrowser.Model/LiveTv/SeriesTimerQuery.cs create mode 100644 MediaBrowser.Model/LiveTv/TimerQuery.cs create mode 100644 MediaBrowser.Model/MediaInfo/AudioCodec.cs delete mode 100644 MediaBrowser.Model/MediaInfo/Constants.cs create mode 100644 MediaBrowser.Model/MediaInfo/Container.cs create mode 100644 MediaBrowser.Model/MediaInfo/SubtitleFormat.cs create mode 100644 MediaBrowser.Model/MediaInfo/TransportStreamTimestamp.cs create mode 100644 MediaBrowser.Model/MediaInfo/VideoCodec.cs create mode 100644 MediaBrowser.Model/News/NewsChannel.cs create mode 100644 MediaBrowser.Model/News/NewsQuery.cs create mode 100644 MediaBrowser.Model/Notifications/NotificationRequest.cs create mode 100644 MediaBrowser.Model/Notifications/NotificationServiceInfo.cs create mode 100644 MediaBrowser.Model/Notifications/NotificationTypeInfo.cs create mode 100644 MediaBrowser.Model/Providers/ExternalUrl.cs create mode 100644 MediaBrowser.Model/Providers/RemoteImageQuery.cs create mode 100644 MediaBrowser.Model/Querying/AllThemeMediaResult.cs create mode 100644 MediaBrowser.Model/Querying/SeasonQuery.cs create mode 100644 MediaBrowser.Model/Querying/SimilarItemsByNameQuery.cs create mode 100644 MediaBrowser.Model/Querying/ThemeMediaResult.cs delete mode 100644 MediaBrowser.Model/Querying/ThemeSongsResult.cs create mode 100644 MediaBrowser.Model/Querying/UpcomingEpisodesQuery.cs create mode 100644 MediaBrowser.Model/Session/ClientCapabilities.cs create mode 100644 MediaBrowser.Model/Session/GeneralCommandType.cs create mode 100644 MediaBrowser.Model/Session/PlayCommand.cs create mode 100644 MediaBrowser.Model/Session/PlayMethod.cs create mode 100644 MediaBrowser.Model/Session/PlaybackProgressInfo.cs delete mode 100644 MediaBrowser.Model/Session/PlaybackReports.cs create mode 100644 MediaBrowser.Model/Session/PlaybackStartInfo.cs create mode 100644 MediaBrowser.Model/Session/PlaybackStopInfo.cs create mode 100644 MediaBrowser.Model/Session/PlayerStateInfo.cs create mode 100644 MediaBrowser.Model/Session/PlaystateRequest.cs create mode 100644 MediaBrowser.Model/Session/SessionUserInfo.cs create mode 100644 MediaBrowser.Model/Themes/AppThemeInfo.cs create mode 100644 MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs create mode 100644 MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs delete mode 100644 MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs create mode 100644 MediaBrowser.Server.Implementations/HttpServer/DelReceiveWebRequest.cs create mode 100644 MediaBrowser.Server.Implementations/HttpServer/GetSwaggerResource.cs create mode 100644 MediaBrowser.Server.Implementations/HttpServer/ServerLogFactory.cs delete mode 100644 MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs create mode 100644 MediaBrowser.Server.Implementations/Library/Resolvers/ItemResolver.cs delete mode 100644 MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs create mode 100644 MediaBrowser.Server.Implementations/Sorting/IsPlayedComparer.cs (limited to 'MediaBrowser.Server.Implementations/Library/Validators') diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index 7f8f4c325..57d265796 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -62,6 +62,9 @@ ApiClient\ApiClientExtensions.cs + + ApiClient\GeneralCommandEventArgs.cs + ApiClient\HttpResponseEventArgs.cs @@ -71,45 +74,93 @@ ApiClient\IServerEvents.cs - - ApiClient\ServerEventArgs.cs + + ApiClient\SessionUpdatesEventArgs.cs + + + Channels\ChannelItemQuery.cs Channels\ChannelQuery.cs - - Configuration\AutoOrganize.cs - Configuration\BaseApplicationConfiguration.cs Configuration\DlnaOptions.cs + + Configuration\EncodingQuality.cs + + + Configuration\ImageOption.cs + + + Configuration\ImageSavingConvention.cs + + + Configuration\LiveTvOptions.cs + Configuration\MetadataOptions.cs Configuration\MetadataPlugin.cs + + Configuration\MetadataPluginSummary.cs + + + Configuration\MetadataPluginType.cs + + + Configuration\NotificationOption.cs + Configuration\NotificationOptions.cs + + Configuration\NotificationType.cs + + + Configuration\PathSubstitution.cs + + + Configuration\SendToUserType.cs + Configuration\ServerConfiguration.cs + + Configuration\SubtitleOptions.cs + + + Configuration\TvFileOrganizationOptions.cs + + + Configuration\UnratedItem.cs + Configuration\UserConfiguration.cs + + Dlna\AudioOptions.cs + Dlna\CodecProfile.cs + + Dlna\CodecType.cs + Dlna\ConditionProcessor.cs Dlna\ContainerProfile.cs + + Dlna\ContentFeatureBuilder.cs + Dlna\DeviceIdentification.cs @@ -119,30 +170,57 @@ Dlna\DeviceProfileInfo.cs + + Dlna\DeviceProfileType.cs + Dlna\DirectPlayProfile.cs + + Dlna\DlnaFlags.cs + Dlna\DlnaMaps.cs + + Dlna\DlnaProfileType.cs + Dlna\EventSubscription.cs Dlna\Filter.cs + + Dlna\HeaderMatchType.cs + + + Dlna\HttpHeaderInfo.cs + Dlna\MediaFormatProfile.cs Dlna\MediaFormatProfileResolver.cs + + Dlna\ProfileCondition.cs + + + Dlna\ProfileConditionType.cs + + + Dlna\ProfileConditionValue.cs + Dlna\ResponseProfile.cs Dlna\SearchCriteria.cs + + Dlna\SearchType.cs + Dlna\SortCriteria.cs @@ -152,15 +230,27 @@ Dlna\StreamInfo.cs + + Dlna\TranscodeSeekInfo.cs + Dlna\TranscodingProfile.cs + + Dlna\VideoOptions.cs + + + Dlna\XmlAttribute.cs + Drawing\DrawingUtils.cs Drawing\ImageOutputFormat.cs + + Drawing\ImageSize.cs + Dto\BaseItemDto.cs @@ -191,24 +281,36 @@ Dto\ItemIndex.cs - - Dto\MediaVersionInfo.cs + + Dto\MediaSourceInfo.cs + + + Dto\RatingType.cs Dto\RecommendationDto.cs + + Dto\RecommendationType.cs + Dto\StreamOptions.cs Dto\StudioDto.cs + + Dto\SubtitleDownloadOptions.cs + Dto\UserDto.cs Dto\UserItemDataDto.cs + + Dto\VideoStreamOptions.cs + Entities\BaseItemInfo.cs @@ -221,12 +323,18 @@ Entities\DisplayPreferences.cs + + Entities\EmptyRequestResult.cs + Entities\IHasProviderIds.cs Entities\ImageType.cs + + Entities\IsoType.cs + Entities\ItemReview.cs @@ -239,9 +347,15 @@ Entities\MBRegistrationRecord.cs + + Entities\MediaInfo.cs + Entities\MediaStream.cs + + Entities\MediaStreamType.cs + Entities\MediaType.cs @@ -254,6 +368,9 @@ Entities\MetadataProviders.cs + + Entities\PackageReviewInfo.cs + Entities\ParentalRating.cs @@ -263,15 +380,27 @@ Entities\PluginSecurityInfo.cs - - Entities\RequestResult.cs + + Entities\ProviderIdsExtensions.cs + + + Entities\ScrollDirection.cs Entities\SeriesStatus.cs + + Entities\SortOrder.cs + + + Entities\UserDataSaveReason.cs + Entities\Video3DFormat.cs + + Entities\VideoSize.cs + Entities\VideoType.cs @@ -281,12 +410,21 @@ Events\GenericEventArgs.cs - - FileOrganization\FileOrganizationQuery.cs + + FileOrganization\EpisodeFileOrganizationRequest.cs FileOrganization\FileOrganizationResult.cs + + FileOrganization\FileOrganizationResultQuery.cs + + + FileOrganization\FileOrganizerType.cs + + + FileOrganization\FileSortingStatus.cs + Games\GameSystem.cs @@ -296,15 +434,33 @@ Globalization\CultureDto.cs + + Globalization\LocalizatonOption.cs + IO\FileSystemEntryInfo.cs + + IO\FileSystemEntryType.cs + + + IO\IIsoManager.cs + + + IO\IIsoMount.cs + + + IO\IIsoMounter.cs + IO\IZipClient.cs Library\PlayAccess.cs + + LiveTv\BaseTimerInfoDto.cs + LiveTv\ChannelInfoDto.cs @@ -314,18 +470,45 @@ LiveTv\ChannelType.cs + + LiveTv\DayPattern.cs + + + LiveTv\GuideInfo.cs + + + LiveTv\LiveTvInfo.cs + LiveTv\LiveTvServiceInfo.cs + + LiveTv\LiveTvServiceStatus.cs + + + LiveTv\LiveTvTunerInfoDto.cs + + + LiveTv\LiveTvTunerStatus.cs + + + LiveTv\ProgramAudio.cs + LiveTv\ProgramInfoDto.cs LiveTv\ProgramQuery.cs + + LiveTv\RecommendedProgramQuery.cs + LiveTv\RecordingGroupDto.cs + + LiveTv\RecordingGroupQuery.cs + LiveTv\RecordingInfoDto.cs @@ -338,9 +521,15 @@ LiveTv\SeriesTimerInfoDto.cs + + LiveTv\SeriesTimerQuery.cs + LiveTv\TimerInfoDto.cs + + LiveTv\TimerQuery.cs + Logging\ILogger.cs @@ -353,15 +542,27 @@ Logging\NullLogger.cs + + MediaInfo\AudioCodec.cs + MediaInfo\BlurayDiscInfo.cs - - MediaInfo\Constants.cs + + MediaInfo\Container.cs MediaInfo\IBlurayExaminer.cs + + MediaInfo\SubtitleFormat.cs + + + MediaInfo\TransportStreamTimestamp.cs + + + MediaInfo\VideoCodec.cs + Net\HttpException.cs @@ -380,9 +581,15 @@ Net\WebSocketState.cs + + News\NewsChannel.cs + News\NewsItem.cs + + News\NewsQuery.cs + Notifications\Notification.cs @@ -392,12 +599,21 @@ Notifications\NotificationQuery.cs + + Notifications\NotificationRequest.cs + Notifications\NotificationResult.cs + + Notifications\NotificationServiceInfo.cs + Notifications\NotificationsSummary.cs + + Notifications\NotificationTypeInfo.cs + Plugins\BasePluginConfiguration.cs @@ -407,12 +623,18 @@ Providers\ExternalIdInfo.cs + + Providers\ExternalUrl.cs + Providers\ImageProviderInfo.cs Providers\RemoteImageInfo.cs + + Providers\RemoteImageQuery.cs + Providers\RemoteImageResult.cs @@ -422,6 +644,9 @@ Providers\RemoteSubtitleInfo.cs + + Querying\AllThemeMediaResult.cs + Querying\ArtistsQuery.cs @@ -458,14 +683,23 @@ Querying\QueryResult.cs + + Querying\SeasonQuery.cs + Querying\SessionQuery.cs + + Querying\SimilarItemsByNameQuery.cs + Querying\SimilarItemsQuery.cs - - Querying\ThemeSongsResult.cs + + Querying\ThemeMediaResult.cs + + + Querying\UpcomingEpisodesQuery.cs Querying\UserQuery.cs @@ -488,14 +722,35 @@ Session\BrowseRequest.cs + + Session\ClientCapabilities.cs + Session\GeneralCommand.cs + + Session\GeneralCommandType.cs + Session\MessageCommand.cs - - Session\PlaybackReports.cs + + Session\PlaybackProgressInfo.cs + + + Session\PlaybackStartInfo.cs + + + Session\PlaybackStopInfo.cs + + + Session\PlayCommand.cs + + + Session\PlayerStateInfo.cs + + + Session\PlayMethod.cs Session\PlayRequest.cs @@ -503,12 +758,18 @@ Session\PlaystateCommand.cs + + Session\PlaystateRequest.cs + Session\SessionCapabilities.cs Session\SessionInfoDto.cs + + Session\SessionUserInfo.cs + Session\UserDataChangeInfo.cs @@ -536,6 +797,9 @@ Themes\AppTheme.cs + + Themes\AppThemeInfo.cs + Themes\ThemeImage.cs @@ -577,6 +841,7 @@ + if $(ConfigurationName) == Release ( diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index d65aef7f0..318a26b7c 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -52,51 +52,102 @@ + + ApiClient\GeneralCommandEventArgs.cs + ApiClient\HttpResponseEventArgs.cs ApiClient\IServerEvents.cs - - ApiClient\ServerEventArgs.cs + + ApiClient\SessionUpdatesEventArgs.cs + + + Channels\ChannelItemQuery.cs Channels\ChannelQuery.cs - - Configuration\AutoOrganize.cs - Configuration\BaseApplicationConfiguration.cs Configuration\DlnaOptions.cs + + Configuration\EncodingQuality.cs + + + Configuration\ImageOption.cs + + + Configuration\ImageSavingConvention.cs + + + Configuration\LiveTvOptions.cs + Configuration\MetadataOptions.cs Configuration\MetadataPlugin.cs + + Configuration\MetadataPluginSummary.cs + + + Configuration\MetadataPluginType.cs + + + Configuration\NotificationOption.cs + Configuration\NotificationOptions.cs + + Configuration\NotificationType.cs + + + Configuration\PathSubstitution.cs + + + Configuration\SendToUserType.cs + Configuration\ServerConfiguration.cs + + Configuration\SubtitleOptions.cs + + + Configuration\TvFileOrganizationOptions.cs + + + Configuration\UnratedItem.cs + Configuration\UserConfiguration.cs + + Dlna\AudioOptions.cs + Dlna\CodecProfile.cs + + Dlna\CodecType.cs + Dlna\ConditionProcessor.cs Dlna\ContainerProfile.cs + + Dlna\ContentFeatureBuilder.cs + Dlna\DeviceIdentification.cs @@ -106,30 +157,57 @@ Dlna\DeviceProfileInfo.cs + + Dlna\DeviceProfileType.cs + Dlna\DirectPlayProfile.cs + + Dlna\DlnaFlags.cs + Dlna\DlnaMaps.cs + + Dlna\DlnaProfileType.cs + Dlna\EventSubscription.cs Dlna\Filter.cs + + Dlna\HeaderMatchType.cs + + + Dlna\HttpHeaderInfo.cs + Dlna\MediaFormatProfile.cs Dlna\MediaFormatProfileResolver.cs + + Dlna\ProfileCondition.cs + + + Dlna\ProfileConditionType.cs + + + Dlna\ProfileConditionValue.cs + Dlna\ResponseProfile.cs Dlna\SearchCriteria.cs + + Dlna\SearchType.cs + Dlna\SortCriteria.cs @@ -139,15 +217,27 @@ Dlna\StreamInfo.cs + + Dlna\TranscodeSeekInfo.cs + Dlna\TranscodingProfile.cs + + Dlna\VideoOptions.cs + + + Dlna\XmlAttribute.cs + Drawing\DrawingUtils.cs Drawing\ImageOutputFormat.cs + + Drawing\ImageSize.cs + Dto\BaseItemDto.cs @@ -178,24 +268,36 @@ Dto\ItemIndex.cs - - Dto\MediaVersionInfo.cs + + Dto\MediaSourceInfo.cs + + + Dto\RatingType.cs Dto\RecommendationDto.cs + + Dto\RecommendationType.cs + Dto\StreamOptions.cs Dto\StudioDto.cs + + Dto\SubtitleDownloadOptions.cs + Dto\UserDto.cs Dto\UserItemDataDto.cs + + Dto\VideoStreamOptions.cs + Entities\BaseItemInfo.cs @@ -208,12 +310,18 @@ Entities\DisplayPreferences.cs + + Entities\EmptyRequestResult.cs + Entities\IHasProviderIds.cs Entities\ImageType.cs + + Entities\IsoType.cs + Entities\ItemReview.cs @@ -226,9 +334,15 @@ Entities\MBRegistrationRecord.cs + + Entities\MediaInfo.cs + Entities\MediaStream.cs + + Entities\MediaStreamType.cs + Entities\MediaType.cs @@ -241,6 +355,9 @@ Entities\MetadataProviders.cs + + Entities\PackageReviewInfo.cs + Entities\ParentalRating.cs @@ -250,15 +367,27 @@ Entities\PluginSecurityInfo.cs - - Entities\RequestResult.cs + + Entities\ProviderIdsExtensions.cs + + + Entities\ScrollDirection.cs Entities\SeriesStatus.cs + + Entities\SortOrder.cs + + + Entities\UserDataSaveReason.cs + Entities\Video3DFormat.cs + + Entities\VideoSize.cs + Entities\VideoType.cs @@ -268,12 +397,21 @@ Events\GenericEventArgs.cs - - FileOrganization\FileOrganizationQuery.cs + + FileOrganization\EpisodeFileOrganizationRequest.cs FileOrganization\FileOrganizationResult.cs + + FileOrganization\FileOrganizationResultQuery.cs + + + FileOrganization\FileOrganizerType.cs + + + FileOrganization\FileSortingStatus.cs + Games\GameSystem.cs @@ -283,15 +421,27 @@ Globalization\CultureDto.cs + + Globalization\LocalizatonOption.cs + IO\FileSystemEntryInfo.cs + + IO\FileSystemEntryType.cs + + + IO\IIsoMount.cs + IO\IZipClient.cs Library\PlayAccess.cs + + LiveTv\BaseTimerInfoDto.cs + LiveTv\ChannelInfoDto.cs @@ -301,18 +451,45 @@ LiveTv\ChannelType.cs + + LiveTv\DayPattern.cs + + + LiveTv\GuideInfo.cs + + + LiveTv\LiveTvInfo.cs + LiveTv\LiveTvServiceInfo.cs + + LiveTv\LiveTvServiceStatus.cs + + + LiveTv\LiveTvTunerInfoDto.cs + + + LiveTv\LiveTvTunerStatus.cs + + + LiveTv\ProgramAudio.cs + LiveTv\ProgramInfoDto.cs LiveTv\ProgramQuery.cs + + LiveTv\RecommendedProgramQuery.cs + LiveTv\RecordingGroupDto.cs + + LiveTv\RecordingGroupQuery.cs + LiveTv\RecordingInfoDto.cs @@ -325,9 +502,15 @@ LiveTv\SeriesTimerInfoDto.cs + + LiveTv\SeriesTimerQuery.cs + LiveTv\TimerInfoDto.cs + + LiveTv\TimerQuery.cs + Logging\ILogger.cs @@ -340,15 +523,27 @@ Logging\NullLogger.cs + + MediaInfo\AudioCodec.cs + MediaInfo\BlurayDiscInfo.cs - - MediaInfo\Constants.cs + + MediaInfo\Container.cs MediaInfo\IBlurayExaminer.cs + + MediaInfo\SubtitleFormat.cs + + + MediaInfo\TransportStreamTimestamp.cs + + + MediaInfo\VideoCodec.cs + Net\HttpException.cs @@ -367,9 +562,15 @@ Net\WebSocketState.cs + + News\NewsChannel.cs + News\NewsItem.cs + + News\NewsQuery.cs + Notifications\Notification.cs @@ -379,12 +580,21 @@ Notifications\NotificationQuery.cs + + Notifications\NotificationRequest.cs + Notifications\NotificationResult.cs + + Notifications\NotificationServiceInfo.cs + Notifications\NotificationsSummary.cs + + Notifications\NotificationTypeInfo.cs + Plugins\BasePluginConfiguration.cs @@ -394,12 +604,18 @@ Providers\ExternalIdInfo.cs + + Providers\ExternalUrl.cs + Providers\ImageProviderInfo.cs Providers\RemoteImageInfo.cs + + Providers\RemoteImageQuery.cs + Providers\RemoteImageResult.cs @@ -409,6 +625,9 @@ Providers\RemoteSubtitleInfo.cs + + Querying\AllThemeMediaResult.cs + Querying\ArtistsQuery.cs @@ -445,14 +664,23 @@ Querying\QueryResult.cs + + Querying\SeasonQuery.cs + Querying\SessionQuery.cs + + Querying\SimilarItemsByNameQuery.cs + Querying\SimilarItemsQuery.cs - - Querying\ThemeSongsResult.cs + + Querying\ThemeMediaResult.cs + + + Querying\UpcomingEpisodesQuery.cs Querying\UserQuery.cs @@ -475,14 +703,35 @@ Session\BrowseRequest.cs + + Session\ClientCapabilities.cs + Session\GeneralCommand.cs + + Session\GeneralCommandType.cs + Session\MessageCommand.cs - - Session\PlaybackReports.cs + + Session\PlaybackProgressInfo.cs + + + Session\PlaybackStartInfo.cs + + + Session\PlaybackStopInfo.cs + + + Session\PlayCommand.cs + + + Session\PlayerStateInfo.cs + + + Session\PlayMethod.cs Session\PlayRequest.cs @@ -490,12 +739,18 @@ Session\PlaystateCommand.cs + + Session\PlaystateRequest.cs + Session\SessionCapabilities.cs Session\SessionInfoDto.cs + + Session\SessionUserInfo.cs + Session\UserDataChangeInfo.cs @@ -523,6 +778,9 @@ Themes\AppTheme.cs + + Themes\AppThemeInfo.cs + Themes\ThemeImage.cs diff --git a/MediaBrowser.Model/ApiClient/GeneralCommandEventArgs.cs b/MediaBrowser.Model/ApiClient/GeneralCommandEventArgs.cs new file mode 100644 index 000000000..ce518a7cc --- /dev/null +++ b/MediaBrowser.Model/ApiClient/GeneralCommandEventArgs.cs @@ -0,0 +1,23 @@ +using MediaBrowser.Model.Session; +using System; + +namespace MediaBrowser.Model.ApiClient +{ + /// + /// Class SystemCommandEventArgs + /// + public class GeneralCommandEventArgs : EventArgs + { + /// + /// Gets or sets the command. + /// + /// The command. + public GeneralCommand Command { get; set; } + + /// + /// Gets or sets the type of the known command. + /// + /// The type of the known command. + public GeneralCommandType? KnownCommandType { get; set; } + } +} diff --git a/MediaBrowser.Model/ApiClient/ServerEventArgs.cs b/MediaBrowser.Model/ApiClient/ServerEventArgs.cs deleted file mode 100644 index ad0defe68..000000000 --- a/MediaBrowser.Model/ApiClient/ServerEventArgs.cs +++ /dev/null @@ -1,31 +0,0 @@ -using MediaBrowser.Model.Session; -using System; - -namespace MediaBrowser.Model.ApiClient -{ - /// - /// Class SystemCommandEventArgs - /// - public class GeneralCommandEventArgs : EventArgs - { - /// - /// Gets or sets the command. - /// - /// The command. - public GeneralCommand Command { get; set; } - - /// - /// Gets or sets the type of the known command. - /// - /// The type of the known command. - public GeneralCommandType? KnownCommandType { get; set; } - } - - /// - /// Class SessionUpdatesEventArgs - /// - public class SessionUpdatesEventArgs : EventArgs - { - public SessionInfoDto[] Sessions { get; set; } - } -} diff --git a/MediaBrowser.Model/ApiClient/SessionUpdatesEventArgs.cs b/MediaBrowser.Model/ApiClient/SessionUpdatesEventArgs.cs new file mode 100644 index 000000000..483ee45d0 --- /dev/null +++ b/MediaBrowser.Model/ApiClient/SessionUpdatesEventArgs.cs @@ -0,0 +1,13 @@ +using System; +using MediaBrowser.Model.Session; + +namespace MediaBrowser.Model.ApiClient +{ + /// + /// Class SessionUpdatesEventArgs + /// + public class SessionUpdatesEventArgs : EventArgs + { + public SessionInfoDto[] Sessions { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Channels/ChannelItemQuery.cs b/MediaBrowser.Model/Channels/ChannelItemQuery.cs new file mode 100644 index 000000000..2da955e88 --- /dev/null +++ b/MediaBrowser.Model/Channels/ChannelItemQuery.cs @@ -0,0 +1,48 @@ +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Querying; + +namespace MediaBrowser.Model.Channels +{ + public class ChannelItemQuery + { + /// + /// Gets or sets the channel identifier. + /// + /// The channel identifier. + public string ChannelId { get; set; } + + /// + /// Gets or sets the category identifier. + /// + /// The category identifier. + public string CategoryId { get; set; } + + /// + /// Gets or sets the user identifier. + /// + /// The user identifier. + public string UserId { get; set; } + + /// + /// Skips over a given number of items within the results. Use for paging. + /// + /// The start index. + public int? StartIndex { get; set; } + + /// + /// The maximum number of items to return + /// + /// The limit. + public int? Limit { get; set; } + + public SortOrder? SortOrder { get; set; } + public string[] SortBy { get; set; } + public ItemFilter[] Filters { get; set; } + + public ChannelItemQuery() + { + Filters = new ItemFilter[] { }; + SortBy = new string[] { }; + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Channels/ChannelQuery.cs b/MediaBrowser.Model/Channels/ChannelQuery.cs index e09769b00..7c3f76fda 100644 --- a/MediaBrowser.Model/Channels/ChannelQuery.cs +++ b/MediaBrowser.Model/Channels/ChannelQuery.cs @@ -1,7 +1,4 @@ -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Querying; - -namespace MediaBrowser.Model.Channels +namespace MediaBrowser.Model.Channels { public class ChannelQuery { @@ -23,47 +20,4 @@ namespace MediaBrowser.Model.Channels /// The limit. public int? Limit { get; set; } } - - public class ChannelItemQuery - { - /// - /// Gets or sets the channel identifier. - /// - /// The channel identifier. - public string ChannelId { get; set; } - - /// - /// Gets or sets the category identifier. - /// - /// The category identifier. - public string CategoryId { get; set; } - - /// - /// Gets or sets the user identifier. - /// - /// The user identifier. - public string UserId { get; set; } - - /// - /// Skips over a given number of items within the results. Use for paging. - /// - /// The start index. - public int? StartIndex { get; set; } - - /// - /// The maximum number of items to return - /// - /// The limit. - public int? Limit { get; set; } - - public SortOrder? SortOrder { get; set; } - public string[] SortBy { get; set; } - public ItemFilter[] Filters { get; set; } - - public ChannelItemQuery() - { - Filters = new ItemFilter[] { }; - SortBy = new string[] { }; - } - } } diff --git a/MediaBrowser.Model/Configuration/AutoOrganize.cs b/MediaBrowser.Model/Configuration/AutoOrganize.cs deleted file mode 100644 index fe32d4a80..000000000 --- a/MediaBrowser.Model/Configuration/AutoOrganize.cs +++ /dev/null @@ -1,40 +0,0 @@ - -namespace MediaBrowser.Model.Configuration -{ - public class TvFileOrganizationOptions - { - public bool IsEnabled { get; set; } - public int MinFileSizeMb { get; set; } - public string[] LeftOverFileExtensionsToDelete { get; set; } - public string[] WatchLocations { get; set; } - - public string SeasonFolderPattern { get; set; } - - public string SeasonZeroFolderName { get; set; } - - public string EpisodeNamePattern { get; set; } - public string MultiEpisodeNamePattern { get; set; } - - public bool OverwriteExistingEpisodes { get; set; } - - public bool DeleteEmptyFolders { get; set; } - - public bool CopyOriginalFile { get; set; } - - public TvFileOrganizationOptions() - { - MinFileSizeMb = 50; - - LeftOverFileExtensionsToDelete = new string[] { }; - - WatchLocations = new string[] { }; - - EpisodeNamePattern = "%sn - %sx%0e - %en.%ext"; - MultiEpisodeNamePattern = "%sn - %sx%0e-x%0ed - %en.%ext"; - SeasonFolderPattern = "Season %s"; - SeasonZeroFolderName = "Season 0"; - - CopyOriginalFile = false; - } - } -} diff --git a/MediaBrowser.Model/Configuration/EncodingQuality.cs b/MediaBrowser.Model/Configuration/EncodingQuality.cs new file mode 100644 index 000000000..ba5a1f279 --- /dev/null +++ b/MediaBrowser.Model/Configuration/EncodingQuality.cs @@ -0,0 +1,10 @@ +namespace MediaBrowser.Model.Configuration +{ + public enum EncodingQuality + { + Auto, + HighSpeed, + HighQuality, + MaxQuality + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/ImageOption.cs b/MediaBrowser.Model/Configuration/ImageOption.cs new file mode 100644 index 000000000..ade0af83e --- /dev/null +++ b/MediaBrowser.Model/Configuration/ImageOption.cs @@ -0,0 +1,29 @@ +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Model.Configuration +{ + public class ImageOption + { + /// + /// Gets or sets the type. + /// + /// The type. + public ImageType Type { get; set; } + /// + /// Gets or sets the limit. + /// + /// The limit. + public int Limit { get; set; } + + /// + /// Gets or sets the minimum width. + /// + /// The minimum width. + public int MinWidth { get; set; } + + public ImageOption() + { + Limit = 1; + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/ImageSavingConvention.cs b/MediaBrowser.Model/Configuration/ImageSavingConvention.cs new file mode 100644 index 000000000..611678e67 --- /dev/null +++ b/MediaBrowser.Model/Configuration/ImageSavingConvention.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.Configuration +{ + public enum ImageSavingConvention + { + Legacy, + Compatible + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/LiveTvOptions.cs b/MediaBrowser.Model/Configuration/LiveTvOptions.cs new file mode 100644 index 000000000..ae8aeb200 --- /dev/null +++ b/MediaBrowser.Model/Configuration/LiveTvOptions.cs @@ -0,0 +1,7 @@ +namespace MediaBrowser.Model.Configuration +{ + public class LiveTvOptions + { + public int? GuideDays { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/MetadataOptions.cs b/MediaBrowser.Model/Configuration/MetadataOptions.cs index 7b2bcc178..88fa486f9 100644 --- a/MediaBrowser.Model/Configuration/MetadataOptions.cs +++ b/MediaBrowser.Model/Configuration/MetadataOptions.cs @@ -74,29 +74,4 @@ namespace MediaBrowser.Model.Configuration return !DisabledMetadataSavers.Contains(name, StringComparer.OrdinalIgnoreCase); } } - - public class ImageOption - { - /// - /// Gets or sets the type. - /// - /// The type. - public ImageType Type { get; set; } - /// - /// Gets or sets the limit. - /// - /// The limit. - public int Limit { get; set; } - - /// - /// Gets or sets the minimum width. - /// - /// The minimum width. - public int MinWidth { get; set; } - - public ImageOption() - { - Limit = 1; - } - } } diff --git a/MediaBrowser.Model/Configuration/MetadataPlugin.cs b/MediaBrowser.Model/Configuration/MetadataPlugin.cs index b019cf71a..f3e0ce106 100644 --- a/MediaBrowser.Model/Configuration/MetadataPlugin.cs +++ b/MediaBrowser.Model/Configuration/MetadataPlugin.cs @@ -1,7 +1,4 @@ -using MediaBrowser.Model.Entities; -using System.Collections.Generic; - -namespace MediaBrowser.Model.Configuration +namespace MediaBrowser.Model.Configuration { public class MetadataPlugin { @@ -17,44 +14,4 @@ namespace MediaBrowser.Model.Configuration /// The type. public MetadataPluginType Type { get; set; } } - - public class MetadataPluginSummary - { - /// - /// Gets or sets the type of the item. - /// - /// The type of the item. - public string ItemType { get; set; } - - /// - /// Gets or sets the plugins. - /// - /// The plugins. - public List Plugins { get; set; } - - /// - /// Gets or sets the supported image types. - /// - /// The supported image types. - public List SupportedImageTypes { get; set; } - - public MetadataPluginSummary() - { - SupportedImageTypes = new List(); - Plugins = new List(); - } - } - - /// - /// Enum MetadataPluginType - /// - public enum MetadataPluginType - { - LocalImageProvider, - ImageFetcher, - ImageSaver, - LocalMetadataProvider, - MetadataFetcher, - MetadataSaver - } } diff --git a/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs b/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs new file mode 100644 index 000000000..90b3933eb --- /dev/null +++ b/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Model.Configuration +{ + public class MetadataPluginSummary + { + /// + /// Gets or sets the type of the item. + /// + /// The type of the item. + public string ItemType { get; set; } + + /// + /// Gets or sets the plugins. + /// + /// The plugins. + public List Plugins { get; set; } + + /// + /// Gets or sets the supported image types. + /// + /// The supported image types. + public List SupportedImageTypes { get; set; } + + public MetadataPluginSummary() + { + SupportedImageTypes = new List(); + Plugins = new List(); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/MetadataPluginType.cs b/MediaBrowser.Model/Configuration/MetadataPluginType.cs new file mode 100644 index 000000000..95ca3b2e6 --- /dev/null +++ b/MediaBrowser.Model/Configuration/MetadataPluginType.cs @@ -0,0 +1,15 @@ +namespace MediaBrowser.Model.Configuration +{ + /// + /// Enum MetadataPluginType + /// + public enum MetadataPluginType + { + LocalImageProvider, + ImageFetcher, + ImageSaver, + LocalMetadataProvider, + MetadataFetcher, + MetadataSaver + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/NotificationOption.cs b/MediaBrowser.Model/Configuration/NotificationOption.cs new file mode 100644 index 000000000..5fcf3550c --- /dev/null +++ b/MediaBrowser.Model/Configuration/NotificationOption.cs @@ -0,0 +1,54 @@ +namespace MediaBrowser.Model.Configuration +{ + public class NotificationOption + { + public string Type { get; set; } + + /// + /// User Ids to not monitor (it's opt out) + /// + public string[] DisabledMonitorUsers { get; set; } + + /// + /// User Ids to send to (if SendToUserMode == Custom) + /// + public string[] SendToUsers { get; set; } + + /// + /// Gets or sets a value indicating whether this is enabled. + /// + /// true if enabled; otherwise, false. + public bool Enabled { get; set; } + + /// + /// Gets or sets the title format string. + /// + /// The title format string. + public string Title { get; set; } + + /// + /// Gets or sets the description. + /// + /// The description. + public string Description { get; set; } + + /// + /// Gets or sets the disabled services. + /// + /// The disabled services. + public string[] DisabledServices { get; set; } + + /// + /// Gets or sets the send to user mode. + /// + /// The send to user mode. + public SendToUserType SendToUserMode { get; set; } + + public NotificationOption() + { + DisabledServices = new string[] { }; + DisabledMonitorUsers = new string[] { }; + SendToUsers = new string[] { }; + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/NotificationOptions.cs b/MediaBrowser.Model/Configuration/NotificationOptions.cs index fedc1c2f8..7034bd39e 100644 --- a/MediaBrowser.Model/Configuration/NotificationOptions.cs +++ b/MediaBrowser.Model/Configuration/NotificationOptions.cs @@ -118,80 +118,4 @@ namespace MediaBrowser.Model.Configuration return false; } } - - public class NotificationOption - { - public string Type { get; set; } - - /// - /// User Ids to not monitor (it's opt out) - /// - public string[] DisabledMonitorUsers { get; set; } - - /// - /// User Ids to send to (if SendToUserMode == Custom) - /// - public string[] SendToUsers { get; set; } - - /// - /// Gets or sets a value indicating whether this is enabled. - /// - /// true if enabled; otherwise, false. - public bool Enabled { get; set; } - - /// - /// Gets or sets the title format string. - /// - /// The title format string. - public string Title { get; set; } - - /// - /// Gets or sets the description. - /// - /// The description. - public string Description { get; set; } - - /// - /// Gets or sets the disabled services. - /// - /// The disabled services. - public string[] DisabledServices { get; set; } - - /// - /// Gets or sets the send to user mode. - /// - /// The send to user mode. - public SendToUserType SendToUserMode { get; set; } - - public NotificationOption() - { - DisabledServices = new string[] { }; - DisabledMonitorUsers = new string[] { }; - SendToUsers = new string[] { }; - } - } - - public enum NotificationType - { - ApplicationUpdateAvailable, - ApplicationUpdateInstalled, - AudioPlayback, - GamePlayback, - InstallationFailed, - PluginError, - PluginInstalled, - PluginUpdateInstalled, - PluginUninstalled, - NewLibraryContent, - ServerRestartRequired, - TaskFailed, - VideoPlayback - } - - public enum SendToUserType - { - All = 0, - Admins = 1, - Custom = 2 - } } diff --git a/MediaBrowser.Model/Configuration/NotificationType.cs b/MediaBrowser.Model/Configuration/NotificationType.cs new file mode 100644 index 000000000..eaafb651c --- /dev/null +++ b/MediaBrowser.Model/Configuration/NotificationType.cs @@ -0,0 +1,19 @@ +namespace MediaBrowser.Model.Configuration +{ + public enum NotificationType + { + ApplicationUpdateAvailable, + ApplicationUpdateInstalled, + AudioPlayback, + GamePlayback, + InstallationFailed, + PluginError, + PluginInstalled, + PluginUpdateInstalled, + PluginUninstalled, + NewLibraryContent, + ServerRestartRequired, + TaskFailed, + VideoPlayback + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/PathSubstitution.cs b/MediaBrowser.Model/Configuration/PathSubstitution.cs new file mode 100644 index 000000000..576dd2d5a --- /dev/null +++ b/MediaBrowser.Model/Configuration/PathSubstitution.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.Configuration +{ + public class PathSubstitution + { + public string From { get; set; } + public string To { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/SendToUserType.cs b/MediaBrowser.Model/Configuration/SendToUserType.cs new file mode 100644 index 000000000..a2eac4c2d --- /dev/null +++ b/MediaBrowser.Model/Configuration/SendToUserType.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.Configuration +{ + public enum SendToUserType + { + All = 0, + Admins = 1, + Custom = 2 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index b2c499b9a..36598b245 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -290,48 +290,4 @@ namespace MediaBrowser.Model.Configuration SubtitleOptions = new SubtitleOptions(); } } - - public enum ImageSavingConvention - { - Legacy, - Compatible - } - - public enum EncodingQuality - { - Auto, - HighSpeed, - HighQuality, - MaxQuality - } - - public class LiveTvOptions - { - public int? GuideDays { get; set; } - } - - public class PathSubstitution - { - public string From { get; set; } - public string To { get; set; } - } - - public class SubtitleOptions - { - public bool SkipIfGraphicalSubtitlesPresent { get; set; } - public bool SkipIfAudioTrackMatches { get; set; } - public string[] DownloadLanguages { get; set; } - public bool DownloadMovieSubtitles { get; set; } - public bool DownloadEpisodeSubtitles { get; set; } - - public string OpenSubtitlesUsername { get; set; } - public string OpenSubtitlesPasswordHash { get; set; } - - public SubtitleOptions() - { - DownloadLanguages = new string[] { }; - - SkipIfAudioTrackMatches = true; - } - } } diff --git a/MediaBrowser.Model/Configuration/SubtitleOptions.cs b/MediaBrowser.Model/Configuration/SubtitleOptions.cs new file mode 100644 index 000000000..96e04e511 --- /dev/null +++ b/MediaBrowser.Model/Configuration/SubtitleOptions.cs @@ -0,0 +1,21 @@ +namespace MediaBrowser.Model.Configuration +{ + public class SubtitleOptions + { + public bool SkipIfGraphicalSubtitlesPresent { get; set; } + public bool SkipIfAudioTrackMatches { get; set; } + public string[] DownloadLanguages { get; set; } + public bool DownloadMovieSubtitles { get; set; } + public bool DownloadEpisodeSubtitles { get; set; } + + public string OpenSubtitlesUsername { get; set; } + public string OpenSubtitlesPasswordHash { get; set; } + + public SubtitleOptions() + { + DownloadLanguages = new string[] { }; + + SkipIfAudioTrackMatches = true; + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs b/MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs new file mode 100644 index 000000000..fe32d4a80 --- /dev/null +++ b/MediaBrowser.Model/Configuration/TvFileOrganizationOptions.cs @@ -0,0 +1,40 @@ + +namespace MediaBrowser.Model.Configuration +{ + public class TvFileOrganizationOptions + { + public bool IsEnabled { get; set; } + public int MinFileSizeMb { get; set; } + public string[] LeftOverFileExtensionsToDelete { get; set; } + public string[] WatchLocations { get; set; } + + public string SeasonFolderPattern { get; set; } + + public string SeasonZeroFolderName { get; set; } + + public string EpisodeNamePattern { get; set; } + public string MultiEpisodeNamePattern { get; set; } + + public bool OverwriteExistingEpisodes { get; set; } + + public bool DeleteEmptyFolders { get; set; } + + public bool CopyOriginalFile { get; set; } + + public TvFileOrganizationOptions() + { + MinFileSizeMb = 50; + + LeftOverFileExtensionsToDelete = new string[] { }; + + WatchLocations = new string[] { }; + + EpisodeNamePattern = "%sn - %sx%0e - %en.%ext"; + MultiEpisodeNamePattern = "%sn - %sx%0e-x%0ed - %en.%ext"; + SeasonFolderPattern = "Season %s"; + SeasonZeroFolderName = "Season 0"; + + CopyOriginalFile = false; + } + } +} diff --git a/MediaBrowser.Model/Configuration/UnratedItem.cs b/MediaBrowser.Model/Configuration/UnratedItem.cs new file mode 100644 index 000000000..1082d684b --- /dev/null +++ b/MediaBrowser.Model/Configuration/UnratedItem.cs @@ -0,0 +1,16 @@ +namespace MediaBrowser.Model.Configuration +{ + public enum UnratedItem + { + Movie, + Trailer, + Series, + Music, + Game, + Book, + LiveTvChannel, + LiveTvProgram, + ChannelContent, + Other + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs index f8df19436..2658e8973 100644 --- a/MediaBrowser.Model/Configuration/UserConfiguration.cs +++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs @@ -79,18 +79,4 @@ namespace MediaBrowser.Model.Configuration BlockUnratedItems = new UnratedItem[] { }; } } - - public enum UnratedItem - { - Movie, - Trailer, - Series, - Music, - Game, - Book, - LiveTvChannel, - LiveTvProgram, - ChannelContent, - Other - } } diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.cs new file mode 100644 index 000000000..d04133a3d --- /dev/null +++ b/MediaBrowser.Model/Dlna/AudioOptions.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using MediaBrowser.Model.Dto; + +namespace MediaBrowser.Model.Dlna +{ + /// + /// Class AudioOptions. + /// + public class AudioOptions + { + public string ItemId { get; set; } + public List MediaSources { get; set; } + public DeviceProfile Profile { get; set; } + + /// + /// Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex are requested. + /// + public string MediaSourceId { get; set; } + + public string DeviceId { get; set; } + + /// + /// Allows an override of supported number of audio channels + /// Example: DeviceProfile supports five channel, but user only has stereo speakers + /// + public int? MaxAudioChannels { get; set; } + + /// + /// The application's configured quality setting + /// + public int? MaxBitrate { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/CodecProfile.cs b/MediaBrowser.Model/Dlna/CodecProfile.cs index 2b04b7fdb..7d7e0057e 100644 --- a/MediaBrowser.Model/Dlna/CodecProfile.cs +++ b/MediaBrowser.Model/Dlna/CodecProfile.cs @@ -32,56 +32,4 @@ namespace MediaBrowser.Model.Dlna return codecs.Count == 0 || codecs.Contains(codec, StringComparer.OrdinalIgnoreCase); } } - - public enum CodecType - { - Video = 0, - VideoAudio = 1, - Audio = 2 - } - - public class ProfileCondition - { - [XmlAttribute("condition")] - public ProfileConditionType Condition { get; set; } - - [XmlAttribute("property")] - public ProfileConditionValue Property { get; set; } - - [XmlAttribute("value")] - public string Value { get; set; } - - [XmlAttribute("isRequired")] - public bool IsRequired { get; set; } - - public ProfileCondition() - { - IsRequired = true; - } - } - - public enum ProfileConditionType - { - Equals = 0, - NotEquals = 1, - LessThanEqual = 2, - GreaterThanEqual = 3 - } - - public enum ProfileConditionValue - { - AudioChannels, - AudioBitrate, - AudioProfile, - Width, - Height, - Has64BitOffsets, - PacketLength, - VideoBitDepth, - VideoBitrate, - VideoFramerate, - VideoLevel, - VideoProfile, - VideoTimestamp - } } diff --git a/MediaBrowser.Model/Dlna/CodecType.cs b/MediaBrowser.Model/Dlna/CodecType.cs new file mode 100644 index 000000000..415cae7ac --- /dev/null +++ b/MediaBrowser.Model/Dlna/CodecType.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.Dlna +{ + public enum CodecType + { + Video = 0, + VideoAudio = 1, + Audio = 2 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/DeviceIdentification.cs b/MediaBrowser.Model/Dlna/DeviceIdentification.cs index 87cf000b1..97f4409da 100644 --- a/MediaBrowser.Model/Dlna/DeviceIdentification.cs +++ b/MediaBrowser.Model/Dlna/DeviceIdentification.cs @@ -1,6 +1,4 @@ -using System.Xml.Serialization; - -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public class DeviceIdentification { @@ -60,23 +58,4 @@ namespace MediaBrowser.Model.Dlna Headers = new HttpHeaderInfo[] {}; } } - - public class HttpHeaderInfo - { - [XmlAttribute("name")] - public string Name { get; set; } - - [XmlAttribute("value")] - public string Value { get; set; } - - [XmlAttribute("match")] - public HeaderMatchType Match { get; set; } - } - - public enum HeaderMatchType - { - Equals = 0, - Regex = 1, - Substring = 2 - } } diff --git a/MediaBrowser.Model/Dlna/DeviceProfileInfo.cs b/MediaBrowser.Model/Dlna/DeviceProfileInfo.cs index ceb27386c..b2afdf292 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfileInfo.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfileInfo.cs @@ -21,10 +21,4 @@ namespace MediaBrowser.Model.Dlna /// The type. public DeviceProfileType Type { get; set; } } - - public enum DeviceProfileType - { - System = 0, - User = 1 - } } diff --git a/MediaBrowser.Model/Dlna/DeviceProfileType.cs b/MediaBrowser.Model/Dlna/DeviceProfileType.cs new file mode 100644 index 000000000..f881a4539 --- /dev/null +++ b/MediaBrowser.Model/Dlna/DeviceProfileType.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.Dlna +{ + public enum DeviceProfileType + { + System = 0, + User = 1 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs b/MediaBrowser.Model/Dlna/DirectPlayProfile.cs index e195c9450..5cfcafca4 100644 --- a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs +++ b/MediaBrowser.Model/Dlna/DirectPlayProfile.cs @@ -33,20 +33,4 @@ namespace MediaBrowser.Model.Dlna return (VideoCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList(); } } - - public class XmlAttribute - { - [XmlAttribute("name")] - public string Name { get; set; } - - [XmlAttribute("value")] - public string Value { get; set; } - } - - public enum DlnaProfileType - { - Audio = 0, - Video = 1, - Photo = 2 - } } diff --git a/MediaBrowser.Model/Dlna/DlnaFlags.cs b/MediaBrowser.Model/Dlna/DlnaFlags.cs new file mode 100644 index 000000000..23859312d --- /dev/null +++ b/MediaBrowser.Model/Dlna/DlnaFlags.cs @@ -0,0 +1,21 @@ +using System; + +namespace MediaBrowser.Model.Dlna +{ + [Flags] + public enum DlnaFlags : ulong + { + BackgroundTransferMode = (1 << 22), + ByteBasedSeek = (1 << 29), + ConnectionStall = (1 << 21), + DlnaV15 = (1 << 20), + InteractiveTransferMode = (1 << 23), + PlayContainer = (1 << 28), + RtspPause = (1 << 25), + S0Increase = (1 << 27), + SenderPaced = (1L << 31), + SnIncrease = (1 << 26), + StreamingTransferMode = (1 << 24), + TimeBasedSeek = (1 << 30) + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/DlnaMaps.cs b/MediaBrowser.Model/Dlna/DlnaMaps.cs index d2871474a..0a4069d8f 100644 --- a/MediaBrowser.Model/Dlna/DlnaMaps.cs +++ b/MediaBrowser.Model/Dlna/DlnaMaps.cs @@ -1,6 +1,4 @@ -using System; - -namespace MediaBrowser.Model.Dlna +namespace MediaBrowser.Model.Dlna { public class DlnaMaps { @@ -55,21 +53,4 @@ namespace MediaBrowser.Model.Dlna return orgOp; } } - - [Flags] - public enum DlnaFlags : ulong - { - BackgroundTransferMode = (1 << 22), - ByteBasedSeek = (1 << 29), - ConnectionStall = (1 << 21), - DlnaV15 = (1 << 20), - InteractiveTransferMode = (1 << 23), - PlayContainer = (1 << 28), - RtspPause = (1 << 25), - S0Increase = (1 << 27), - SenderPaced = (1L << 31), - SnIncrease = (1 << 26), - StreamingTransferMode = (1 << 24), - TimeBasedSeek = (1 << 30) - } } diff --git a/MediaBrowser.Model/Dlna/DlnaProfileType.cs b/MediaBrowser.Model/Dlna/DlnaProfileType.cs new file mode 100644 index 000000000..1bad14081 --- /dev/null +++ b/MediaBrowser.Model/Dlna/DlnaProfileType.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.Dlna +{ + public enum DlnaProfileType + { + Audio = 0, + Video = 1, + Photo = 2 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/HeaderMatchType.cs b/MediaBrowser.Model/Dlna/HeaderMatchType.cs new file mode 100644 index 000000000..7a0d5c24f --- /dev/null +++ b/MediaBrowser.Model/Dlna/HeaderMatchType.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.Dlna +{ + public enum HeaderMatchType + { + Equals = 0, + Regex = 1, + Substring = 2 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/HttpHeaderInfo.cs b/MediaBrowser.Model/Dlna/HttpHeaderInfo.cs new file mode 100644 index 000000000..926963ef6 --- /dev/null +++ b/MediaBrowser.Model/Dlna/HttpHeaderInfo.cs @@ -0,0 +1,16 @@ +using System.Xml.Serialization; + +namespace MediaBrowser.Model.Dlna +{ + public class HttpHeaderInfo + { + [XmlAttribute("name")] + public string Name { get; set; } + + [XmlAttribute("value")] + public string Value { get; set; } + + [XmlAttribute("match")] + public HeaderMatchType Match { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/ProfileCondition.cs b/MediaBrowser.Model/Dlna/ProfileCondition.cs new file mode 100644 index 000000000..24733426c --- /dev/null +++ b/MediaBrowser.Model/Dlna/ProfileCondition.cs @@ -0,0 +1,24 @@ +using System.Xml.Serialization; + +namespace MediaBrowser.Model.Dlna +{ + public class ProfileCondition + { + [XmlAttribute("condition")] + public ProfileConditionType Condition { get; set; } + + [XmlAttribute("property")] + public ProfileConditionValue Property { get; set; } + + [XmlAttribute("value")] + public string Value { get; set; } + + [XmlAttribute("isRequired")] + public bool IsRequired { get; set; } + + public ProfileCondition() + { + IsRequired = true; + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/ProfileConditionType.cs b/MediaBrowser.Model/Dlna/ProfileConditionType.cs new file mode 100644 index 000000000..22156c47d --- /dev/null +++ b/MediaBrowser.Model/Dlna/ProfileConditionType.cs @@ -0,0 +1,10 @@ +namespace MediaBrowser.Model.Dlna +{ + public enum ProfileConditionType + { + Equals = 0, + NotEquals = 1, + LessThanEqual = 2, + GreaterThanEqual = 3 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs new file mode 100644 index 000000000..56a322f5a --- /dev/null +++ b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs @@ -0,0 +1,19 @@ +namespace MediaBrowser.Model.Dlna +{ + public enum ProfileConditionValue + { + AudioChannels, + AudioBitrate, + AudioProfile, + Width, + Height, + Has64BitOffsets, + PacketLength, + VideoBitDepth, + VideoBitrate, + VideoFramerate, + VideoLevel, + VideoProfile, + VideoTimestamp + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/SearchCriteria.cs b/MediaBrowser.Model/Dlna/SearchCriteria.cs index d3f8b8332..bb4221b51 100644 --- a/MediaBrowser.Model/Dlna/SearchCriteria.cs +++ b/MediaBrowser.Model/Dlna/SearchCriteria.cs @@ -37,13 +37,4 @@ namespace MediaBrowser.Model.Dlna } } } - - public enum SearchType - { - Unknown = 0, - Audio = 1, - Image = 2, - Video = 3, - Playlist = 4 - } } diff --git a/MediaBrowser.Model/Dlna/SearchType.cs b/MediaBrowser.Model/Dlna/SearchType.cs new file mode 100644 index 000000000..68c047603 --- /dev/null +++ b/MediaBrowser.Model/Dlna/SearchType.cs @@ -0,0 +1,11 @@ +namespace MediaBrowser.Model.Dlna +{ + public enum SearchType + { + Unknown = 0, + Audio = 1, + Image = 2, + Video = 3, + Playlist = 4 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index ae9806f97..9af3689b2 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -403,47 +403,4 @@ namespace MediaBrowser.Model.Dlna } } } - - /// - /// Class AudioOptions. - /// - public class AudioOptions - { - public string ItemId { get; set; } - public List MediaSources { get; set; } - public DeviceProfile Profile { get; set; } - - /// - /// Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex are requested. - /// - public string MediaSourceId { get; set; } - - public string DeviceId { get; set; } - - /// - /// Allows an override of supported number of audio channels - /// Example: DeviceProfile supports five channel, but user only has stereo speakers - /// - public int? MaxAudioChannels { get; set; } - - /// - /// The application's configured quality setting - /// - public int? MaxBitrate { get; set; } - } - - /// - /// Class VideoOptions. - /// - public class VideoOptions : AudioOptions - { - public int? AudioStreamIndex { get; set; } - public int? SubtitleStreamIndex { get; set; } - public int? MaxAudioTranscodingBitrate { get; set; } - - public VideoOptions() - { - MaxAudioTranscodingBitrate = 128000; - } - } } diff --git a/MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs b/MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs new file mode 100644 index 000000000..564ce5c60 --- /dev/null +++ b/MediaBrowser.Model/Dlna/TranscodeSeekInfo.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.Dlna +{ + public enum TranscodeSeekInfo + { + Auto = 0, + Bytes = 1 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/TranscodingProfile.cs b/MediaBrowser.Model/Dlna/TranscodingProfile.cs index ba02e9be2..162d62718 100644 --- a/MediaBrowser.Model/Dlna/TranscodingProfile.cs +++ b/MediaBrowser.Model/Dlna/TranscodingProfile.cs @@ -38,10 +38,4 @@ namespace MediaBrowser.Model.Dlna return (AudioCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrEmpty(i)).ToList(); } } - - public enum TranscodeSeekInfo - { - Auto = 0, - Bytes = 1 - } } diff --git a/MediaBrowser.Model/Dlna/VideoOptions.cs b/MediaBrowser.Model/Dlna/VideoOptions.cs new file mode 100644 index 000000000..39a5ab1b1 --- /dev/null +++ b/MediaBrowser.Model/Dlna/VideoOptions.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Dlna +{ + /// + /// Class VideoOptions. + /// + public class VideoOptions : AudioOptions + { + public int? AudioStreamIndex { get; set; } + public int? SubtitleStreamIndex { get; set; } + public int? MaxAudioTranscodingBitrate { get; set; } + + public VideoOptions() + { + MaxAudioTranscodingBitrate = 128000; + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/XmlAttribute.cs b/MediaBrowser.Model/Dlna/XmlAttribute.cs new file mode 100644 index 000000000..e8e13ba0d --- /dev/null +++ b/MediaBrowser.Model/Dlna/XmlAttribute.cs @@ -0,0 +1,13 @@ +using System.Xml.Serialization; + +namespace MediaBrowser.Model.Dlna +{ + public class XmlAttribute + { + [XmlAttribute("name")] + public string Name { get; set; } + + [XmlAttribute("value")] + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Drawing/DrawingUtils.cs b/MediaBrowser.Model/Drawing/DrawingUtils.cs index ae483b6f6..7f679a826 100644 --- a/MediaBrowser.Model/Drawing/DrawingUtils.cs +++ b/MediaBrowser.Model/Drawing/DrawingUtils.cs @@ -1,6 +1,4 @@ -using System.Globalization; - -namespace MediaBrowser.Model.Drawing +namespace MediaBrowser.Model.Drawing { /// /// Class DrawingUtils @@ -145,83 +143,4 @@ namespace MediaBrowser.Model.Drawing return scaleFactor; } } - - /// - /// Struct ImageSize - /// - public struct ImageSize - { - private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - - private double _height; - private double _width; - - /// - /// Gets or sets the height. - /// - /// The height. - public double Height - { - get - { - return _height; - } - set - { - _height = value; - } - } - - /// - /// Gets or sets the width. - /// - /// The width. - public double Width - { - get { return _width; } - set { _width = value; } - } - - public bool Equals(ImageSize size) - { - return Width.Equals(size.Width) && Height.Equals(size.Height); - } - - public override string ToString() - { - return string.Format("{0}-{1}", Width, Height); - } - - public ImageSize(string value) - { - _width = 0; - - _height = 0; - - ParseValue(value); - } - - private void ParseValue(string value) - { - if (!string.IsNullOrEmpty(value)) - { - string[] parts = value.Split('-'); - - if (parts.Length == 2) - { - double val; - - if (double.TryParse(parts[0], NumberStyles.Any, UsCulture, out val)) - { - _width = val; - } - - if (double.TryParse(parts[1], NumberStyles.Any, UsCulture, out val)) - { - _height = val; - } - } - } - } - } } diff --git a/MediaBrowser.Model/Drawing/ImageSize.cs b/MediaBrowser.Model/Drawing/ImageSize.cs new file mode 100644 index 000000000..acc245938 --- /dev/null +++ b/MediaBrowser.Model/Drawing/ImageSize.cs @@ -0,0 +1,83 @@ +using System.Globalization; + +namespace MediaBrowser.Model.Drawing +{ + /// + /// Struct ImageSize + /// + public struct ImageSize + { + private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); + + private double _height; + private double _width; + + /// + /// Gets or sets the height. + /// + /// The height. + public double Height + { + get + { + return _height; + } + set + { + _height = value; + } + } + + /// + /// Gets or sets the width. + /// + /// The width. + public double Width + { + get { return _width; } + set { _width = value; } + } + + public bool Equals(ImageSize size) + { + return Width.Equals(size.Width) && Height.Equals(size.Height); + } + + public override string ToString() + { + return string.Format("{0}-{1}", Width, Height); + } + + public ImageSize(string value) + { + _width = 0; + + _height = 0; + + ParseValue(value); + } + + private void ParseValue(string value) + { + if (!string.IsNullOrEmpty(value)) + { + string[] parts = value.Split('-'); + + if (parts.Length == 2) + { + double val; + + if (double.TryParse(parts[0], NumberStyles.Any, UsCulture, out val)) + { + _width = val; + } + + if (double.TryParse(parts[1], NumberStyles.Any, UsCulture, out val)) + { + _height = val; + } + } + } + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dto/IItemDto.cs b/MediaBrowser.Model/Dto/IItemDto.cs index 3ec641918..af46d29b9 100644 --- a/MediaBrowser.Model/Dto/IItemDto.cs +++ b/MediaBrowser.Model/Dto/IItemDto.cs @@ -18,10 +18,4 @@ namespace MediaBrowser.Model.Dto /// The original primary image aspect ratio. double? OriginalPrimaryImageAspectRatio { get; set; } } - - public enum RatingType - { - Score, - Likes - } } diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs new file mode 100644 index 000000000..2e94f4f0c --- /dev/null +++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs @@ -0,0 +1,42 @@ +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.MediaInfo; +using System.Collections.Generic; + +namespace MediaBrowser.Model.Dto +{ + public class MediaSourceInfo + { + public string Id { get; set; } + + public string Path { get; set; } + + public string Container { get; set; } + public long? Size { get; set; } + + public LocationType LocationType { get; set; } + + public string Name { get; set; } + + public long? RunTimeTicks { get; set; } + + public VideoType? VideoType { get; set; } + + public IsoType? IsoType { get; set; } + + public Video3DFormat? Video3DFormat { get; set; } + + public List MediaStreams { get; set; } + + public List Formats { get; set; } + + public int? Bitrate { get; set; } + + public TransportStreamTimestamp? Timestamp { get; set; } + + public MediaSourceInfo() + { + Formats = new List(); + MediaStreams = new List(); + } + } +} diff --git a/MediaBrowser.Model/Dto/MediaVersionInfo.cs b/MediaBrowser.Model/Dto/MediaVersionInfo.cs deleted file mode 100644 index 2e94f4f0c..000000000 --- a/MediaBrowser.Model/Dto/MediaVersionInfo.cs +++ /dev/null @@ -1,42 +0,0 @@ -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.MediaInfo; -using System.Collections.Generic; - -namespace MediaBrowser.Model.Dto -{ - public class MediaSourceInfo - { - public string Id { get; set; } - - public string Path { get; set; } - - public string Container { get; set; } - public long? Size { get; set; } - - public LocationType LocationType { get; set; } - - public string Name { get; set; } - - public long? RunTimeTicks { get; set; } - - public VideoType? VideoType { get; set; } - - public IsoType? IsoType { get; set; } - - public Video3DFormat? Video3DFormat { get; set; } - - public List MediaStreams { get; set; } - - public List Formats { get; set; } - - public int? Bitrate { get; set; } - - public TransportStreamTimestamp? Timestamp { get; set; } - - public MediaSourceInfo() - { - Formats = new List(); - MediaStreams = new List(); - } - } -} diff --git a/MediaBrowser.Model/Dto/RatingType.cs b/MediaBrowser.Model/Dto/RatingType.cs new file mode 100644 index 000000000..f151adce9 --- /dev/null +++ b/MediaBrowser.Model/Dto/RatingType.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.Dto +{ + public enum RatingType + { + Score, + Likes + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dto/RecommendationDto.cs b/MediaBrowser.Model/Dto/RecommendationDto.cs index 68b71e466..275f97c28 100644 --- a/MediaBrowser.Model/Dto/RecommendationDto.cs +++ b/MediaBrowser.Model/Dto/RecommendationDto.cs @@ -11,19 +11,4 @@ namespace MediaBrowser.Model.Dto public string CategoryId { get; set; } } - - public enum RecommendationType - { - SimilarToRecentlyPlayed = 0, - - SimilarToLikedItem = 1, - - HasDirectorFromRecentlyPlayed = 2, - - HasActorFromRecentlyPlayed = 3, - - HasLikedDirector = 4, - - HasLikedActor = 5 - } } diff --git a/MediaBrowser.Model/Dto/RecommendationType.cs b/MediaBrowser.Model/Dto/RecommendationType.cs new file mode 100644 index 000000000..1adf9b082 --- /dev/null +++ b/MediaBrowser.Model/Dto/RecommendationType.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Dto +{ + public enum RecommendationType + { + SimilarToRecentlyPlayed = 0, + + SimilarToLikedItem = 1, + + HasDirectorFromRecentlyPlayed = 2, + + HasActorFromRecentlyPlayed = 3, + + HasLikedDirector = 4, + + HasLikedActor = 5 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dto/StreamOptions.cs b/MediaBrowser.Model/Dto/StreamOptions.cs index 861fa4e01..9cf301270 100644 --- a/MediaBrowser.Model/Dto/StreamOptions.cs +++ b/MediaBrowser.Model/Dto/StreamOptions.cs @@ -1,102 +1,5 @@ namespace MediaBrowser.Model.Dto { - /// - /// Class VideoStreamOptions - /// - public class VideoStreamOptions : StreamOptions - { - /// - /// Gets or sets the video codec. - /// Omit to copy - /// - /// The video codec. - public string VideoCodec { get; set; } - - /// - /// Gets or sets the video bit rate. - /// - /// The video bit rate. - public int? VideoBitRate { get; set; } - - /// - /// Gets or sets the width. - /// - /// The width. - public int? Width { get; set; } - - /// - /// Gets or sets the height. - /// - /// The height. - public int? Height { get; set; } - - /// - /// Gets or sets the width of the max. - /// - /// The width of the max. - public int? MaxWidth { get; set; } - - /// - /// Gets or sets the height of the max. - /// - /// The height of the max. - public int? MaxHeight { get; set; } - - /// - /// Gets or sets the frame rate. - /// - /// The frame rate. - public double? FrameRate { get; set; } - - /// - /// Gets or sets the index of the audio stream. - /// - /// The index of the audio stream. - public int? AudioStreamIndex { get; set; } - - /// - /// Gets or sets the index of the video stream. - /// - /// The index of the video stream. - public int? VideoStreamIndex { get; set; } - - /// - /// Gets or sets the index of the subtitle stream. - /// - /// The index of the subtitle stream. - public int? SubtitleStreamIndex { get; set; } - - /// - /// Gets or sets the profile. - /// - /// The profile. - public string Profile { get; set; } - - /// - /// Gets or sets the level. - /// - /// The level. - public string Level { get; set; } - - /// - /// Gets or sets the baseline stream audio bit rate. - /// - /// The baseline stream audio bit rate. - public int? BaselineStreamAudioBitRate { get; set; } - - /// - /// Gets or sets a value indicating whether [append baseline stream]. - /// - /// true if [append baseline stream]; otherwise, false. - public bool AppendBaselineStream { get; set; } - - /// - /// Gets or sets the time stamp offset ms. Only used with HLS. - /// - /// The time stamp offset ms. - public int? TimeStampOffsetMs { get; set; } - } - /// /// Class StreamOptions /// @@ -158,19 +61,4 @@ /// The device id. public string DeviceId { get; set; } } - - public class SubtitleDownloadOptions - { - /// - /// Gets or sets the item identifier. - /// - /// The item identifier. - public string ItemId { get; set; } - - /// - /// Gets or sets the index of the stream. - /// - /// The index of the stream. - public int StreamIndex { get; set; } - } } diff --git a/MediaBrowser.Model/Dto/SubtitleDownloadOptions.cs b/MediaBrowser.Model/Dto/SubtitleDownloadOptions.cs new file mode 100644 index 000000000..a0b49f42c --- /dev/null +++ b/MediaBrowser.Model/Dto/SubtitleDownloadOptions.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Dto +{ + public class SubtitleDownloadOptions + { + /// + /// Gets or sets the item identifier. + /// + /// The item identifier. + public string ItemId { get; set; } + + /// + /// Gets or sets the index of the stream. + /// + /// The index of the stream. + public int StreamIndex { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Dto/VideoStreamOptions.cs b/MediaBrowser.Model/Dto/VideoStreamOptions.cs new file mode 100644 index 000000000..73dc70018 --- /dev/null +++ b/MediaBrowser.Model/Dto/VideoStreamOptions.cs @@ -0,0 +1,99 @@ +namespace MediaBrowser.Model.Dto +{ + /// + /// Class VideoStreamOptions + /// + public class VideoStreamOptions : StreamOptions + { + /// + /// Gets or sets the video codec. + /// Omit to copy + /// + /// The video codec. + public string VideoCodec { get; set; } + + /// + /// Gets or sets the video bit rate. + /// + /// The video bit rate. + public int? VideoBitRate { get; set; } + + /// + /// Gets or sets the width. + /// + /// The width. + public int? Width { get; set; } + + /// + /// Gets or sets the height. + /// + /// The height. + public int? Height { get; set; } + + /// + /// Gets or sets the width of the max. + /// + /// The width of the max. + public int? MaxWidth { get; set; } + + /// + /// Gets or sets the height of the max. + /// + /// The height of the max. + public int? MaxHeight { get; set; } + + /// + /// Gets or sets the frame rate. + /// + /// The frame rate. + public double? FrameRate { get; set; } + + /// + /// Gets or sets the index of the audio stream. + /// + /// The index of the audio stream. + public int? AudioStreamIndex { get; set; } + + /// + /// Gets or sets the index of the video stream. + /// + /// The index of the video stream. + public int? VideoStreamIndex { get; set; } + + /// + /// Gets or sets the index of the subtitle stream. + /// + /// The index of the subtitle stream. + public int? SubtitleStreamIndex { get; set; } + + /// + /// Gets or sets the profile. + /// + /// The profile. + public string Profile { get; set; } + + /// + /// Gets or sets the level. + /// + /// The level. + public string Level { get; set; } + + /// + /// Gets or sets the baseline stream audio bit rate. + /// + /// The baseline stream audio bit rate. + public int? BaselineStreamAudioBitRate { get; set; } + + /// + /// Gets or sets a value indicating whether [append baseline stream]. + /// + /// true if [append baseline stream]; otherwise, false. + public bool AppendBaselineStream { get; set; } + + /// + /// Gets or sets the time stamp offset ms. Only used with HLS. + /// + /// The time stamp offset ms. + public int? TimeStampOffsetMs { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/DisplayPreferences.cs b/MediaBrowser.Model/Entities/DisplayPreferences.cs index 62233ac27..2fdab9799 100644 --- a/MediaBrowser.Model/Entities/DisplayPreferences.cs +++ b/MediaBrowser.Model/Entities/DisplayPreferences.cs @@ -122,34 +122,4 @@ namespace MediaBrowser.Model.Entities PrimaryImageHeight = Convert.ToInt32(size.Height); } } - - /// - /// Enum ScrollDirection - /// - public enum ScrollDirection - { - /// - /// The horizontal - /// - Horizontal, - /// - /// The vertical - /// - Vertical - } - - /// - /// Enum SortOrder - /// - public enum SortOrder - { - /// - /// The ascending - /// - Ascending, - /// - /// The descending - /// - Descending - } } diff --git a/MediaBrowser.Model/Entities/EmptyRequestResult.cs b/MediaBrowser.Model/Entities/EmptyRequestResult.cs new file mode 100644 index 000000000..5c9a725fd --- /dev/null +++ b/MediaBrowser.Model/Entities/EmptyRequestResult.cs @@ -0,0 +1,7 @@ + +namespace MediaBrowser.Model.Entities +{ + public class EmptyRequestResult + { + } +} diff --git a/MediaBrowser.Model/Entities/IHasProviderIds.cs b/MediaBrowser.Model/Entities/IHasProviderIds.cs index efb75412f..796850dbd 100644 --- a/MediaBrowser.Model/Entities/IHasProviderIds.cs +++ b/MediaBrowser.Model/Entities/IHasProviderIds.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace MediaBrowser.Model.Entities { @@ -14,102 +13,4 @@ namespace MediaBrowser.Model.Entities /// The provider ids. Dictionary ProviderIds { get; set; } } - - /// - /// Class ProviderIdsExtensions - /// - public static class ProviderIdsExtensions - { - /// - /// Determines whether [has provider identifier] [the specified instance]. - /// - /// The instance. - /// The provider. - /// true if [has provider identifier] [the specified instance]; otherwise, false. - public static bool HasProviderId(this IHasProviderIds instance, MetadataProviders provider) - { - return !string.IsNullOrEmpty(instance.GetProviderId(provider.ToString())); - } - - /// - /// Gets a provider id - /// - /// The instance. - /// The provider. - /// System.String. - public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider) - { - return instance.GetProviderId(provider.ToString()); - } - - /// - /// Gets a provider id - /// - /// The instance. - /// The name. - /// System.String. - public static string GetProviderId(this IHasProviderIds instance, string name) - { - if (instance == null) - { - throw new ArgumentNullException("instance"); - } - - if (instance.ProviderIds == null) - { - return null; - } - - string id; - instance.ProviderIds.TryGetValue(name, out id); - return id; - } - - /// - /// Sets a provider id - /// - /// The instance. - /// The name. - /// The value. - public static void SetProviderId(this IHasProviderIds instance, string name, string value) - { - if (instance == null) - { - throw new ArgumentNullException("instance"); - } - - // If it's null remove the key from the dictionary - if (string.IsNullOrEmpty(value)) - { - if (instance.ProviderIds != null) - { - if (instance.ProviderIds.ContainsKey(name)) - { - instance.ProviderIds.Remove(name); - } - } - } - else - { - // Ensure it exists - if (instance.ProviderIds == null) - { - instance.ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - - instance.ProviderIds[name] = value; - } - } - - /// - /// Sets a provider id - /// - /// The instance. - /// The provider. - /// The value. - public static void SetProviderId(this IHasProviderIds instance, MetadataProviders provider, string value) - { - instance.SetProviderId(provider.ToString(), value); - } - } } diff --git a/MediaBrowser.Model/Entities/IsoType.cs b/MediaBrowser.Model/Entities/IsoType.cs new file mode 100644 index 000000000..567b98ab9 --- /dev/null +++ b/MediaBrowser.Model/Entities/IsoType.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum IsoType + /// + public enum IsoType + { + /// + /// The DVD + /// + Dvd, + /// + /// The blu ray + /// + BluRay + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/MediaInfo.cs b/MediaBrowser.Model/Entities/MediaInfo.cs new file mode 100644 index 000000000..ef26cfa14 --- /dev/null +++ b/MediaBrowser.Model/Entities/MediaInfo.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.Entities +{ + public class MediaInfo + { + /// + /// Gets or sets the media streams. + /// + /// The media streams. + public List MediaStreams { get; set; } + + /// + /// Gets or sets the format. + /// + /// The format. + public string Format { get; set; } + + public int? TotalBitrate { get; set; } + + public MediaInfo() + { + MediaStreams = new List(); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index d54e3c0ef..66163c1ef 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Diagnostics; +using System.Diagnostics; namespace MediaBrowser.Model.Entities { @@ -147,49 +146,4 @@ namespace MediaBrowser.Model.Entities /// The level. public double? Level { get; set; } } - - /// - /// Enum MediaStreamType - /// - public enum MediaStreamType - { - /// - /// The audio - /// - Audio, - /// - /// The video - /// - Video, - /// - /// The subtitle - /// - Subtitle, - /// - /// The embedded image - /// - EmbeddedImage - } - - public class MediaInfo - { - /// - /// Gets or sets the media streams. - /// - /// The media streams. - public List MediaStreams { get; set; } - - /// - /// Gets or sets the format. - /// - /// The format. - public string Format { get; set; } - - public int? TotalBitrate { get; set; } - - public MediaInfo() - { - MediaStreams = new List(); - } - } } diff --git a/MediaBrowser.Model/Entities/MediaStreamType.cs b/MediaBrowser.Model/Entities/MediaStreamType.cs new file mode 100644 index 000000000..084a411f9 --- /dev/null +++ b/MediaBrowser.Model/Entities/MediaStreamType.cs @@ -0,0 +1,25 @@ +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum MediaStreamType + /// + public enum MediaStreamType + { + /// + /// The audio + /// + Audio, + /// + /// The video + /// + Video, + /// + /// The subtitle + /// + Subtitle, + /// + /// The embedded image + /// + EmbeddedImage + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/MediaUrl.cs b/MediaBrowser.Model/Entities/MediaUrl.cs index 857e91fec..9aa7207ed 100644 --- a/MediaBrowser.Model/Entities/MediaUrl.cs +++ b/MediaBrowser.Model/Entities/MediaUrl.cs @@ -8,10 +8,4 @@ namespace MediaBrowser.Model.Entities public VideoSize? VideoSize { get; set; } public bool IsDirectLink { get; set; } } - - public enum VideoSize - { - StandardDefinition, - HighDefinition - } } diff --git a/MediaBrowser.Model/Entities/PackageReviewInfo.cs b/MediaBrowser.Model/Entities/PackageReviewInfo.cs index c350935f4..52500a41e 100644 --- a/MediaBrowser.Model/Entities/PackageReviewInfo.cs +++ b/MediaBrowser.Model/Entities/PackageReviewInfo.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MediaBrowser.Model.Entities { diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs new file mode 100644 index 000000000..e10232baa --- /dev/null +++ b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; + +namespace MediaBrowser.Model.Entities +{ + /// + /// Class ProviderIdsExtensions + /// + public static class ProviderIdsExtensions + { + /// + /// Determines whether [has provider identifier] [the specified instance]. + /// + /// The instance. + /// The provider. + /// true if [has provider identifier] [the specified instance]; otherwise, false. + public static bool HasProviderId(this IHasProviderIds instance, MetadataProviders provider) + { + return !string.IsNullOrEmpty(instance.GetProviderId(provider.ToString())); + } + + /// + /// Gets a provider id + /// + /// The instance. + /// The provider. + /// System.String. + public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider) + { + return instance.GetProviderId(provider.ToString()); + } + + /// + /// Gets a provider id + /// + /// The instance. + /// The name. + /// System.String. + public static string GetProviderId(this IHasProviderIds instance, string name) + { + if (instance == null) + { + throw new ArgumentNullException("instance"); + } + + if (instance.ProviderIds == null) + { + return null; + } + + string id; + instance.ProviderIds.TryGetValue(name, out id); + return id; + } + + /// + /// Sets a provider id + /// + /// The instance. + /// The name. + /// The value. + public static void SetProviderId(this IHasProviderIds instance, string name, string value) + { + if (instance == null) + { + throw new ArgumentNullException("instance"); + } + + // If it's null remove the key from the dictionary + if (string.IsNullOrEmpty(value)) + { + if (instance.ProviderIds != null) + { + if (instance.ProviderIds.ContainsKey(name)) + { + instance.ProviderIds.Remove(name); + } + } + } + else + { + // Ensure it exists + if (instance.ProviderIds == null) + { + instance.ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); + } + + instance.ProviderIds[name] = value; + } + } + + /// + /// Sets a provider id + /// + /// The instance. + /// The provider. + /// The value. + public static void SetProviderId(this IHasProviderIds instance, MetadataProviders provider, string value) + { + instance.SetProviderId(provider.ToString(), value); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/RequestResult.cs b/MediaBrowser.Model/Entities/RequestResult.cs deleted file mode 100644 index 5c9a725fd..000000000 --- a/MediaBrowser.Model/Entities/RequestResult.cs +++ /dev/null @@ -1,7 +0,0 @@ - -namespace MediaBrowser.Model.Entities -{ - public class EmptyRequestResult - { - } -} diff --git a/MediaBrowser.Model/Entities/ScrollDirection.cs b/MediaBrowser.Model/Entities/ScrollDirection.cs new file mode 100644 index 000000000..ed2210300 --- /dev/null +++ b/MediaBrowser.Model/Entities/ScrollDirection.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum ScrollDirection + /// + public enum ScrollDirection + { + /// + /// The horizontal + /// + Horizontal, + /// + /// The vertical + /// + Vertical + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/SortOrder.cs b/MediaBrowser.Model/Entities/SortOrder.cs new file mode 100644 index 000000000..5130449ba --- /dev/null +++ b/MediaBrowser.Model/Entities/SortOrder.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Entities +{ + /// + /// Enum SortOrder + /// + public enum SortOrder + { + /// + /// The ascending + /// + Ascending, + /// + /// The descending + /// + Descending + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/VideoSize.cs b/MediaBrowser.Model/Entities/VideoSize.cs new file mode 100644 index 000000000..0100f3b90 --- /dev/null +++ b/MediaBrowser.Model/Entities/VideoSize.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.Entities +{ + public enum VideoSize + { + StandardDefinition, + HighDefinition + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Entities/VideoType.cs b/MediaBrowser.Model/Entities/VideoType.cs index b2742add1..aa9a3c55f 100644 --- a/MediaBrowser.Model/Entities/VideoType.cs +++ b/MediaBrowser.Model/Entities/VideoType.cs @@ -27,19 +27,4 @@ namespace MediaBrowser.Model.Entities /// HdDvd } - - /// - /// Enum IsoType - /// - public enum IsoType - { - /// - /// The DVD - /// - Dvd, - /// - /// The blu ray - /// - BluRay - } } diff --git a/MediaBrowser.Model/FileOrganization/EpisodeFileOrganizationRequest.cs b/MediaBrowser.Model/FileOrganization/EpisodeFileOrganizationRequest.cs new file mode 100644 index 000000000..0b12ebc51 --- /dev/null +++ b/MediaBrowser.Model/FileOrganization/EpisodeFileOrganizationRequest.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.FileOrganization +{ + public class EpisodeFileOrganizationRequest + { + public string ResultId { get; set; } + + public string SeriesId { get; set; } + + public int SeasonNumber { get; set; } + + public int EpisodeNumber { get; set; } + + public int? EndingEpisodeNumber { get; set; } + + public bool RememberCorrection { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/FileOrganization/FileOrganizationQuery.cs b/MediaBrowser.Model/FileOrganization/FileOrganizationQuery.cs deleted file mode 100644 index ce5750757..000000000 --- a/MediaBrowser.Model/FileOrganization/FileOrganizationQuery.cs +++ /dev/null @@ -1,33 +0,0 @@ - -namespace MediaBrowser.Model.FileOrganization -{ - public class FileOrganizationResultQuery - { - /// - /// Skips over a given number of items within the results. Use for paging. - /// - /// The start index. - public int? StartIndex { get; set; } - - /// - /// The maximum number of items to return - /// - /// The limit. - public int? Limit { get; set; } - } - - public class EpisodeFileOrganizationRequest - { - public string ResultId { get; set; } - - public string SeriesId { get; set; } - - public int SeasonNumber { get; set; } - - public int EpisodeNumber { get; set; } - - public int? EndingEpisodeNumber { get; set; } - - public bool RememberCorrection { get; set; } - } -} diff --git a/MediaBrowser.Model/FileOrganization/FileOrganizationResult.cs b/MediaBrowser.Model/FileOrganization/FileOrganizationResult.cs index 4a3235a42..ef9d0ca2a 100644 --- a/MediaBrowser.Model/FileOrganization/FileOrganizationResult.cs +++ b/MediaBrowser.Model/FileOrganization/FileOrganizationResult.cs @@ -100,18 +100,4 @@ namespace MediaBrowser.Model.FileOrganization DuplicatePaths = new List(); } } - - public enum FileSortingStatus - { - Success, - Failure, - SkippedExisting - } - - public enum FileOrganizerType - { - Movie, - Episode, - Song - } } diff --git a/MediaBrowser.Model/FileOrganization/FileOrganizationResultQuery.cs b/MediaBrowser.Model/FileOrganization/FileOrganizationResultQuery.cs new file mode 100644 index 000000000..18287534e --- /dev/null +++ b/MediaBrowser.Model/FileOrganization/FileOrganizationResultQuery.cs @@ -0,0 +1,18 @@ + +namespace MediaBrowser.Model.FileOrganization +{ + public class FileOrganizationResultQuery + { + /// + /// Skips over a given number of items within the results. Use for paging. + /// + /// The start index. + public int? StartIndex { get; set; } + + /// + /// The maximum number of items to return + /// + /// The limit. + public int? Limit { get; set; } + } +} diff --git a/MediaBrowser.Model/FileOrganization/FileOrganizerType.cs b/MediaBrowser.Model/FileOrganization/FileOrganizerType.cs new file mode 100644 index 000000000..cbbeb9ce2 --- /dev/null +++ b/MediaBrowser.Model/FileOrganization/FileOrganizerType.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.FileOrganization +{ + public enum FileOrganizerType + { + Movie, + Episode, + Song + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/FileOrganization/FileSortingStatus.cs b/MediaBrowser.Model/FileOrganization/FileSortingStatus.cs new file mode 100644 index 000000000..8a467c05f --- /dev/null +++ b/MediaBrowser.Model/FileOrganization/FileSortingStatus.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.FileOrganization +{ + public enum FileSortingStatus + { + Success, + Failure, + SkippedExisting + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Globalization/CountryInfo.cs b/MediaBrowser.Model/Globalization/CountryInfo.cs index 9f5f00d80..16aea8436 100644 --- a/MediaBrowser.Model/Globalization/CountryInfo.cs +++ b/MediaBrowser.Model/Globalization/CountryInfo.cs @@ -30,10 +30,4 @@ namespace MediaBrowser.Model.Globalization /// The name of the three letter ISO region. public string ThreeLetterISORegionName { get; set; } } - - public class LocalizatonOption - { - public string Name { get; set; } - public string Value { get; set; } - } } diff --git a/MediaBrowser.Model/Globalization/LocalizatonOption.cs b/MediaBrowser.Model/Globalization/LocalizatonOption.cs new file mode 100644 index 000000000..61749cbc3 --- /dev/null +++ b/MediaBrowser.Model/Globalization/LocalizatonOption.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.Globalization +{ + public class LocalizatonOption + { + public string Name { get; set; } + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/IO/FileSystemEntryInfo.cs b/MediaBrowser.Model/IO/FileSystemEntryInfo.cs index dc4840456..f17e2e5c3 100644 --- a/MediaBrowser.Model/IO/FileSystemEntryInfo.cs +++ b/MediaBrowser.Model/IO/FileSystemEntryInfo.cs @@ -24,27 +24,4 @@ namespace MediaBrowser.Model.IO /// The type. public FileSystemEntryType Type { get; set; } } - - /// - /// Enum FileSystemEntryType - /// - public enum FileSystemEntryType - { - /// - /// The file - /// - File, - /// - /// The directory - /// - Directory, - /// - /// The network computer - /// - NetworkComputer, - /// - /// The network share - /// - NetworkShare - } } diff --git a/MediaBrowser.Model/IO/FileSystemEntryType.cs b/MediaBrowser.Model/IO/FileSystemEntryType.cs new file mode 100644 index 000000000..e7c67c606 --- /dev/null +++ b/MediaBrowser.Model/IO/FileSystemEntryType.cs @@ -0,0 +1,25 @@ +namespace MediaBrowser.Model.IO +{ + /// + /// Enum FileSystemEntryType + /// + public enum FileSystemEntryType + { + /// + /// The file + /// + File, + /// + /// The directory + /// + Directory, + /// + /// The network computer + /// + NetworkComputer, + /// + /// The network share + /// + NetworkShare + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs new file mode 100644 index 000000000..2d88215bb --- /dev/null +++ b/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs @@ -0,0 +1,108 @@ +using System; +using System.ComponentModel; + +namespace MediaBrowser.Model.LiveTv +{ + public class BaseTimerInfoDto : INotifyPropertyChanged + { + /// + /// Occurs when a property value changes. + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Id of the recording. + /// + public string Id { get; set; } + + /// + /// Gets or sets the external identifier. + /// + /// The external identifier. + public string ExternalId { get; set; } + + /// + /// ChannelId of the recording. + /// + public string ChannelId { get; set; } + + /// + /// Gets or sets the external channel identifier. + /// + /// The external channel identifier. + public string ExternalChannelId { get; set; } + + /// + /// ChannelName of the recording. + /// + public string ChannelName { get; set; } + + /// + /// Gets or sets the program identifier. + /// + /// The program identifier. + public string ProgramId { get; set; } + + /// + /// Gets or sets the external program identifier. + /// + /// The external program identifier. + public string ExternalProgramId { get; set; } + + /// + /// Name of the recording. + /// + public string Name { get; set; } + + /// + /// Description of the recording. + /// + public string Overview { get; set; } + + /// + /// The start date of the recording, in UTC. + /// + public DateTime StartDate { get; set; } + + /// + /// The end date of the recording, in UTC. + /// + public DateTime EndDate { get; set; } + + /// + /// Gets or sets the name of the service. + /// + /// The name of the service. + public string ServiceName { get; set; } + + /// + /// Gets or sets the priority. + /// + /// The priority. + public int Priority { get; set; } + + /// + /// Gets or sets the pre padding seconds. + /// + /// The pre padding seconds. + public int PrePaddingSeconds { get; set; } + + /// + /// Gets or sets the post padding seconds. + /// + /// The post padding seconds. + public int PostPaddingSeconds { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is pre padding required. + /// + /// true if this instance is pre padding required; otherwise, false. + public bool IsPrePaddingRequired { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is post padding required. + /// + /// true if this instance is post padding required; otherwise, false. + public bool IsPostPaddingRequired { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/DayPattern.cs b/MediaBrowser.Model/LiveTv/DayPattern.cs new file mode 100644 index 000000000..8251795dc --- /dev/null +++ b/MediaBrowser.Model/LiveTv/DayPattern.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.LiveTv +{ + public enum DayPattern + { + Daily, + Weekdays, + Weekends + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/GuideInfo.cs b/MediaBrowser.Model/LiveTv/GuideInfo.cs new file mode 100644 index 000000000..c21f6d871 --- /dev/null +++ b/MediaBrowser.Model/LiveTv/GuideInfo.cs @@ -0,0 +1,19 @@ +using System; + +namespace MediaBrowser.Model.LiveTv +{ + public class GuideInfo + { + /// + /// Gets or sets the start date. + /// + /// The start date. + public DateTime StartDate { get; set; } + + /// + /// Gets or sets the end date. + /// + /// The end date. + public DateTime EndDate { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/LiveTvInfo.cs b/MediaBrowser.Model/LiveTv/LiveTvInfo.cs new file mode 100644 index 000000000..dd31c5a6b --- /dev/null +++ b/MediaBrowser.Model/LiveTv/LiveTvInfo.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.LiveTv +{ + public class LiveTvInfo + { + /// + /// Gets or sets the services. + /// + /// The services. + public List Services { get; set; } + + /// + /// Gets or sets the name of the active service. + /// + /// The name of the active service. + public string ActiveServiceName { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is enabled. + /// + /// true if this instance is enabled; otherwise, false. + public bool IsEnabled { get; set; } + + /// + /// Gets or sets the enabled users. + /// + /// The enabled users. + public List EnabledUsers { get; set; } + + /// + /// Gets or sets the status. + /// + /// The status. + public LiveTvServiceStatus Status { get; set; } + + /// + /// Gets or sets the status message. + /// + /// The status message. + public string StatusMessage { get; set; } + + public LiveTvInfo() + { + Services = new List(); + EnabledUsers = new List(); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs b/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs index 85f58be3b..264870ffb 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace MediaBrowser.Model.LiveTv { @@ -51,140 +50,4 @@ namespace MediaBrowser.Model.LiveTv Tuners = new List(); } } - - public class GuideInfo - { - /// - /// Gets or sets the start date. - /// - /// The start date. - public DateTime StartDate { get; set; } - - /// - /// Gets or sets the end date. - /// - /// The end date. - public DateTime EndDate { get; set; } - } - - public class LiveTvInfo - { - /// - /// Gets or sets the services. - /// - /// The services. - public List Services { get; set; } - - /// - /// Gets or sets the name of the active service. - /// - /// The name of the active service. - public string ActiveServiceName { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is enabled. - /// - /// true if this instance is enabled; otherwise, false. - public bool IsEnabled { get; set; } - - /// - /// Gets or sets the enabled users. - /// - /// The enabled users. - public List EnabledUsers { get; set; } - - /// - /// Gets or sets the status. - /// - /// The status. - public LiveTvServiceStatus Status { get; set; } - - /// - /// Gets or sets the status message. - /// - /// The status message. - public string StatusMessage { get; set; } - - public LiveTvInfo() - { - Services = new List(); - EnabledUsers = new List(); - } - } - - public class LiveTvTunerInfoDto - { - /// - /// Gets or sets the type of the source. - /// - /// The type of the source. - public string SourceType { get; set; } - - /// - /// Gets or sets the name. - /// - /// The name. - public string Name { get; set; } - - /// - /// Gets or sets the identifier. - /// - /// The identifier. - public string Id { get; set; } - - /// - /// Gets or sets the status. - /// - /// The status. - public LiveTvTunerStatus Status { get; set; } - - /// - /// Gets or sets the channel identifier. - /// - /// The channel identifier. - public string ChannelId { get; set; } - - /// - /// Gets or sets the name of the channel. - /// - /// The name of the channel. - public string ChannelName { get; set; } - - /// - /// Gets or sets the recording identifier. - /// - /// The recording identifier. - public string RecordingId { get; set; } - - /// - /// Gets or sets the name of the program. - /// - /// The name of the program. - public string ProgramName { get; set; } - - /// - /// Gets or sets the clients. - /// - /// The clients. - public List Clients { get; set; } - - public LiveTvTunerInfoDto() - { - Clients = new List(); - } - } - - public enum LiveTvServiceStatus - { - Ok = 0, - Unavailable = 1 - } - - public enum LiveTvTunerStatus - { - Available = 0, - Disabled = 1, - RecordingTv = 2, - LiveTv = 3 - } } diff --git a/MediaBrowser.Model/LiveTv/LiveTvServiceStatus.cs b/MediaBrowser.Model/LiveTv/LiveTvServiceStatus.cs new file mode 100644 index 000000000..20fe84500 --- /dev/null +++ b/MediaBrowser.Model/LiveTv/LiveTvServiceStatus.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.LiveTv +{ + public enum LiveTvServiceStatus + { + Ok = 0, + Unavailable = 1 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs b/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs new file mode 100644 index 000000000..28e8c158a --- /dev/null +++ b/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.LiveTv +{ + public class LiveTvTunerInfoDto + { + /// + /// Gets or sets the type of the source. + /// + /// The type of the source. + public string SourceType { get; set; } + + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// Gets or sets the identifier. + /// + /// The identifier. + public string Id { get; set; } + + /// + /// Gets or sets the status. + /// + /// The status. + public LiveTvTunerStatus Status { get; set; } + + /// + /// Gets or sets the channel identifier. + /// + /// The channel identifier. + public string ChannelId { get; set; } + + /// + /// Gets or sets the name of the channel. + /// + /// The name of the channel. + public string ChannelName { get; set; } + + /// + /// Gets or sets the recording identifier. + /// + /// The recording identifier. + public string RecordingId { get; set; } + + /// + /// Gets or sets the name of the program. + /// + /// The name of the program. + public string ProgramName { get; set; } + + /// + /// Gets or sets the clients. + /// + /// The clients. + public List Clients { get; set; } + + public LiveTvTunerInfoDto() + { + Clients = new List(); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/LiveTvTunerStatus.cs b/MediaBrowser.Model/LiveTv/LiveTvTunerStatus.cs new file mode 100644 index 000000000..055199fca --- /dev/null +++ b/MediaBrowser.Model/LiveTv/LiveTvTunerStatus.cs @@ -0,0 +1,10 @@ +namespace MediaBrowser.Model.LiveTv +{ + public enum LiveTvTunerStatus + { + Available = 0, + Disabled = 1, + RecordingTv = 2, + LiveTv = 3 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/ProgramAudio.cs b/MediaBrowser.Model/LiveTv/ProgramAudio.cs new file mode 100644 index 000000000..902079b9a --- /dev/null +++ b/MediaBrowser.Model/LiveTv/ProgramAudio.cs @@ -0,0 +1,11 @@ +namespace MediaBrowser.Model.LiveTv +{ + public enum ProgramAudio + { + Mono, + Stereo, + Dolby, + DolbyDigital, + Thx + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs index 4e7ab8224..fb931820e 100644 --- a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs @@ -216,13 +216,4 @@ namespace MediaBrowser.Model.LiveTv public event PropertyChangedEventHandler PropertyChanged; } - - public enum ProgramAudio - { - Mono, - Stereo, - Dolby, - DolbyDigital, - Thx - } } \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/ProgramQuery.cs b/MediaBrowser.Model/LiveTv/ProgramQuery.cs index a2a824994..36c06d4c0 100644 --- a/MediaBrowser.Model/LiveTv/ProgramQuery.cs +++ b/MediaBrowser.Model/LiveTv/ProgramQuery.cs @@ -32,31 +32,4 @@ namespace MediaBrowser.Model.LiveTv ChannelIdList = new string[] { }; } } - - public class RecommendedProgramQuery - { - /// - /// Gets or sets the user identifier. - /// - /// The user identifier. - public string UserId { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is airing. - /// - /// true if this instance is airing; otherwise, false. - public bool? IsAiring { get; set; } - - /// - /// Gets or sets a value indicating whether this instance has aired. - /// - /// null if [has aired] contains no value, true if [has aired]; otherwise, false. - public bool? HasAired { get; set; } - - /// - /// The maximum number of items to return - /// - /// The limit. - public int? Limit { get; set; } - } } diff --git a/MediaBrowser.Model/LiveTv/RecommendedProgramQuery.cs b/MediaBrowser.Model/LiveTv/RecommendedProgramQuery.cs new file mode 100644 index 000000000..907902123 --- /dev/null +++ b/MediaBrowser.Model/LiveTv/RecommendedProgramQuery.cs @@ -0,0 +1,29 @@ +namespace MediaBrowser.Model.LiveTv +{ + public class RecommendedProgramQuery + { + /// + /// Gets or sets the user identifier. + /// + /// The user identifier. + public string UserId { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is airing. + /// + /// true if this instance is airing; otherwise, false. + public bool? IsAiring { get; set; } + + /// + /// Gets or sets a value indicating whether this instance has aired. + /// + /// null if [has aired] contains no value, true if [has aired]; otherwise, false. + public bool? HasAired { get; set; } + + /// + /// The maximum number of items to return + /// + /// The limit. + public int? Limit { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/RecordingGroupQuery.cs b/MediaBrowser.Model/LiveTv/RecordingGroupQuery.cs new file mode 100644 index 000000000..8c20e7f3f --- /dev/null +++ b/MediaBrowser.Model/LiveTv/RecordingGroupQuery.cs @@ -0,0 +1,11 @@ +namespace MediaBrowser.Model.LiveTv +{ + public class RecordingGroupQuery + { + /// + /// Gets or sets the user identifier. + /// + /// The user identifier. + public string UserId { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/RecordingQuery.cs b/MediaBrowser.Model/LiveTv/RecordingQuery.cs index 1fa9af49b..daa137db6 100644 --- a/MediaBrowser.Model/LiveTv/RecordingQuery.cs +++ b/MediaBrowser.Model/LiveTv/RecordingQuery.cs @@ -1,6 +1,4 @@ -using MediaBrowser.Model.Entities; - -namespace MediaBrowser.Model.LiveTv +namespace MediaBrowser.Model.LiveTv { /// /// Class RecordingQuery. @@ -61,43 +59,4 @@ namespace MediaBrowser.Model.LiveTv /// The series timer identifier. public string SeriesTimerId { get; set; } } - - public class RecordingGroupQuery - { - /// - /// Gets or sets the user identifier. - /// - /// The user identifier. - public string UserId { get; set; } - } - - public class TimerQuery - { - /// - /// Gets or sets the channel identifier. - /// - /// The channel identifier. - public string ChannelId { get; set; } - - /// - /// Gets or sets the series timer identifier. - /// - /// The series timer identifier. - public string SeriesTimerId { get; set; } - } - - public class SeriesTimerQuery - { - /// - /// Gets or sets the sort by - SortName, Priority - /// - /// The sort by. - public string SortBy { get; set; } - - /// - /// Gets or sets the sort order. - /// - /// The sort order. - public SortOrder SortOrder { get; set; } - } } diff --git a/MediaBrowser.Model/LiveTv/RecordingStatus.cs b/MediaBrowser.Model/LiveTv/RecordingStatus.cs index 95e9dcb01..7ab716c4d 100644 --- a/MediaBrowser.Model/LiveTv/RecordingStatus.cs +++ b/MediaBrowser.Model/LiveTv/RecordingStatus.cs @@ -13,11 +13,4 @@ namespace MediaBrowser.Model.LiveTv ConflictedNotOk, Error } - - public enum DayPattern - { - Daily, - Weekdays, - Weekends - } } diff --git a/MediaBrowser.Model/LiveTv/SeriesTimerQuery.cs b/MediaBrowser.Model/LiveTv/SeriesTimerQuery.cs new file mode 100644 index 000000000..95260cc0e --- /dev/null +++ b/MediaBrowser.Model/LiveTv/SeriesTimerQuery.cs @@ -0,0 +1,19 @@ +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Model.LiveTv +{ + public class SeriesTimerQuery + { + /// + /// Gets or sets the sort by - SortName, Priority + /// + /// The sort by. + public string SortBy { get; set; } + + /// + /// Gets or sets the sort order. + /// + /// The sort order. + public SortOrder SortOrder { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs index 137c95719..16cac945f 100644 --- a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs @@ -1,7 +1,4 @@ -using System; -using System.ComponentModel; - -namespace MediaBrowser.Model.LiveTv +namespace MediaBrowser.Model.LiveTv { public class TimerInfoDto : BaseTimerInfoDto { @@ -36,107 +33,4 @@ namespace MediaBrowser.Model.LiveTv public ProgramInfoDto ProgramInfo { get; set; } } - - public class BaseTimerInfoDto : INotifyPropertyChanged - { - /// - /// Occurs when a property value changes. - /// - public event PropertyChangedEventHandler PropertyChanged; - - /// - /// Id of the recording. - /// - public string Id { get; set; } - - /// - /// Gets or sets the external identifier. - /// - /// The external identifier. - public string ExternalId { get; set; } - - /// - /// ChannelId of the recording. - /// - public string ChannelId { get; set; } - - /// - /// Gets or sets the external channel identifier. - /// - /// The external channel identifier. - public string ExternalChannelId { get; set; } - - /// - /// ChannelName of the recording. - /// - public string ChannelName { get; set; } - - /// - /// Gets or sets the program identifier. - /// - /// The program identifier. - public string ProgramId { get; set; } - - /// - /// Gets or sets the external program identifier. - /// - /// The external program identifier. - public string ExternalProgramId { get; set; } - - /// - /// Name of the recording. - /// - public string Name { get; set; } - - /// - /// Description of the recording. - /// - public string Overview { get; set; } - - /// - /// The start date of the recording, in UTC. - /// - public DateTime StartDate { get; set; } - - /// - /// The end date of the recording, in UTC. - /// - public DateTime EndDate { get; set; } - - /// - /// Gets or sets the name of the service. - /// - /// The name of the service. - public string ServiceName { get; set; } - - /// - /// Gets or sets the priority. - /// - /// The priority. - public int Priority { get; set; } - - /// - /// Gets or sets the pre padding seconds. - /// - /// The pre padding seconds. - public int PrePaddingSeconds { get; set; } - - /// - /// Gets or sets the post padding seconds. - /// - /// The post padding seconds. - public int PostPaddingSeconds { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is pre padding required. - /// - /// true if this instance is pre padding required; otherwise, false. - public bool IsPrePaddingRequired { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is post padding required. - /// - /// true if this instance is post padding required; otherwise, false. - public bool IsPostPaddingRequired { get; set; } - } } diff --git a/MediaBrowser.Model/LiveTv/TimerQuery.cs b/MediaBrowser.Model/LiveTv/TimerQuery.cs new file mode 100644 index 000000000..e6ceff530 --- /dev/null +++ b/MediaBrowser.Model/LiveTv/TimerQuery.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.LiveTv +{ + public class TimerQuery + { + /// + /// Gets or sets the channel identifier. + /// + /// The channel identifier. + public string ChannelId { get; set; } + + /// + /// Gets or sets the series timer identifier. + /// + /// The series timer identifier. + public string SeriesTimerId { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 1f7284422..748e5f0a8 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -57,35 +57,64 @@ - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -94,26 +123,64 @@ + - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + - + + + + + + + + + + + @@ -138,9 +205,11 @@ + + @@ -148,14 +217,24 @@ + + + + + - + + + + + + @@ -184,22 +263,25 @@ - + + + + - + diff --git a/MediaBrowser.Model/MediaInfo/AudioCodec.cs b/MediaBrowser.Model/MediaInfo/AudioCodec.cs new file mode 100644 index 000000000..a76c0e742 --- /dev/null +++ b/MediaBrowser.Model/MediaInfo/AudioCodec.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.MediaInfo +{ + public class AudioCodec + { + public const string AAC = "AAC"; + public const string MP3 = "MP3"; + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs b/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs index 01e75e6f8..963e8dd95 100644 --- a/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs +++ b/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs @@ -34,11 +34,4 @@ namespace MediaBrowser.Model.MediaInfo /// The chapters. public List Chapters { get; set; } } - - public enum TransportStreamTimestamp - { - None, - Zero, - Valid - } } diff --git a/MediaBrowser.Model/MediaInfo/Constants.cs b/MediaBrowser.Model/MediaInfo/Constants.cs deleted file mode 100644 index 8f2e36b39..000000000 --- a/MediaBrowser.Model/MediaInfo/Constants.cs +++ /dev/null @@ -1,29 +0,0 @@ - -namespace MediaBrowser.Model.MediaInfo -{ - public class Container - { - public const string MP4 = "MP4"; - } - - public class AudioCodec - { - public const string AAC = "AAC"; - public const string MP3 = "MP3"; - } - - public class VideoCodec - { - public const string H263 = "H263"; - public const string H264 = "H264"; - public const string H265 = "H265"; - public const string MPEG4 = "MPEG4"; - public const string MSMPEG4 = "MSMPEG4"; - public const string VC1 = "VC1"; - } - - public class SubtitleFormat - { - public const string SRT = "SRT"; - } -} diff --git a/MediaBrowser.Model/MediaInfo/Container.cs b/MediaBrowser.Model/MediaInfo/Container.cs new file mode 100644 index 000000000..0305b9cfa --- /dev/null +++ b/MediaBrowser.Model/MediaInfo/Container.cs @@ -0,0 +1,8 @@ + +namespace MediaBrowser.Model.MediaInfo +{ + public class Container + { + public const string MP4 = "MP4"; + } +} diff --git a/MediaBrowser.Model/MediaInfo/SubtitleFormat.cs b/MediaBrowser.Model/MediaInfo/SubtitleFormat.cs new file mode 100644 index 000000000..51a0dbc9e --- /dev/null +++ b/MediaBrowser.Model/MediaInfo/SubtitleFormat.cs @@ -0,0 +1,7 @@ +namespace MediaBrowser.Model.MediaInfo +{ + public class SubtitleFormat + { + public const string SRT = "SRT"; + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/MediaInfo/TransportStreamTimestamp.cs b/MediaBrowser.Model/MediaInfo/TransportStreamTimestamp.cs new file mode 100644 index 000000000..4c808a8dc --- /dev/null +++ b/MediaBrowser.Model/MediaInfo/TransportStreamTimestamp.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.MediaInfo +{ + public enum TransportStreamTimestamp + { + None, + Zero, + Valid + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/MediaInfo/VideoCodec.cs b/MediaBrowser.Model/MediaInfo/VideoCodec.cs new file mode 100644 index 000000000..7405eb13e --- /dev/null +++ b/MediaBrowser.Model/MediaInfo/VideoCodec.cs @@ -0,0 +1,12 @@ +namespace MediaBrowser.Model.MediaInfo +{ + public class VideoCodec + { + public const string H263 = "H263"; + public const string H264 = "H264"; + public const string H265 = "H265"; + public const string MPEG4 = "MPEG4"; + public const string MSMPEG4 = "MSMPEG4"; + public const string VC1 = "VC1"; + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/News/NewsChannel.cs b/MediaBrowser.Model/News/NewsChannel.cs new file mode 100644 index 000000000..c3955b0a0 --- /dev/null +++ b/MediaBrowser.Model/News/NewsChannel.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.News +{ + public class NewsChannel + { + public string Title { get; set; } + public string Link { get; set; } + public string Description { get; set; } + public List Items { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/News/NewsItem.cs b/MediaBrowser.Model/News/NewsItem.cs index 181f43db7..2a05c420a 100644 --- a/MediaBrowser.Model/News/NewsItem.cs +++ b/MediaBrowser.Model/News/NewsItem.cs @@ -1,16 +1,7 @@ using System; -using System.Collections.Generic; namespace MediaBrowser.Model.News { - public class NewsChannel - { - public string Title { get; set; } - public string Link { get; set; } - public string Description { get; set; } - public List Items { get; set; } - } - public class NewsItem { public string Title { get; set; } @@ -20,11 +11,4 @@ namespace MediaBrowser.Model.News public string Guid { get; set; } public DateTime Date { get; set; } } - - public class NewsQuery - { - public int? StartIndex { get; set; } - - public int? Limit { get; set; } - } } diff --git a/MediaBrowser.Model/News/NewsQuery.cs b/MediaBrowser.Model/News/NewsQuery.cs new file mode 100644 index 000000000..567888921 --- /dev/null +++ b/MediaBrowser.Model/News/NewsQuery.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.News +{ + public class NewsQuery + { + public int? StartIndex { get; set; } + + public int? Limit { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Notifications/Notification.cs b/MediaBrowser.Model/Notifications/Notification.cs index d894911e7..731c3d303 100644 --- a/MediaBrowser.Model/Notifications/Notification.cs +++ b/MediaBrowser.Model/Notifications/Notification.cs @@ -1,6 +1,4 @@ -using MediaBrowser.Model.Configuration; -using System; -using System.Collections.Generic; +using System; namespace MediaBrowser.Model.Notifications { @@ -27,70 +25,4 @@ namespace MediaBrowser.Model.Notifications Date = DateTime.UtcNow; } } - - public class NotificationRequest - { - public string Name { get; set; } - - public string Description { get; set; } - - public string Url { get; set; } - - public NotificationLevel Level { get; set; } - - public List UserIds { get; set; } - - public DateTime Date { get; set; } - - /// - /// The corresponding type name used in configuration. Not for display. - /// - public string NotificationType { get; set; } - - public Dictionary Variables { get; set; } - - public SendToUserType? SendToUserMode { get; set; } - - public List ExcludeUserIds { get; set; } - - public NotificationRequest() - { - UserIds = new List(); - Date = DateTime.UtcNow; - - Variables = new Dictionary(StringComparer.OrdinalIgnoreCase); - - ExcludeUserIds = new List(); - } - } - - public class NotificationTypeInfo - { - public string Type { get; set; } - - public string Name { get; set; } - - public bool Enabled { get; set; } - - public string Category { get; set; } - - public bool IsBasedOnUserEvent { get; set; } - - public string DefaultTitle { get; set; } - - public string DefaultDescription { get; set; } - - public List Variables { get; set; } - - public NotificationTypeInfo() - { - Variables = new List(); - } - } - - public class NotificationServiceInfo - { - public string Name { get; set; } - public string Id { get; set; } - } } diff --git a/MediaBrowser.Model/Notifications/NotificationRequest.cs b/MediaBrowser.Model/Notifications/NotificationRequest.cs new file mode 100644 index 000000000..d47e9c4f2 --- /dev/null +++ b/MediaBrowser.Model/Notifications/NotificationRequest.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using MediaBrowser.Model.Configuration; + +namespace MediaBrowser.Model.Notifications +{ + public class NotificationRequest + { + public string Name { get; set; } + + public string Description { get; set; } + + public string Url { get; set; } + + public NotificationLevel Level { get; set; } + + public List UserIds { get; set; } + + public DateTime Date { get; set; } + + /// + /// The corresponding type name used in configuration. Not for display. + /// + public string NotificationType { get; set; } + + public Dictionary Variables { get; set; } + + public SendToUserType? SendToUserMode { get; set; } + + public List ExcludeUserIds { get; set; } + + public NotificationRequest() + { + UserIds = new List(); + Date = DateTime.UtcNow; + + Variables = new Dictionary(StringComparer.OrdinalIgnoreCase); + + ExcludeUserIds = new List(); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Notifications/NotificationServiceInfo.cs b/MediaBrowser.Model/Notifications/NotificationServiceInfo.cs new file mode 100644 index 000000000..0ffe7d4ae --- /dev/null +++ b/MediaBrowser.Model/Notifications/NotificationServiceInfo.cs @@ -0,0 +1,8 @@ +namespace MediaBrowser.Model.Notifications +{ + public class NotificationServiceInfo + { + public string Name { get; set; } + public string Id { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs b/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs new file mode 100644 index 000000000..59b39fbc7 --- /dev/null +++ b/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.Notifications +{ + public class NotificationTypeInfo + { + public string Type { get; set; } + + public string Name { get; set; } + + public bool Enabled { get; set; } + + public string Category { get; set; } + + public bool IsBasedOnUserEvent { get; set; } + + public string DefaultTitle { get; set; } + + public string DefaultDescription { get; set; } + + public List Variables { get; set; } + + public NotificationTypeInfo() + { + Variables = new List(); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Providers/ExternalIdInfo.cs b/MediaBrowser.Model/Providers/ExternalIdInfo.cs index e041f06af..2c5cfe91b 100644 --- a/MediaBrowser.Model/Providers/ExternalIdInfo.cs +++ b/MediaBrowser.Model/Providers/ExternalIdInfo.cs @@ -21,19 +21,4 @@ namespace MediaBrowser.Model.Providers /// The URL format string. public string UrlFormatString { get; set; } } - - public class ExternalUrl - { - /// - /// Gets or sets the name. - /// - /// The name. - public string Name { get; set; } - - /// - /// Gets or sets the type of the item. - /// - /// The type of the item. - public string Url { get; set; } - } } diff --git a/MediaBrowser.Model/Providers/ExternalUrl.cs b/MediaBrowser.Model/Providers/ExternalUrl.cs new file mode 100644 index 000000000..fb744f446 --- /dev/null +++ b/MediaBrowser.Model/Providers/ExternalUrl.cs @@ -0,0 +1,17 @@ +namespace MediaBrowser.Model.Providers +{ + public class ExternalUrl + { + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// Gets or sets the type of the item. + /// + /// The type of the item. + public string Url { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Providers/RemoteImageQuery.cs b/MediaBrowser.Model/Providers/RemoteImageQuery.cs new file mode 100644 index 000000000..8d5231a25 --- /dev/null +++ b/MediaBrowser.Model/Providers/RemoteImageQuery.cs @@ -0,0 +1,15 @@ +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Model.Providers +{ + public class RemoteImageQuery + { + public string ProviderName { get; set; } + + public ImageType? ImageType { get; set; } + + public bool IncludeDisabledProviders { get; set; } + + public bool IncludeAllLanguages { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Providers/RemoteImageResult.cs b/MediaBrowser.Model/Providers/RemoteImageResult.cs index ed2788c0b..1c60db6ae 100644 --- a/MediaBrowser.Model/Providers/RemoteImageResult.cs +++ b/MediaBrowser.Model/Providers/RemoteImageResult.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using MediaBrowser.Model.Entities; namespace MediaBrowser.Model.Providers { @@ -26,15 +25,4 @@ namespace MediaBrowser.Model.Providers /// The providers. public List Providers { get; set; } } - - public class RemoteImageQuery - { - public string ProviderName { get; set; } - - public ImageType? ImageType { get; set; } - - public bool IncludeDisabledProviders { get; set; } - - public bool IncludeAllLanguages { get; set; } - } } diff --git a/MediaBrowser.Model/Querying/AllThemeMediaResult.cs b/MediaBrowser.Model/Querying/AllThemeMediaResult.cs new file mode 100644 index 000000000..89640eb65 --- /dev/null +++ b/MediaBrowser.Model/Querying/AllThemeMediaResult.cs @@ -0,0 +1,20 @@ +namespace MediaBrowser.Model.Querying +{ + public class AllThemeMediaResult + { + public ThemeMediaResult ThemeVideosResult { get; set; } + + public ThemeMediaResult ThemeSongsResult { get; set; } + + public ThemeMediaResult SoundtrackSongsResult { get; set; } + + public AllThemeMediaResult() + { + ThemeVideosResult = new ThemeMediaResult(); + + ThemeSongsResult = new ThemeMediaResult(); + + SoundtrackSongsResult = new ThemeMediaResult(); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Querying/EpisodeQuery.cs b/MediaBrowser.Model/Querying/EpisodeQuery.cs index 589b46433..e2fc3220a 100644 --- a/MediaBrowser.Model/Querying/EpisodeQuery.cs +++ b/MediaBrowser.Model/Querying/EpisodeQuery.cs @@ -22,24 +22,4 @@ namespace MediaBrowser.Model.Querying Fields = new ItemFields[] { }; } } - - public class SeasonQuery - { - public string UserId { get; set; } - - public string SeriesId { get; set; } - - public bool? IsMissing { get; set; } - - public bool? IsVirtualUnaired { get; set; } - - public ItemFields[] Fields { get; set; } - - public bool? IsSpecialSeason { get; set; } - - public SeasonQuery() - { - Fields = new ItemFields[] { }; - } - } } diff --git a/MediaBrowser.Model/Querying/NextUpQuery.cs b/MediaBrowser.Model/Querying/NextUpQuery.cs index 913fae4d9..0e9c9882f 100644 --- a/MediaBrowser.Model/Querying/NextUpQuery.cs +++ b/MediaBrowser.Model/Querying/NextUpQuery.cs @@ -39,38 +39,4 @@ namespace MediaBrowser.Model.Querying /// The fields. public ItemFields[] Fields { get; set; } } - - public class UpcomingEpisodesQuery - { - /// - /// Gets or sets the user id. - /// - /// The user id. - public string UserId { get; set; } - - /// - /// Gets or sets the parent identifier. - /// - /// The parent identifier. - public string ParentId { get; set; } - - /// - /// Skips over a given number of items within the results. Use for paging. - /// - /// The start index. - public int? StartIndex { get; set; } - - /// - /// The maximum number of items to return - /// - /// The limit. - public int? Limit { get; set; } - - /// - /// Fields to return within the items, in addition to basic information - /// - /// The fields. - public ItemFields[] Fields { get; set; } - } - } diff --git a/MediaBrowser.Model/Querying/SeasonQuery.cs b/MediaBrowser.Model/Querying/SeasonQuery.cs new file mode 100644 index 000000000..b1fe635bb --- /dev/null +++ b/MediaBrowser.Model/Querying/SeasonQuery.cs @@ -0,0 +1,22 @@ +namespace MediaBrowser.Model.Querying +{ + public class SeasonQuery + { + public string UserId { get; set; } + + public string SeriesId { get; set; } + + public bool? IsMissing { get; set; } + + public bool? IsVirtualUnaired { get; set; } + + public ItemFields[] Fields { get; set; } + + public bool? IsSpecialSeason { get; set; } + + public SeasonQuery() + { + Fields = new ItemFields[] { }; + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Querying/SimilarItemsByNameQuery.cs b/MediaBrowser.Model/Querying/SimilarItemsByNameQuery.cs new file mode 100644 index 000000000..7d0d4da31 --- /dev/null +++ b/MediaBrowser.Model/Querying/SimilarItemsByNameQuery.cs @@ -0,0 +1,29 @@ +namespace MediaBrowser.Model.Querying +{ + public class SimilarItemsByNameQuery + { + /// + /// The user to localize search results for + /// + /// The user id. + public string UserId { get; set; } + + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// The maximum number of items to return + /// + /// The limit. + public int? Limit { get; set; } + + /// + /// Fields to return within the items, in addition to basic information + /// + /// The fields. + public ItemFields[] Fields { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Querying/SimilarItemsQuery.cs b/MediaBrowser.Model/Querying/SimilarItemsQuery.cs index d792aa76d..0dd491550 100644 --- a/MediaBrowser.Model/Querying/SimilarItemsQuery.cs +++ b/MediaBrowser.Model/Querying/SimilarItemsQuery.cs @@ -26,31 +26,4 @@ /// The fields. public ItemFields[] Fields { get; set; } } - - public class SimilarItemsByNameQuery - { - /// - /// The user to localize search results for - /// - /// The user id. - public string UserId { get; set; } - - /// - /// Gets or sets the name. - /// - /// The name. - public string Name { get; set; } - - /// - /// The maximum number of items to return - /// - /// The limit. - public int? Limit { get; set; } - - /// - /// Fields to return within the items, in addition to basic information - /// - /// The fields. - public ItemFields[] Fields { get; set; } - } } diff --git a/MediaBrowser.Model/Querying/ThemeMediaResult.cs b/MediaBrowser.Model/Querying/ThemeMediaResult.cs new file mode 100644 index 000000000..80478a910 --- /dev/null +++ b/MediaBrowser.Model/Querying/ThemeMediaResult.cs @@ -0,0 +1,15 @@ + +namespace MediaBrowser.Model.Querying +{ + /// + /// Class ThemeMediaResult + /// + public class ThemeMediaResult : ItemsResult + { + /// + /// Gets or sets the owner id. + /// + /// The owner id. + public string OwnerId { get; set; } + } +} diff --git a/MediaBrowser.Model/Querying/ThemeSongsResult.cs b/MediaBrowser.Model/Querying/ThemeSongsResult.cs deleted file mode 100644 index 9b0a1c61b..000000000 --- a/MediaBrowser.Model/Querying/ThemeSongsResult.cs +++ /dev/null @@ -1,33 +0,0 @@ - -namespace MediaBrowser.Model.Querying -{ - /// - /// Class ThemeMediaResult - /// - public class ThemeMediaResult : ItemsResult - { - /// - /// Gets or sets the owner id. - /// - /// The owner id. - public string OwnerId { get; set; } - } - - public class AllThemeMediaResult - { - public ThemeMediaResult ThemeVideosResult { get; set; } - - public ThemeMediaResult ThemeSongsResult { get; set; } - - public ThemeMediaResult SoundtrackSongsResult { get; set; } - - public AllThemeMediaResult() - { - ThemeVideosResult = new ThemeMediaResult(); - - ThemeSongsResult = new ThemeMediaResult(); - - SoundtrackSongsResult = new ThemeMediaResult(); - } - } -} diff --git a/MediaBrowser.Model/Querying/UpcomingEpisodesQuery.cs b/MediaBrowser.Model/Querying/UpcomingEpisodesQuery.cs new file mode 100644 index 000000000..e5a875e88 --- /dev/null +++ b/MediaBrowser.Model/Querying/UpcomingEpisodesQuery.cs @@ -0,0 +1,35 @@ +namespace MediaBrowser.Model.Querying +{ + public class UpcomingEpisodesQuery + { + /// + /// Gets or sets the user id. + /// + /// The user id. + public string UserId { get; set; } + + /// + /// Gets or sets the parent identifier. + /// + /// The parent identifier. + public string ParentId { get; set; } + + /// + /// Skips over a given number of items within the results. Use for paging. + /// + /// The start index. + public int? StartIndex { get; set; } + + /// + /// The maximum number of items to return + /// + /// The limit. + public int? Limit { get; set; } + + /// + /// Fields to return within the items, in addition to basic information + /// + /// The fields. + public ItemFields[] Fields { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Session/ClientCapabilities.cs b/MediaBrowser.Model/Session/ClientCapabilities.cs new file mode 100644 index 000000000..5bee06087 --- /dev/null +++ b/MediaBrowser.Model/Session/ClientCapabilities.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.Session +{ + public class ClientCapabilities + { + public List PlayableMediaTypes { get; set; } + public List SupportedCommands { get; set; } + + public ClientCapabilities() + { + PlayableMediaTypes = new List(); + SupportedCommands = new List(); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Session/GeneralCommand.cs b/MediaBrowser.Model/Session/GeneralCommand.cs index 98b3c50b3..7e818245d 100644 --- a/MediaBrowser.Model/Session/GeneralCommand.cs +++ b/MediaBrowser.Model/Session/GeneralCommand.cs @@ -16,40 +16,4 @@ namespace MediaBrowser.Model.Session Arguments = new Dictionary(StringComparer.OrdinalIgnoreCase); } } - - /// - /// This exists simply to identify a set of known commands. - /// - public enum GeneralCommandType - { - MoveUp = 0, - MoveDown = 1, - MoveLeft = 2, - MoveRight = 3, - PageUp = 4, - PageDown = 5, - PreviousLetter = 6, - NextLetter = 7, - ToggleOsd = 8, - ToggleContextMenu = 9, - Select = 10, - Back = 11, - TakeScreenshot = 12, - SendKey = 13, - SendString = 14, - GoHome = 15, - GoToSettings = 16, - VolumeUp = 17, - VolumeDown = 18, - Mute = 19, - Unmute = 20, - ToggleMute = 21, - SetVolume = 22, - SetAudioStreamIndex = 23, - SetSubtitleStreamIndex = 24, - ToggleFullscreen = 25, - DisplayContent = 26, - GoToSearch = 27, - DisplayMessage = 28 - } } diff --git a/MediaBrowser.Model/Session/GeneralCommandType.cs b/MediaBrowser.Model/Session/GeneralCommandType.cs new file mode 100644 index 000000000..f8773a246 --- /dev/null +++ b/MediaBrowser.Model/Session/GeneralCommandType.cs @@ -0,0 +1,38 @@ +namespace MediaBrowser.Model.Session +{ + /// + /// This exists simply to identify a set of known commands. + /// + public enum GeneralCommandType + { + MoveUp = 0, + MoveDown = 1, + MoveLeft = 2, + MoveRight = 3, + PageUp = 4, + PageDown = 5, + PreviousLetter = 6, + NextLetter = 7, + ToggleOsd = 8, + ToggleContextMenu = 9, + Select = 10, + Back = 11, + TakeScreenshot = 12, + SendKey = 13, + SendString = 14, + GoHome = 15, + GoToSettings = 16, + VolumeUp = 17, + VolumeDown = 18, + Mute = 19, + Unmute = 20, + ToggleMute = 21, + SetVolume = 22, + SetAudioStreamIndex = 23, + SetSubtitleStreamIndex = 24, + ToggleFullscreen = 25, + DisplayContent = 26, + GoToSearch = 27, + DisplayMessage = 28 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Session/PlayCommand.cs b/MediaBrowser.Model/Session/PlayCommand.cs new file mode 100644 index 000000000..3a5a951d7 --- /dev/null +++ b/MediaBrowser.Model/Session/PlayCommand.cs @@ -0,0 +1,29 @@ +namespace MediaBrowser.Model.Session +{ + /// + /// Enum PlayCommand + /// + public enum PlayCommand + { + /// + /// The play now + /// + PlayNow = 0, + /// + /// The play next + /// + PlayNext = 1, + /// + /// The play last + /// + PlayLast = 2, + /// + /// The play instant mix + /// + PlayInstantMix = 3, + /// + /// The play shuffle + /// + PlayShuffle = 4 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Session/PlayMethod.cs b/MediaBrowser.Model/Session/PlayMethod.cs new file mode 100644 index 000000000..87b728627 --- /dev/null +++ b/MediaBrowser.Model/Session/PlayMethod.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.Session +{ + public enum PlayMethod + { + Transcode = 0, + DirectStream = 1, + DirectPlay = 2 + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Session/PlayRequest.cs b/MediaBrowser.Model/Session/PlayRequest.cs index 74d7a70a3..5db5e90cb 100644 --- a/MediaBrowser.Model/Session/PlayRequest.cs +++ b/MediaBrowser.Model/Session/PlayRequest.cs @@ -30,31 +30,4 @@ namespace MediaBrowser.Model.Session /// The controlling user identifier. public string ControllingUserId { get; set; } } - - /// - /// Enum PlayCommand - /// - public enum PlayCommand - { - /// - /// The play now - /// - PlayNow = 0, - /// - /// The play next - /// - PlayNext = 1, - /// - /// The play last - /// - PlayLast = 2, - /// - /// The play instant mix - /// - PlayInstantMix = 3, - /// - /// The play shuffle - /// - PlayShuffle = 4 - } } \ No newline at end of file diff --git a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs new file mode 100644 index 000000000..f04dea1ea --- /dev/null +++ b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs @@ -0,0 +1,82 @@ +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Model.Session +{ + /// + /// Class PlaybackProgressInfo. + /// + public class PlaybackProgressInfo + { + /// + /// Gets or sets a value indicating whether this instance can seek. + /// + /// true if this instance can seek; otherwise, false. + public bool CanSeek { get; set; } + + /// + /// Gets or sets the item. + /// + /// The item. + public BaseItemInfo Item { get; set; } + + /// + /// Gets or sets the item identifier. + /// + /// The item identifier. + public string ItemId { get; set; } + + /// + /// Gets or sets the session id. + /// + /// The session id. + public string SessionId { get; set; } + + /// + /// Gets or sets the media version identifier. + /// + /// The media version identifier. + public string MediaSourceId { get; set; } + + /// + /// Gets or sets the index of the audio stream. + /// + /// The index of the audio stream. + public int? AudioStreamIndex { get; set; } + + /// + /// Gets or sets the index of the subtitle stream. + /// + /// The index of the subtitle stream. + public int? SubtitleStreamIndex { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is paused. + /// + /// true if this instance is paused; otherwise, false. + public bool IsPaused { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is muted. + /// + /// true if this instance is muted; otherwise, false. + public bool IsMuted { get; set; } + + /// + /// Gets or sets the position ticks. + /// + /// The position ticks. + public long? PositionTicks { get; set; } + + /// + /// Gets or sets the volume level. + /// + /// The volume level. + public int? VolumeLevel { get; set; } + + /// + /// Gets or sets the play method. + /// + /// The play method. + public PlayMethod PlayMethod { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Session/PlaybackReports.cs b/MediaBrowser.Model/Session/PlaybackReports.cs deleted file mode 100644 index 93960076e..000000000 --- a/MediaBrowser.Model/Session/PlaybackReports.cs +++ /dev/null @@ -1,143 +0,0 @@ -using MediaBrowser.Model.Entities; -using System.Collections.Generic; - -namespace MediaBrowser.Model.Session -{ - /// - /// Class PlaybackStartInfo. - /// - public class PlaybackStartInfo : PlaybackProgressInfo - { - public PlaybackStartInfo() - { - QueueableMediaTypes = new List(); - } - - /// - /// Gets or sets the queueable media types. - /// - /// The queueable media types. - public List QueueableMediaTypes { get; set; } - } - - /// - /// Class PlaybackProgressInfo. - /// - public class PlaybackProgressInfo - { - /// - /// Gets or sets a value indicating whether this instance can seek. - /// - /// true if this instance can seek; otherwise, false. - public bool CanSeek { get; set; } - - /// - /// Gets or sets the item. - /// - /// The item. - public BaseItemInfo Item { get; set; } - - /// - /// Gets or sets the item identifier. - /// - /// The item identifier. - public string ItemId { get; set; } - - /// - /// Gets or sets the session id. - /// - /// The session id. - public string SessionId { get; set; } - - /// - /// Gets or sets the media version identifier. - /// - /// The media version identifier. - public string MediaSourceId { get; set; } - - /// - /// Gets or sets the index of the audio stream. - /// - /// The index of the audio stream. - public int? AudioStreamIndex { get; set; } - - /// - /// Gets or sets the index of the subtitle stream. - /// - /// The index of the subtitle stream. - public int? SubtitleStreamIndex { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is paused. - /// - /// true if this instance is paused; otherwise, false. - public bool IsPaused { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is muted. - /// - /// true if this instance is muted; otherwise, false. - public bool IsMuted { get; set; } - - /// - /// Gets or sets the position ticks. - /// - /// The position ticks. - public long? PositionTicks { get; set; } - - /// - /// Gets or sets the volume level. - /// - /// The volume level. - public int? VolumeLevel { get; set; } - - /// - /// Gets or sets the play method. - /// - /// The play method. - public PlayMethod PlayMethod { get; set; } - } - - public enum PlayMethod - { - Transcode = 0, - DirectStream = 1, - DirectPlay = 2 - } - - /// - /// Class PlaybackStopInfo. - /// - public class PlaybackStopInfo - { - /// - /// Gets or sets the item. - /// - /// The item. - public BaseItemInfo Item { get; set; } - - /// - /// Gets or sets the item identifier. - /// - /// The item identifier. - public string ItemId { get; set; } - - /// - /// Gets or sets the session id. - /// - /// The session id. - public string SessionId { get; set; } - - /// - /// Gets or sets the media version identifier. - /// - /// The media version identifier. - public string MediaSourceId { get; set; } - - /// - /// Gets or sets the position ticks. - /// - /// The position ticks. - public long? PositionTicks { get; set; } - } -} diff --git a/MediaBrowser.Model/Session/PlaybackStartInfo.cs b/MediaBrowser.Model/Session/PlaybackStartInfo.cs new file mode 100644 index 000000000..d1ea2841e --- /dev/null +++ b/MediaBrowser.Model/Session/PlaybackStartInfo.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.Session +{ + /// + /// Class PlaybackStartInfo. + /// + public class PlaybackStartInfo : PlaybackProgressInfo + { + public PlaybackStartInfo() + { + QueueableMediaTypes = new List(); + } + + /// + /// Gets or sets the queueable media types. + /// + /// The queueable media types. + public List QueueableMediaTypes { get; set; } + } +} diff --git a/MediaBrowser.Model/Session/PlaybackStopInfo.cs b/MediaBrowser.Model/Session/PlaybackStopInfo.cs new file mode 100644 index 000000000..38025f183 --- /dev/null +++ b/MediaBrowser.Model/Session/PlaybackStopInfo.cs @@ -0,0 +1,40 @@ +using MediaBrowser.Model.Entities; + +namespace MediaBrowser.Model.Session +{ + /// + /// Class PlaybackStopInfo. + /// + public class PlaybackStopInfo + { + /// + /// Gets or sets the item. + /// + /// The item. + public BaseItemInfo Item { get; set; } + + /// + /// Gets or sets the item identifier. + /// + /// The item identifier. + public string ItemId { get; set; } + + /// + /// Gets or sets the session id. + /// + /// The session id. + public string SessionId { get; set; } + + /// + /// Gets or sets the media version identifier. + /// + /// The media version identifier. + public string MediaSourceId { get; set; } + + /// + /// Gets or sets the position ticks. + /// + /// The position ticks. + public long? PositionTicks { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Session/PlayerStateInfo.cs b/MediaBrowser.Model/Session/PlayerStateInfo.cs new file mode 100644 index 000000000..c9afef8e0 --- /dev/null +++ b/MediaBrowser.Model/Session/PlayerStateInfo.cs @@ -0,0 +1,59 @@ +namespace MediaBrowser.Model.Session +{ + public class PlayerStateInfo + { + /// + /// Gets or sets the now playing position ticks. + /// + /// The now playing position ticks. + public long? PositionTicks { get; set; } + + /// + /// Gets or sets a value indicating whether this instance can seek. + /// + /// true if this instance can seek; otherwise, false. + public bool CanSeek { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is paused. + /// + /// true if this instance is paused; otherwise, false. + public bool IsPaused { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is muted. + /// + /// true if this instance is muted; otherwise, false. + public bool IsMuted { get; set; } + + /// + /// Gets or sets the volume level. + /// + /// The volume level. + public int? VolumeLevel { get; set; } + + /// + /// Gets or sets the index of the now playing audio stream. + /// + /// The index of the now playing audio stream. + public int? AudioStreamIndex { get; set; } + + /// + /// Gets or sets the index of the now playing subtitle stream. + /// + /// The index of the now playing subtitle stream. + public int? SubtitleStreamIndex { get; set; } + + /// + /// Gets or sets the now playing media version identifier. + /// + /// The now playing media version identifier. + public string MediaSourceId { get; set; } + + /// + /// Gets or sets the play method. + /// + /// The play method. + public PlayMethod? PlayMethod { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Session/PlaystateCommand.cs b/MediaBrowser.Model/Session/PlaystateCommand.cs index 6466c6485..2af4f26e3 100644 --- a/MediaBrowser.Model/Session/PlaystateCommand.cs +++ b/MediaBrowser.Model/Session/PlaystateCommand.cs @@ -39,17 +39,4 @@ namespace MediaBrowser.Model.Session /// FastForward } - - public class PlaystateRequest - { - public PlaystateCommand Command { get; set; } - - public long? SeekPositionTicks { get; set; } - - /// - /// Gets or sets the controlling user identifier. - /// - /// The controlling user identifier. - public string ControllingUserId { get; set; } - } } \ No newline at end of file diff --git a/MediaBrowser.Model/Session/PlaystateRequest.cs b/MediaBrowser.Model/Session/PlaystateRequest.cs new file mode 100644 index 000000000..8a046b503 --- /dev/null +++ b/MediaBrowser.Model/Session/PlaystateRequest.cs @@ -0,0 +1,15 @@ +namespace MediaBrowser.Model.Session +{ + public class PlaystateRequest + { + public PlaystateCommand Command { get; set; } + + public long? SeekPositionTicks { get; set; } + + /// + /// Gets or sets the controlling user identifier. + /// + /// The controlling user identifier. + public string ControllingUserId { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Session/SessionInfoDto.cs b/MediaBrowser.Model/Session/SessionInfoDto.cs index 0dc119500..46e214d24 100644 --- a/MediaBrowser.Model/Session/SessionInfoDto.cs +++ b/MediaBrowser.Model/Session/SessionInfoDto.cs @@ -148,90 +148,4 @@ namespace MediaBrowser.Model.Session SupportedCommands = new List(); } } - - /// - /// Class SessionUserInfo. - /// - public class SessionUserInfo - { - /// - /// Gets or sets the user identifier. - /// - /// The user identifier. - public string UserId { get; set; } - /// - /// Gets or sets the name of the user. - /// - /// The name of the user. - public string UserName { get; set; } - } - - public class ClientCapabilities - { - public List PlayableMediaTypes { get; set; } - public List SupportedCommands { get; set; } - - public ClientCapabilities() - { - PlayableMediaTypes = new List(); - SupportedCommands = new List(); - } - } - - public class PlayerStateInfo - { - /// - /// Gets or sets the now playing position ticks. - /// - /// The now playing position ticks. - public long? PositionTicks { get; set; } - - /// - /// Gets or sets a value indicating whether this instance can seek. - /// - /// true if this instance can seek; otherwise, false. - public bool CanSeek { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is paused. - /// - /// true if this instance is paused; otherwise, false. - public bool IsPaused { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is muted. - /// - /// true if this instance is muted; otherwise, false. - public bool IsMuted { get; set; } - - /// - /// Gets or sets the volume level. - /// - /// The volume level. - public int? VolumeLevel { get; set; } - - /// - /// Gets or sets the index of the now playing audio stream. - /// - /// The index of the now playing audio stream. - public int? AudioStreamIndex { get; set; } - - /// - /// Gets or sets the index of the now playing subtitle stream. - /// - /// The index of the now playing subtitle stream. - public int? SubtitleStreamIndex { get; set; } - - /// - /// Gets or sets the now playing media version identifier. - /// - /// The now playing media version identifier. - public string MediaSourceId { get; set; } - - /// - /// Gets or sets the play method. - /// - /// The play method. - public PlayMethod? PlayMethod { get; set; } - } } diff --git a/MediaBrowser.Model/Session/SessionUserInfo.cs b/MediaBrowser.Model/Session/SessionUserInfo.cs new file mode 100644 index 000000000..39b96931a --- /dev/null +++ b/MediaBrowser.Model/Session/SessionUserInfo.cs @@ -0,0 +1,19 @@ +namespace MediaBrowser.Model.Session +{ + /// + /// Class SessionUserInfo. + /// + public class SessionUserInfo + { + /// + /// Gets or sets the user identifier. + /// + /// The user identifier. + public string UserId { get; set; } + /// + /// Gets or sets the name of the user. + /// + /// The name of the user. + public string UserName { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Model/Themes/AppTheme.cs b/MediaBrowser.Model/Themes/AppTheme.cs index a814fec33..40a729963 100644 --- a/MediaBrowser.Model/Themes/AppTheme.cs +++ b/MediaBrowser.Model/Themes/AppTheme.cs @@ -20,11 +20,4 @@ namespace MediaBrowser.Model.Themes Images = new List(); } } - - public class AppThemeInfo - { - public string AppName { get; set; } - - public string Name { get; set; } - } } diff --git a/MediaBrowser.Model/Themes/AppThemeInfo.cs b/MediaBrowser.Model/Themes/AppThemeInfo.cs new file mode 100644 index 000000000..bc359530a --- /dev/null +++ b/MediaBrowser.Model/Themes/AppThemeInfo.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.Themes +{ + public class AppThemeInfo + { + public string AppName { get; set; } + + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs b/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs index 834fbcd31..915a27c11 100644 --- a/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs +++ b/MediaBrowser.Server.Implementations/Collections/CollectionsDynamicFolder.cs @@ -1,7 +1,6 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Entities; using System.IO; -using System.Linq; namespace MediaBrowser.Server.Implementations.Collections { @@ -26,30 +25,4 @@ namespace MediaBrowser.Server.Implementations.Collections }; } } - - public class ManualCollectionsFolder : BasePluginFolder - { - public ManualCollectionsFolder() - { - Name = "Collections"; - } - - public override bool IsVisible(User user) - { - if (!GetChildren(user, true).Any()) - { - return false; - } - - return base.IsVisible(user); - } - - public override bool IsHidden - { - get - { - return !ActualChildren.Any() || base.IsHidden; - } - } - } } diff --git a/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs b/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs new file mode 100644 index 000000000..e36c63b1c --- /dev/null +++ b/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs @@ -0,0 +1,31 @@ +using System.Linq; +using MediaBrowser.Controller.Entities; + +namespace MediaBrowser.Server.Implementations.Collections +{ + public class ManualCollectionsFolder : BasePluginFolder + { + public ManualCollectionsFolder() + { + Name = "Collections"; + } + + public override bool IsVisible(User user) + { + if (!GetChildren(user, true).Any()) + { + return false; + } + + return base.IsVisible(user); + } + + public override bool IsHidden + { + get + { + return !ActualChildren.Any() || base.IsHidden; + } + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs new file mode 100644 index 000000000..9d2de0f6d --- /dev/null +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifications.cs @@ -0,0 +1,381 @@ +using MediaBrowser.Common.Events; +using MediaBrowser.Common.Plugins; +using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Common.Updates; +using MediaBrowser.Controller; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Notifications; +using MediaBrowser.Controller.Plugins; +using MediaBrowser.Controller.Session; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.Logging; +using MediaBrowser.Model.Notifications; +using MediaBrowser.Model.Tasks; +using MediaBrowser.Model.Updates; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications +{ + /// + /// Creates notifications for various system events + /// + public class Notifications : IServerEntryPoint + { + private readonly IInstallationManager _installationManager; + private readonly IUserManager _userManager; + private readonly ILogger _logger; + + private readonly ITaskManager _taskManager; + private readonly INotificationManager _notificationManager; + + private readonly IServerConfigurationManager _config; + private readonly ILibraryManager _libraryManager; + private readonly ISessionManager _sessionManager; + private readonly IServerApplicationHost _appHost; + + private Timer LibraryUpdateTimer { get; set; } + private readonly object _libraryChangedSyncLock = new object(); + + public Notifications(IInstallationManager installationManager, IUserManager userManager, ILogger logger, ITaskManager taskManager, INotificationManager notificationManager, IServerConfigurationManager config, ILibraryManager libraryManager, ISessionManager sessionManager, IServerApplicationHost appHost) + { + _installationManager = installationManager; + _userManager = userManager; + _logger = logger; + _taskManager = taskManager; + _notificationManager = notificationManager; + _config = config; + _libraryManager = libraryManager; + _sessionManager = sessionManager; + _appHost = appHost; + } + + public void Run() + { + _installationManager.PluginInstalled += _installationManager_PluginInstalled; + _installationManager.PluginUpdated += _installationManager_PluginUpdated; + _installationManager.PackageInstallationFailed += _installationManager_PackageInstallationFailed; + _installationManager.PluginUninstalled += _installationManager_PluginUninstalled; + + _taskManager.TaskCompleted += _taskManager_TaskCompleted; + + _userManager.UserCreated += _userManager_UserCreated; + _libraryManager.ItemAdded += _libraryManager_ItemAdded; + _sessionManager.PlaybackStart += _sessionManager_PlaybackStart; + _appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged; + _appHost.HasUpdateAvailableChanged += _appHost_HasUpdateAvailableChanged; + _appHost.ApplicationUpdated += _appHost_ApplicationUpdated; + } + + async void _appHost_ApplicationUpdated(object sender, GenericEventArgs e) + { + var type = NotificationType.ApplicationUpdateInstalled.ToString(); + + var notification = new NotificationRequest + { + NotificationType = type + }; + + notification.Variables["Version"] = e.Argument.versionStr; + notification.Variables["ReleaseNotes"] = e.Argument.description; + + await SendNotification(notification).ConfigureAwait(false); + } + + async void _installationManager_PluginUpdated(object sender, GenericEventArgs> e) + { + var type = NotificationType.PluginUpdateInstalled.ToString(); + + var installationInfo = e.Argument.Item1; + + var notification = new NotificationRequest + { + Description = installationInfo.Description, + NotificationType = type + }; + + notification.Variables["Name"] = installationInfo.Name; + notification.Variables["Version"] = installationInfo.Version.ToString(); + notification.Variables["ReleaseNotes"] = e.Argument.Item2.description; + + await SendNotification(notification).ConfigureAwait(false); + } + + async void _installationManager_PluginInstalled(object sender, GenericEventArgs e) + { + var type = NotificationType.PluginInstalled.ToString(); + + var installationInfo = e.Argument; + + var notification = new NotificationRequest + { + Description = installationInfo.description, + NotificationType = type + }; + + notification.Variables["Name"] = installationInfo.name; + notification.Variables["Version"] = installationInfo.versionStr; + + await SendNotification(notification).ConfigureAwait(false); + } + + async void _appHost_HasUpdateAvailableChanged(object sender, EventArgs e) + { + // This notification is for users who can't auto-update (aka running as service) + if (!_appHost.HasUpdateAvailable || _appHost.CanSelfUpdate) + { + return; + } + + var type = NotificationType.ApplicationUpdateAvailable.ToString(); + + var notification = new NotificationRequest + { + Description = "Please see mediabrowser3.com for details.", + NotificationType = type + }; + + await SendNotification(notification).ConfigureAwait(false); + } + + async void _appHost_HasPendingRestartChanged(object sender, EventArgs e) + { + if (!_appHost.HasPendingRestart) + { + return; + } + + var type = NotificationType.ServerRestartRequired.ToString(); + + var notification = new NotificationRequest + { + NotificationType = type + }; + + await SendNotification(notification).ConfigureAwait(false); + } + + async void _sessionManager_PlaybackStart(object sender, PlaybackProgressEventArgs e) + { + var user = e.Users.FirstOrDefault(); + + var item = e.MediaInfo; + + if (item == null) + { + _logger.Warn("PlaybackStart reported with null media info."); + return; + } + + if (e.Item != null && e.Item.Parent == null) + { + // Don't report theme song or local trailer playback + // TODO: This will also cause movie specials to not be reported + return; + } + + var notification = new NotificationRequest + { + NotificationType = GetPlaybackNotificationType(item.MediaType), + + ExcludeUserIds = e.Users.Select(i => i.Id.ToString("N")).ToList() + }; + + notification.Variables["ItemName"] = item.Name; + notification.Variables["UserName"] = user == null ? "Unknown user" : user.Name; + notification.Variables["AppName"] = e.ClientName; + notification.Variables["DeviceName"] = e.DeviceName; + + await SendNotification(notification).ConfigureAwait(false); + } + + private string GetPlaybackNotificationType(string mediaType) + { + if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase)) + { + return NotificationType.AudioPlayback.ToString(); + } + if (string.Equals(mediaType, MediaType.Game, StringComparison.OrdinalIgnoreCase)) + { + return NotificationType.GamePlayback.ToString(); + } + if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)) + { + return NotificationType.VideoPlayback.ToString(); + } + + return null; + } + + private readonly List _itemsAdded = new List(); + void _libraryManager_ItemAdded(object sender, ItemChangeEventArgs e) + { + if (e.Item.LocationType == LocationType.FileSystem && !e.Item.IsFolder) + { + lock (_libraryChangedSyncLock) + { + if (LibraryUpdateTimer == null) + { + LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, 5000, + Timeout.Infinite); + } + else + { + LibraryUpdateTimer.Change(5000, Timeout.Infinite); + } + + _itemsAdded.Add(e.Item); + } + } + } + + private async void LibraryUpdateTimerCallback(object state) + { + List items; + + lock (_libraryChangedSyncLock) + { + items = _itemsAdded.ToList(); + _itemsAdded.Clear(); + DisposeLibraryUpdateTimer(); + } + + var item = items.FirstOrDefault(); + + if (item != null) + { + var notification = new NotificationRequest + { + NotificationType = NotificationType.NewLibraryContent.ToString() + }; + + notification.Variables["Name"] = item.Name; + + if (items.Count > 1) + { + notification.Name = items.Count + " new library items."; + } + + await SendNotification(notification).ConfigureAwait(false); + } + } + + async void _userManager_UserCreated(object sender, GenericEventArgs e) + { + var notification = new NotificationRequest + { + UserIds = new List { e.Argument.Id.ToString("N") }, + Name = "Welcome to Media Browser!", + Description = "Check back here for more notifications." + }; + + await SendNotification(notification).ConfigureAwait(false); + } + + async void _taskManager_TaskCompleted(object sender, GenericEventArgs e) + { + var result = e.Argument; + + if (result.Status == TaskCompletionStatus.Failed) + { + var type = NotificationType.TaskFailed.ToString(); + + var notification = new NotificationRequest + { + Description = result.ErrorMessage, + Level = NotificationLevel.Error, + NotificationType = type + }; + + notification.Variables["Name"] = e.Argument.Name; + notification.Variables["ErrorMessage"] = e.Argument.ErrorMessage; + + await SendNotification(notification).ConfigureAwait(false); + } + } + + async void _installationManager_PluginUninstalled(object sender, GenericEventArgs e) + { + var type = NotificationType.PluginUninstalled.ToString(); + + var plugin = e.Argument; + + var notification = new NotificationRequest + { + NotificationType = type + }; + + notification.Variables["Name"] = plugin.Name; + notification.Variables["Version"] = plugin.Version.ToString(); + + await SendNotification(notification).ConfigureAwait(false); + } + + async void _installationManager_PackageInstallationFailed(object sender, InstallationFailedEventArgs e) + { + var installationInfo = e.InstallationInfo; + + var type = NotificationType.InstallationFailed.ToString(); + + var notification = new NotificationRequest + { + Level = NotificationLevel.Error, + Description = e.Exception.Message, + NotificationType = type + }; + + notification.Variables["Name"] = installationInfo.Name; + notification.Variables["Version"] = installationInfo.Version; + + await SendNotification(notification).ConfigureAwait(false); + } + + private async Task SendNotification(NotificationRequest notification) + { + try + { + await _notificationManager.SendNotification(notification, CancellationToken.None).ConfigureAwait(false); + } + catch (Exception ex) + { + _logger.ErrorException("Error sending notification", ex); + } + } + + public void Dispose() + { + DisposeLibraryUpdateTimer(); + + _installationManager.PluginInstalled -= _installationManager_PluginInstalled; + _installationManager.PluginUpdated -= _installationManager_PluginUpdated; + _installationManager.PackageInstallationFailed -= _installationManager_PackageInstallationFailed; + _installationManager.PluginUninstalled -= _installationManager_PluginUninstalled; + + _taskManager.TaskCompleted -= _taskManager_TaskCompleted; + + _userManager.UserCreated -= _userManager_UserCreated; + _libraryManager.ItemAdded -= _libraryManager_ItemAdded; + _sessionManager.PlaybackStart -= _sessionManager_PlaybackStart; + + _appHost.HasPendingRestartChanged -= _appHost_HasPendingRestartChanged; + _appHost.HasUpdateAvailableChanged -= _appHost_HasUpdateAvailableChanged; + _appHost.ApplicationUpdated -= _appHost_ApplicationUpdated; + } + + private void DisposeLibraryUpdateTimer() + { + if (LibraryUpdateTimer != null) + { + LibraryUpdateTimer.Dispose(); + LibraryUpdateTimer = null; + } + } + } +} diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs deleted file mode 100644 index 9d2de0f6d..000000000 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs +++ /dev/null @@ -1,381 +0,0 @@ -using MediaBrowser.Common.Events; -using MediaBrowser.Common.Plugins; -using MediaBrowser.Common.ScheduledTasks; -using MediaBrowser.Common.Updates; -using MediaBrowser.Controller; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Notifications; -using MediaBrowser.Controller.Plugins; -using MediaBrowser.Controller.Session; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Events; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Notifications; -using MediaBrowser.Model.Tasks; -using MediaBrowser.Model.Updates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications -{ - /// - /// Creates notifications for various system events - /// - public class Notifications : IServerEntryPoint - { - private readonly IInstallationManager _installationManager; - private readonly IUserManager _userManager; - private readonly ILogger _logger; - - private readonly ITaskManager _taskManager; - private readonly INotificationManager _notificationManager; - - private readonly IServerConfigurationManager _config; - private readonly ILibraryManager _libraryManager; - private readonly ISessionManager _sessionManager; - private readonly IServerApplicationHost _appHost; - - private Timer LibraryUpdateTimer { get; set; } - private readonly object _libraryChangedSyncLock = new object(); - - public Notifications(IInstallationManager installationManager, IUserManager userManager, ILogger logger, ITaskManager taskManager, INotificationManager notificationManager, IServerConfigurationManager config, ILibraryManager libraryManager, ISessionManager sessionManager, IServerApplicationHost appHost) - { - _installationManager = installationManager; - _userManager = userManager; - _logger = logger; - _taskManager = taskManager; - _notificationManager = notificationManager; - _config = config; - _libraryManager = libraryManager; - _sessionManager = sessionManager; - _appHost = appHost; - } - - public void Run() - { - _installationManager.PluginInstalled += _installationManager_PluginInstalled; - _installationManager.PluginUpdated += _installationManager_PluginUpdated; - _installationManager.PackageInstallationFailed += _installationManager_PackageInstallationFailed; - _installationManager.PluginUninstalled += _installationManager_PluginUninstalled; - - _taskManager.TaskCompleted += _taskManager_TaskCompleted; - - _userManager.UserCreated += _userManager_UserCreated; - _libraryManager.ItemAdded += _libraryManager_ItemAdded; - _sessionManager.PlaybackStart += _sessionManager_PlaybackStart; - _appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged; - _appHost.HasUpdateAvailableChanged += _appHost_HasUpdateAvailableChanged; - _appHost.ApplicationUpdated += _appHost_ApplicationUpdated; - } - - async void _appHost_ApplicationUpdated(object sender, GenericEventArgs e) - { - var type = NotificationType.ApplicationUpdateInstalled.ToString(); - - var notification = new NotificationRequest - { - NotificationType = type - }; - - notification.Variables["Version"] = e.Argument.versionStr; - notification.Variables["ReleaseNotes"] = e.Argument.description; - - await SendNotification(notification).ConfigureAwait(false); - } - - async void _installationManager_PluginUpdated(object sender, GenericEventArgs> e) - { - var type = NotificationType.PluginUpdateInstalled.ToString(); - - var installationInfo = e.Argument.Item1; - - var notification = new NotificationRequest - { - Description = installationInfo.Description, - NotificationType = type - }; - - notification.Variables["Name"] = installationInfo.Name; - notification.Variables["Version"] = installationInfo.Version.ToString(); - notification.Variables["ReleaseNotes"] = e.Argument.Item2.description; - - await SendNotification(notification).ConfigureAwait(false); - } - - async void _installationManager_PluginInstalled(object sender, GenericEventArgs e) - { - var type = NotificationType.PluginInstalled.ToString(); - - var installationInfo = e.Argument; - - var notification = new NotificationRequest - { - Description = installationInfo.description, - NotificationType = type - }; - - notification.Variables["Name"] = installationInfo.name; - notification.Variables["Version"] = installationInfo.versionStr; - - await SendNotification(notification).ConfigureAwait(false); - } - - async void _appHost_HasUpdateAvailableChanged(object sender, EventArgs e) - { - // This notification is for users who can't auto-update (aka running as service) - if (!_appHost.HasUpdateAvailable || _appHost.CanSelfUpdate) - { - return; - } - - var type = NotificationType.ApplicationUpdateAvailable.ToString(); - - var notification = new NotificationRequest - { - Description = "Please see mediabrowser3.com for details.", - NotificationType = type - }; - - await SendNotification(notification).ConfigureAwait(false); - } - - async void _appHost_HasPendingRestartChanged(object sender, EventArgs e) - { - if (!_appHost.HasPendingRestart) - { - return; - } - - var type = NotificationType.ServerRestartRequired.ToString(); - - var notification = new NotificationRequest - { - NotificationType = type - }; - - await SendNotification(notification).ConfigureAwait(false); - } - - async void _sessionManager_PlaybackStart(object sender, PlaybackProgressEventArgs e) - { - var user = e.Users.FirstOrDefault(); - - var item = e.MediaInfo; - - if (item == null) - { - _logger.Warn("PlaybackStart reported with null media info."); - return; - } - - if (e.Item != null && e.Item.Parent == null) - { - // Don't report theme song or local trailer playback - // TODO: This will also cause movie specials to not be reported - return; - } - - var notification = new NotificationRequest - { - NotificationType = GetPlaybackNotificationType(item.MediaType), - - ExcludeUserIds = e.Users.Select(i => i.Id.ToString("N")).ToList() - }; - - notification.Variables["ItemName"] = item.Name; - notification.Variables["UserName"] = user == null ? "Unknown user" : user.Name; - notification.Variables["AppName"] = e.ClientName; - notification.Variables["DeviceName"] = e.DeviceName; - - await SendNotification(notification).ConfigureAwait(false); - } - - private string GetPlaybackNotificationType(string mediaType) - { - if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase)) - { - return NotificationType.AudioPlayback.ToString(); - } - if (string.Equals(mediaType, MediaType.Game, StringComparison.OrdinalIgnoreCase)) - { - return NotificationType.GamePlayback.ToString(); - } - if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)) - { - return NotificationType.VideoPlayback.ToString(); - } - - return null; - } - - private readonly List _itemsAdded = new List(); - void _libraryManager_ItemAdded(object sender, ItemChangeEventArgs e) - { - if (e.Item.LocationType == LocationType.FileSystem && !e.Item.IsFolder) - { - lock (_libraryChangedSyncLock) - { - if (LibraryUpdateTimer == null) - { - LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, 5000, - Timeout.Infinite); - } - else - { - LibraryUpdateTimer.Change(5000, Timeout.Infinite); - } - - _itemsAdded.Add(e.Item); - } - } - } - - private async void LibraryUpdateTimerCallback(object state) - { - List items; - - lock (_libraryChangedSyncLock) - { - items = _itemsAdded.ToList(); - _itemsAdded.Clear(); - DisposeLibraryUpdateTimer(); - } - - var item = items.FirstOrDefault(); - - if (item != null) - { - var notification = new NotificationRequest - { - NotificationType = NotificationType.NewLibraryContent.ToString() - }; - - notification.Variables["Name"] = item.Name; - - if (items.Count > 1) - { - notification.Name = items.Count + " new library items."; - } - - await SendNotification(notification).ConfigureAwait(false); - } - } - - async void _userManager_UserCreated(object sender, GenericEventArgs e) - { - var notification = new NotificationRequest - { - UserIds = new List { e.Argument.Id.ToString("N") }, - Name = "Welcome to Media Browser!", - Description = "Check back here for more notifications." - }; - - await SendNotification(notification).ConfigureAwait(false); - } - - async void _taskManager_TaskCompleted(object sender, GenericEventArgs e) - { - var result = e.Argument; - - if (result.Status == TaskCompletionStatus.Failed) - { - var type = NotificationType.TaskFailed.ToString(); - - var notification = new NotificationRequest - { - Description = result.ErrorMessage, - Level = NotificationLevel.Error, - NotificationType = type - }; - - notification.Variables["Name"] = e.Argument.Name; - notification.Variables["ErrorMessage"] = e.Argument.ErrorMessage; - - await SendNotification(notification).ConfigureAwait(false); - } - } - - async void _installationManager_PluginUninstalled(object sender, GenericEventArgs e) - { - var type = NotificationType.PluginUninstalled.ToString(); - - var plugin = e.Argument; - - var notification = new NotificationRequest - { - NotificationType = type - }; - - notification.Variables["Name"] = plugin.Name; - notification.Variables["Version"] = plugin.Version.ToString(); - - await SendNotification(notification).ConfigureAwait(false); - } - - async void _installationManager_PackageInstallationFailed(object sender, InstallationFailedEventArgs e) - { - var installationInfo = e.InstallationInfo; - - var type = NotificationType.InstallationFailed.ToString(); - - var notification = new NotificationRequest - { - Level = NotificationLevel.Error, - Description = e.Exception.Message, - NotificationType = type - }; - - notification.Variables["Name"] = installationInfo.Name; - notification.Variables["Version"] = installationInfo.Version; - - await SendNotification(notification).ConfigureAwait(false); - } - - private async Task SendNotification(NotificationRequest notification) - { - try - { - await _notificationManager.SendNotification(notification, CancellationToken.None).ConfigureAwait(false); - } - catch (Exception ex) - { - _logger.ErrorException("Error sending notification", ex); - } - } - - public void Dispose() - { - DisposeLibraryUpdateTimer(); - - _installationManager.PluginInstalled -= _installationManager_PluginInstalled; - _installationManager.PluginUpdated -= _installationManager_PluginUpdated; - _installationManager.PackageInstallationFailed -= _installationManager_PackageInstallationFailed; - _installationManager.PluginUninstalled -= _installationManager_PluginUninstalled; - - _taskManager.TaskCompleted -= _taskManager_TaskCompleted; - - _userManager.UserCreated -= _userManager_UserCreated; - _libraryManager.ItemAdded -= _libraryManager_ItemAdded; - _sessionManager.PlaybackStart -= _sessionManager_PlaybackStart; - - _appHost.HasPendingRestartChanged -= _appHost_HasPendingRestartChanged; - _appHost.HasUpdateAvailableChanged -= _appHost_HasUpdateAvailableChanged; - _appHost.ApplicationUpdated -= _appHost_ApplicationUpdated; - } - - private void DisposeLibraryUpdateTimer() - { - if (LibraryUpdateTimer != null) - { - LibraryUpdateTimer.Dispose(); - LibraryUpdateTimer = null; - } - } - } -} diff --git a/MediaBrowser.Server.Implementations/HttpServer/DelReceiveWebRequest.cs b/MediaBrowser.Server.Implementations/HttpServer/DelReceiveWebRequest.cs new file mode 100644 index 000000000..235910fed --- /dev/null +++ b/MediaBrowser.Server.Implementations/HttpServer/DelReceiveWebRequest.cs @@ -0,0 +1,6 @@ +using System.Net; + +namespace MediaBrowser.Server.Implementations.HttpServer +{ + public delegate void DelReceiveWebRequest(HttpListenerContext context); +} \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/HttpServer/GetSwaggerResource.cs b/MediaBrowser.Server.Implementations/HttpServer/GetSwaggerResource.cs new file mode 100644 index 000000000..36a257f63 --- /dev/null +++ b/MediaBrowser.Server.Implementations/HttpServer/GetSwaggerResource.cs @@ -0,0 +1,17 @@ +using ServiceStack; + +namespace MediaBrowser.Server.Implementations.HttpServer +{ + /// + /// Class GetDashboardResource + /// + [Route("/swagger-ui/{ResourceName*}", "GET")] + public class GetSwaggerResource + { + /// + /// Gets or sets the name. + /// + /// The name. + public string ResourceName { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs index cfe5ef4f0..0fc9265f6 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -25,8 +25,6 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.HttpServer { - public delegate void DelReceiveWebRequest(HttpListenerContext context); - public class HttpListenerHost : ServiceStackHost, IHttpServer { private string ServerName { get; set; } diff --git a/MediaBrowser.Server.Implementations/HttpServer/ServerLogFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/ServerLogFactory.cs new file mode 100644 index 000000000..40af3f3b0 --- /dev/null +++ b/MediaBrowser.Server.Implementations/HttpServer/ServerLogFactory.cs @@ -0,0 +1,46 @@ +using System; +using MediaBrowser.Model.Logging; +using ServiceStack.Logging; + +namespace MediaBrowser.Server.Implementations.HttpServer +{ + /// + /// Class ServerLogFactory + /// + public class ServerLogFactory : ILogFactory + { + /// + /// The _log manager + /// + private readonly ILogManager _logManager; + + /// + /// Initializes a new instance of the class. + /// + /// The log manager. + public ServerLogFactory(ILogManager logManager) + { + _logManager = logManager; + } + + /// + /// Gets the logger. + /// + /// Name of the type. + /// ILog. + public ILog GetLogger(string typeName) + { + return new ServerLogger(_logManager.GetLogger(typeName)); + } + + /// + /// Gets the logger. + /// + /// The type. + /// ILog. + public ILog GetLogger(Type type) + { + return GetLogger(type.Name); + } + } +} \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs b/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs index 7a4f922ed..bf7924784 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/ServerLogger.cs @@ -4,46 +4,6 @@ using System; namespace MediaBrowser.Server.Implementations.HttpServer { - /// - /// Class ServerLogFactory - /// - public class ServerLogFactory : ILogFactory - { - /// - /// The _log manager - /// - private readonly ILogManager _logManager; - - /// - /// Initializes a new instance of the class. - /// - /// The log manager. - public ServerLogFactory(ILogManager logManager) - { - _logManager = logManager; - } - - /// - /// Gets the logger. - /// - /// Name of the type. - /// ILog. - public ILog GetLogger(string typeName) - { - return new ServerLogger(_logManager.GetLogger(typeName)); - } - - /// - /// Gets the logger. - /// - /// The type. - /// ILog. - public ILog GetLogger(Type type) - { - return GetLogger(type.Name); - } - } - /// /// Class ServerLogger /// diff --git a/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs b/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs index 8f8505933..3764697f1 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/SwaggerService.cs @@ -1,24 +1,10 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Net; -using ServiceStack; using ServiceStack.Web; using System.IO; namespace MediaBrowser.Server.Implementations.HttpServer { - /// - /// Class GetDashboardResource - /// - [Route("/swagger-ui/{ResourceName*}", "GET")] - public class GetSwaggerResource - { - /// - /// Gets or sets the name. - /// - /// The name. - public string ResourceName { get; set; } - } - public class SwaggerService : IHasResultFactory, IRestfulService { private readonly IApplicationPaths _appPaths; diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs deleted file mode 100644 index a03eda263..000000000 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs +++ /dev/null @@ -1,62 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Resolvers; - -namespace MediaBrowser.Server.Implementations.Library.Resolvers -{ - /// - /// Class ItemResolver - /// - /// - public abstract class ItemResolver : IItemResolver - where T : BaseItem, new() - { - /// - /// Resolves the specified args. - /// - /// The args. - /// `0. - protected virtual T Resolve(ItemResolveArgs args) - { - return null; - } - - /// - /// Gets the priority. - /// - /// The priority. - public virtual ResolverPriority Priority - { - get - { - return ResolverPriority.First; - } - } - - /// - /// Sets initial values on the newly resolved item - /// - /// The item. - /// The args. - protected virtual void SetInitialItemValues(T item, ItemResolveArgs args) - { - } - - /// - /// Resolves the path. - /// - /// The args. - /// BaseItem. - BaseItem IItemResolver.ResolvePath(ItemResolveArgs args) - { - var item = Resolve(args); - - if (item != null) - { - SetInitialItemValues(item, args); - } - - return item; - } - } -} diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/ItemResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/ItemResolver.cs new file mode 100644 index 000000000..a03eda263 --- /dev/null +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/ItemResolver.cs @@ -0,0 +1,62 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Resolvers; + +namespace MediaBrowser.Server.Implementations.Library.Resolvers +{ + /// + /// Class ItemResolver + /// + /// + public abstract class ItemResolver : IItemResolver + where T : BaseItem, new() + { + /// + /// Resolves the specified args. + /// + /// The args. + /// `0. + protected virtual T Resolve(ItemResolveArgs args) + { + return null; + } + + /// + /// Gets the priority. + /// + /// The priority. + public virtual ResolverPriority Priority + { + get + { + return ResolverPriority.First; + } + } + + /// + /// Sets initial values on the newly resolved item + /// + /// The item. + /// The args. + protected virtual void SetInitialItemValues(T item, ItemResolveArgs args) + { + } + + /// + /// Resolves the path. + /// + /// The args. + /// BaseItem. + BaseItem IItemResolver.ResolvePath(ItemResolveArgs args) + { + var item = Resolve(args); + + if (item != null) + { + SetInitialItemValues(item, args); + } + + return item; + } + } +} diff --git a/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs b/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs deleted file mode 100644 index edb4e7382..000000000 --- a/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs +++ /dev/null @@ -1,171 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Model.Dto; -using System; -using System.Collections.Generic; - -namespace MediaBrowser.Server.Implementations.Library.Validators -{ - /// - /// Class CountHelpers - /// - internal static class CountHelpers - { - private static CountType? GetCountType(BaseItem item) - { - if (item is Movie) - { - return CountType.Movie; - } - if (item is Episode) - { - return CountType.Episode; - } - if (item is Game) - { - return CountType.Game; - } - if (item is Audio) - { - return CountType.Song; - } - if (item is Trailer) - { - return CountType.Trailer; - } - if (item is Series) - { - return CountType.Series; - } - if (item is MusicAlbum) - { - return CountType.MusicAlbum; - } - if (item is MusicVideo) - { - return CountType.MusicVideo; - } - if (item is AdultVideo) - { - return CountType.AdultVideo; - } - - return null; - } - - /// - /// Increments the count. - /// - /// The counts. - /// The key. - internal static void IncrementCount(Dictionary counts, CountType key) - { - int count; - - if (counts.TryGetValue(key, out count)) - { - count++; - counts[key] = count; - } - else - { - counts.Add(key, 1); - } - } - - /// - /// Gets the counts. - /// - /// The counts. - /// ItemByNameCounts. - internal static ItemByNameCounts GetCounts(Dictionary counts) - { - return new ItemByNameCounts - { - AdultVideoCount = GetCount(counts, CountType.AdultVideo), - AlbumCount = GetCount(counts, CountType.MusicAlbum), - EpisodeCount = GetCount(counts, CountType.Episode), - GameCount = GetCount(counts, CountType.Game), - MovieCount = GetCount(counts, CountType.Movie), - MusicVideoCount = GetCount(counts, CountType.MusicVideo), - SeriesCount = GetCount(counts, CountType.Series), - SongCount = GetCount(counts, CountType.Song), - TrailerCount = GetCount(counts, CountType.Trailer), - TotalCount = GetCount(counts, CountType.Total) - }; - } - - /// - /// Gets the count. - /// - /// The counts. - /// The key. - /// System.Int32. - internal static int GetCount(Dictionary counts, CountType key) - { - int count; - - if (counts.TryGetValue(key, out count)) - { - return count; - } - - return 0; - } - - /// - /// Sets the item counts. - /// - /// The user id. - /// The media. - /// The names. - /// The master dictionary. - internal static void SetItemCounts(Guid userId, BaseItem media, IEnumerable names, Dictionary>> masterDictionary) - { - var countType = GetCountType(media); - - foreach (var name in names) - { - Dictionary> libraryCounts; - - if (!masterDictionary.TryGetValue(name, out libraryCounts)) - { - libraryCounts = new Dictionary>(); - masterDictionary.Add(name, libraryCounts); - } - - var userLibId = userId/* ?? Guid.Empty*/; - Dictionary userDictionary; - - if (!libraryCounts.TryGetValue(userLibId, out userDictionary)) - { - userDictionary = new Dictionary(); - libraryCounts.Add(userLibId, userDictionary); - } - - if (countType.HasValue) - { - IncrementCount(userDictionary, countType.Value); - } - - IncrementCount(userDictionary, CountType.Total); - } - } - } - - internal enum CountType - { - AdultVideo, - MusicAlbum, - Episode, - Game, - Movie, - MusicVideo, - Series, - Song, - Trailer, - Total - } -} diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index 74b8bf269..21fcd736f 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -104,6 +104,7 @@ + @@ -114,7 +115,7 @@ - + @@ -128,6 +129,8 @@ + + @@ -135,6 +138,7 @@ + @@ -149,7 +153,7 @@ - + @@ -163,7 +167,6 @@ - @@ -225,6 +228,7 @@ + diff --git a/MediaBrowser.Server.Implementations/Sorting/IsPlayedComparer.cs b/MediaBrowser.Server.Implementations/Sorting/IsPlayedComparer.cs new file mode 100644 index 000000000..aebfbdb1c --- /dev/null +++ b/MediaBrowser.Server.Implementations/Sorting/IsPlayedComparer.cs @@ -0,0 +1,58 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Sorting; +using MediaBrowser.Model.Querying; + +namespace MediaBrowser.Server.Implementations.Sorting +{ + public class IsPlayedComparer : IUserBaseItemComparer + { + /// + /// Gets or sets the user. + /// + /// The user. + public User User { get; set; } + + /// + /// Compares the specified x. + /// + /// The x. + /// The y. + /// System.Int32. + public int Compare(BaseItem x, BaseItem y) + { + return GetValue(x).CompareTo(GetValue(y)); + } + + /// + /// Gets the date. + /// + /// The x. + /// DateTime. + private int GetValue(BaseItem x) + { + return x.IsPlayed(User) ? 0 : 1; + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get { return ItemSortBy.IsUnplayed; } + } + + /// + /// Gets or sets the user data repository. + /// + /// The user data repository. + public IUserDataManager UserDataRepository { get; set; } + + /// + /// Gets or sets the user manager. + /// + /// The user manager. + public IUserManager UserManager { get; set; } + } +} \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Sorting/IsUnplayedComparer.cs b/MediaBrowser.Server.Implementations/Sorting/IsUnplayedComparer.cs index e3053155f..f1c6a5a4e 100644 --- a/MediaBrowser.Server.Implementations/Sorting/IsUnplayedComparer.cs +++ b/MediaBrowser.Server.Implementations/Sorting/IsUnplayedComparer.cs @@ -55,55 +55,4 @@ namespace MediaBrowser.Server.Implementations.Sorting /// The user manager. public IUserManager UserManager { get; set; } } - - public class IsPlayedComparer : IUserBaseItemComparer - { - /// - /// Gets or sets the user. - /// - /// The user. - public User User { get; set; } - - /// - /// Compares the specified x. - /// - /// The x. - /// The y. - /// System.Int32. - public int Compare(BaseItem x, BaseItem y) - { - return GetValue(x).CompareTo(GetValue(y)); - } - - /// - /// Gets the date. - /// - /// The x. - /// DateTime. - private int GetValue(BaseItem x) - { - return x.IsPlayed(User) ? 0 : 1; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get { return ItemSortBy.IsUnplayed; } - } - - /// - /// Gets or sets the user data repository. - /// - /// The user data repository. - public IUserDataManager UserDataRepository { get; set; } - - /// - /// Gets or sets the user manager. - /// - /// The user manager. - public IUserManager UserManager { get; set; } - } } -- cgit v1.2.3