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') 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 8aadbf35136874ac7a279f8bc0f3a4a02a131313 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 4 May 2014 20:46:52 -0400 Subject: support channel folders --- .../Channels/ChannelAudioItem.cs | 2 + .../Channels/ChannelCategoryItem.cs | 2 + MediaBrowser.Controller/Channels/ChannelInfo.cs | 30 ++++++++++++ .../Channels/ChannelItemInfo.cs | 10 ++++ .../Channels/ChannelVideoItem.cs | 2 + MediaBrowser.Controller/Channels/IChannel.cs | 25 ---------- MediaBrowser.Controller/Channels/IChannelItem.cs | 2 + .../MediaBrowser.Controller.csproj | 1 + .../MediaBrowser.Model.Portable.csproj | 6 +++ .../MediaBrowser.Model.net35.csproj | 6 +++ MediaBrowser.Model/MediaBrowser.Model.csproj | 1 + MediaBrowser.Model/MediaInfo/Constants.cs | 24 ++++++++++ .../Channels/ChannelManager.cs | 53 +++++++++++++--------- .../Library/Resolvers/Movies/MovieResolver.cs | 4 +- .../MediaBrowser.WebDashboard.csproj | 3 ++ 15 files changed, 123 insertions(+), 48 deletions(-) create mode 100644 MediaBrowser.Controller/Channels/ChannelInfo.cs create mode 100644 MediaBrowser.Model/MediaInfo/Constants.cs (limited to 'MediaBrowser.Server.Implementations/Library') diff --git a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs index a0999593f..72a996b19 100644 --- a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs @@ -8,6 +8,8 @@ namespace MediaBrowser.Controller.Channels { public string ExternalId { get; set; } + public string ChannelId { get; set; } + public ChannelItemType ChannelItemType { get; set; } public bool IsInfiniteStream { get; set; } diff --git a/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs b/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs index 67f0ec65f..b20dcf620 100644 --- a/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs @@ -7,6 +7,8 @@ namespace MediaBrowser.Controller.Channels { public string ExternalId { get; set; } + public string ChannelId { get; set; } + public ChannelItemType ChannelItemType { get; set; } public string OriginalImageUrl { get; set; } diff --git a/MediaBrowser.Controller/Channels/ChannelInfo.cs b/MediaBrowser.Controller/Channels/ChannelInfo.cs new file mode 100644 index 000000000..fd3a169a2 --- /dev/null +++ b/MediaBrowser.Controller/Channels/ChannelInfo.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Channels +{ + public class ChannelInfo + { + /// + /// Gets the home page URL. + /// + /// The home page URL. + public string HomePageUrl { get; set; } + + /// + /// Gets or sets a value indicating whether this instance can search. + /// + /// true if this instance can search; otherwise, false. + public bool CanSearch { get; set; } + + public List MediaTypes { get; set; } + + public List ContentTypes { get; set; } + + public ChannelInfo() + { + MediaTypes = new List(); + ContentTypes = new List(); + } + } + +} diff --git a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs index 104204eb0..e4abea4fc 100644 --- a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs +++ b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs @@ -88,6 +88,16 @@ namespace MediaBrowser.Controller.Channels public Dictionary RequiredHttpHeaders { get; set; } + public string Container { get; set; } + public string AudioCodec { get; set; } + public string VideoCodec { get; set; } + + public int? AudioBitrate { get; set; } + public int? VideoBitrate { get; set; } + public int? Width { get; set; } + public int? Height { get; set; } + public int? AudioChannels { get; set; } + public ChannelMediaInfo() { RequiredHttpHeaders = new Dictionary(); diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs index 0bf05f965..0d2bd933b 100644 --- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs +++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs @@ -10,6 +10,8 @@ namespace MediaBrowser.Controller.Channels { public string ExternalId { get; set; } + public string ChannelId { get; set; } + public ChannelItemType ChannelItemType { get; set; } public bool IsInfiniteStream { get; set; } diff --git a/MediaBrowser.Controller/Channels/IChannel.cs b/MediaBrowser.Controller/Channels/IChannel.cs index ca4b7f551..e19d083e2 100644 --- a/MediaBrowser.Controller/Channels/IChannel.cs +++ b/MediaBrowser.Controller/Channels/IChannel.cs @@ -66,31 +66,6 @@ namespace MediaBrowser.Controller.Channels IEnumerable GetChannels(); } - public class ChannelInfo - { - /// - /// Gets the home page URL. - /// - /// The home page URL. - public string HomePageUrl { get; set; } - - /// - /// Gets or sets a value indicating whether this instance can search. - /// - /// true if this instance can search; otherwise, false. - public bool CanSearch { get; set; } - - public List MediaTypes { get; set; } - - public List ContentTypes { get; set; } - - public ChannelInfo() - { - MediaTypes = new List(); - ContentTypes = new List(); - } - } - public class ChannelSearchInfo { public string SearchTerm { get; set; } diff --git a/MediaBrowser.Controller/Channels/IChannelItem.cs b/MediaBrowser.Controller/Channels/IChannelItem.cs index a05ef8e29..b653cead0 100644 --- a/MediaBrowser.Controller/Channels/IChannelItem.cs +++ b/MediaBrowser.Controller/Channels/IChannelItem.cs @@ -4,6 +4,8 @@ namespace MediaBrowser.Controller.Channels { public interface IChannelItem : IHasImages { + string ChannelId { get; set; } + string ExternalId { get; set; } ChannelItemType ChannelItemType { get; set; } diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index b54ad2272..830a4829f 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -69,6 +69,7 @@ Properties\SharedVersion.cs + diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index f6c8f6135..e8a802725 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -215,6 +215,9 @@ Entities\ChapterInfo.cs + + Entities\CollectionType.cs + Entities\DisplayPreferences.cs @@ -350,6 +353,9 @@ MediaInfo\BlurayDiscInfo.cs + + MediaInfo\Constants.cs + MediaInfo\IBlurayExaminer.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index 9845cb6b2..5fb5fae74 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -202,6 +202,9 @@ Entities\ChapterInfo.cs + + Entities\CollectionType.cs + Entities\DisplayPreferences.cs @@ -337,6 +340,9 @@ MediaInfo\BlurayDiscInfo.cs + + MediaInfo\Constants.cs + MediaInfo\IBlurayExaminer.cs diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 710e5f6b4..877eb5444 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -110,6 +110,7 @@ + diff --git a/MediaBrowser.Model/MediaInfo/Constants.cs b/MediaBrowser.Model/MediaInfo/Constants.cs new file mode 100644 index 000000000..bada7bc79 --- /dev/null +++ b/MediaBrowser.Model/MediaInfo/Constants.cs @@ -0,0 +1,24 @@ + +namespace MediaBrowser.Model.MediaInfo +{ + public class Container + { + public string MP4 = "MP4"; + } + + public class AudioCodec + { + public string AAC = "AAC"; + public string MP3 = "MP3"; + } + + public class VideoCodec + { + public string H263 = "H263"; + public string H264 = "H264"; + public string H265 = "H265"; + public string MPEG4 = "MPEG4"; + public string MSMPEG4 = "MSMPEG4"; + public string VC1 = "VC1"; + } +} diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index 662bbdf3e..f516c0878 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -220,14 +220,28 @@ namespace MediaBrowser.Server.Implementations.Channels ? null : _userManager.GetUserById(new Guid(query.UserId)); - var id = new Guid(query.ChannelId); - var channel = _channelEntities.First(i => i.Id == id); - var channelProvider = GetChannelProvider(channel); + var queryChannelId = query.ChannelId; + var channels = string.IsNullOrWhiteSpace(queryChannelId) + ? _channelEntities + : _channelEntities.Where(i => i.Id == new Guid(queryChannelId)); - var items = await GetChannelItems(channelProvider, user, query.CategoryId, cancellationToken) - .ConfigureAwait(false); + var itemTasks = channels.Select(async channel => + { + var channelProvider = GetChannelProvider(channel); + + var items = await GetChannelItems(channelProvider, user, query.CategoryId, cancellationToken) + .ConfigureAwait(false); + + var channelId = channel.Id.ToString("N"); + + var tasks = items.Select(i => GetChannelItemEntity(i, channelId, cancellationToken)); + + return await Task.WhenAll(tasks).ConfigureAwait(false); + }); - return await GetReturnItems(items, user, query, cancellationToken).ConfigureAwait(false); + var results = await Task.WhenAll(itemTasks).ConfigureAwait(false); + + return await GetReturnItems(results.SelectMany(i => i), user, query, cancellationToken).ConfigureAwait(false); } private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(1, 1); @@ -316,22 +330,13 @@ namespace MediaBrowser.Server.Implementations.Channels return Path.Combine(_config.ApplicationPaths.CachePath, channelId, categoryKey, user.Id.ToString("N") + ".json"); } - private async Task> GetReturnItems(IEnumerable items, User user, ChannelItemQuery query, CancellationToken cancellationToken) + private async Task> GetReturnItems(IEnumerable items, User user, ChannelItemQuery query, CancellationToken cancellationToken) { - // Get everything - var fields = Enum.GetNames(typeof(ItemFields)) - .Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)) - .ToList(); - - var tasks = items.Select(i => GetChannelItemEntity(i, cancellationToken)); - - IEnumerable entities = await Task.WhenAll(tasks).ConfigureAwait(false); + items = ApplyFilters(items, query.Filters, user); - entities = ApplyFilters(entities, query.Filters, user); + items = _libraryManager.Sort(items, user, query.SortBy, query.SortOrder ?? SortOrder.Ascending); - entities = _libraryManager.Sort(entities, user, query.SortBy, query.SortOrder ?? SortOrder.Ascending); - - var all = entities.ToList(); + var all = items.ToList(); var totalCount = all.Count; if (query.StartIndex.HasValue) @@ -345,6 +350,11 @@ namespace MediaBrowser.Server.Implementations.Channels await RefreshIfNeeded(all, cancellationToken).ConfigureAwait(false); + // Get everything + var fields = Enum.GetNames(typeof(ItemFields)) + .Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)) + .ToList(); + var returnItemArray = all.Select(i => _dtoService.GetBaseItemDto(i, fields, user)) .ToArray(); @@ -358,10 +368,10 @@ namespace MediaBrowser.Server.Implementations.Channels private string GetIdToHash(string externalId) { // Increment this as needed to force new downloads - return externalId + "3"; + return externalId + "4"; } - private async Task GetChannelItemEntity(ChannelItemInfo info, CancellationToken cancellationToken) + private async Task GetChannelItemEntity(ChannelItemInfo info, string internalChannnelId, CancellationToken cancellationToken) { BaseItem item; Guid id; @@ -434,6 +444,7 @@ namespace MediaBrowser.Server.Implementations.Channels channelItem.OriginalImageUrl = info.ImageUrl; channelItem.ExternalId = info.Id; + channelItem.ChannelId = internalChannnelId; channelItem.ChannelItemType = info.Type; var channelMediaItem = item as IChannelMediaItem; diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index 558087a25..905e6e676 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -381,7 +381,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { firstMovie.IsMultiPart = true; - _logger.Info("Multi-part video found: " + firstMovie.Path); + _logger.Debug("Multi-part video found: " + firstMovie.Path); return firstMovie; } @@ -411,7 +411,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { firstMovie.HasLocalAlternateVersions = true; - _logger.Info("Multi-version video found: " + firstMovie.Path); + _logger.Debug("Multi-version video found: " + firstMovie.Path); return firstMovie; } diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 540e54f3b..4b9dad90a 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -229,6 +229,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest -- 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') 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 f02c3260273a09f465c4e7a97d8b90f0f6909734 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 8 May 2014 16:09:53 -0400 Subject: Removed guids from the model project --- .../DefaultTheme/DefaultThemeService.cs | 6 +- MediaBrowser.Api/DefaultTheme/Models.cs | 2 +- MediaBrowser.Api/DisplayPreferencesService.cs | 11 +- MediaBrowser.Api/Images/ImageService.cs | 2 +- MediaBrowser.Api/PackageService.cs | 4 +- MediaBrowser.Api/SearchService.cs | 12 +- MediaBrowser.Api/UserLibrary/UserLibraryService.cs | 4 +- .../BaseApplicationHost.cs | 1 + .../ScheduledTasks/ScheduledTaskWorker.cs | 2 +- .../ScheduledTasks/TaskManager.cs | 1 + .../Updates/InstallationManager.cs | 8 +- MediaBrowser.Common/Events/GenericEventArgs.cs | 17 --- MediaBrowser.Common/IApplicationHost.cs | 4 +- MediaBrowser.Common/MediaBrowser.Common.csproj | 1 - MediaBrowser.Common/ScheduledTasks/ITaskManager.cs | 2 +- .../ScheduledTasks/ScheduledTaskHelpers.cs | 2 +- .../Updates/IInstallationManager.cs | 4 +- .../Configuration/IServerConfigurationManager.cs | 2 +- MediaBrowser.Controller/Drawing/IImageProcessor.cs | 8 +- MediaBrowser.Controller/Library/IUserManager.cs | 4 +- .../Persistence/IDisplayPreferencesRepository.cs | 2 +- .../Session/ISessionController.cs | 8 -- MediaBrowser.Dlna/Didl/DidlBuilder.cs | 6 +- MediaBrowser.Dlna/PlayTo/DlnaController.cs | 5 - .../MediaBrowser.Model.Portable.csproj | 3 + .../MediaBrowser.Model.net35.csproj | 3 + MediaBrowser.Model/ApiClient/IApiClient.cs | 38 +++++- MediaBrowser.Model/ApiClient/IServerEvents.cs | 55 +++++--- MediaBrowser.Model/ApiClient/ServerEventArgs.cs | 148 +-------------------- .../Configuration/MetadataOptions.cs | 6 +- .../Dlna/MediaFormatProfileResolver.cs | 5 +- MediaBrowser.Model/Dlna/StreamBuilder.cs | 118 ++++++++-------- MediaBrowser.Model/Dlna/StreamInfo.cs | 72 +++++----- MediaBrowser.Model/Drawing/DrawingUtils.cs | 35 +++-- MediaBrowser.Model/Dto/BaseItemDto.cs | 20 +-- MediaBrowser.Model/Dto/BaseItemPerson.cs | 4 +- MediaBrowser.Model/Dto/ChapterInfoDto.cs | 4 +- MediaBrowser.Model/Dto/ImageInfo.cs | 2 +- MediaBrowser.Model/Dto/ImageOptions.cs | 2 +- MediaBrowser.Model/Dto/ItemByNameCounts.cs | 2 +- MediaBrowser.Model/Dto/StudioDto.cs | 4 +- MediaBrowser.Model/Dto/UserDto.cs | 4 +- MediaBrowser.Model/Entities/BaseItemInfo.cs | 10 +- MediaBrowser.Model/Entities/DisplayPreferences.cs | 4 +- MediaBrowser.Model/Entities/LibraryUpdateInfo.cs | 20 +-- MediaBrowser.Model/Events/GenericEventArgs.cs | 17 +++ MediaBrowser.Model/LiveTv/ChannelInfoDto.cs | 4 +- MediaBrowser.Model/LiveTv/ProgramInfoDto.cs | 6 +- MediaBrowser.Model/LiveTv/RecordingInfoDto.cs | 6 +- MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs | 4 +- MediaBrowser.Model/MediaBrowser.Model.csproj | 1 + MediaBrowser.Model/Search/SearchHint.cs | 6 +- MediaBrowser.Model/Session/GeneralCommand.cs | 3 +- MediaBrowser.Model/Session/SessionInfoDto.cs | 2 +- MediaBrowser.Model/Tasks/TaskInfo.cs | 2 +- MediaBrowser.Model/Tasks/TaskResult.cs | 2 +- MediaBrowser.Model/Updates/InstallationInfo.cs | 2 +- MediaBrowser.Model/Updates/PackageVersionInfo.cs | 4 +- MediaBrowser.Model/Web/QueryStringDictionary.cs | 44 ------ .../MediaInfo/SubtitleDownloader.cs | 11 +- .../Subtitles/OpenSubtitleDownloader.cs | 4 +- .../Configuration/ServerConfigurationManager.cs | 1 + .../Drawing/ImageProcessor.cs | 8 +- .../Dto/DtoService.cs | 23 ++-- .../EntryPoints/LibraryChangedNotifier.cs | 10 +- .../EntryPoints/Notifications/Notifier.cs | 1 + .../EntryPoints/ServerEventNotifier.cs | 1 + .../Library/UserManager.cs | 1 + .../LiveTv/LiveTvDtoService.cs | 14 +- .../SqliteDisplayPreferencesRepository.cs | 12 +- .../Roku/RokuSessionController.cs | 10 -- .../Session/SessionManager.cs | 27 ++-- .../Session/WebSocketController.cs | 12 -- 73 files changed, 396 insertions(+), 519 deletions(-) delete mode 100644 MediaBrowser.Common/Events/GenericEventArgs.cs create mode 100644 MediaBrowser.Model/Events/GenericEventArgs.cs (limited to 'MediaBrowser.Server.Implementations/Library') diff --git a/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs b/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs index c9c4cbc43..cd04a8212 100644 --- a/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs +++ b/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs @@ -556,7 +556,7 @@ namespace MediaBrowser.Api.DefaultTheme // Avoid implicitly captured closure var currentUserId1 = user.Id; - + view.LatestMovies = movies .OrderByDescending(i => i.DateCreated) .Where(i => !_userDataManager.GetUserData(currentUserId1, i.GetUserDataKey()).Played) @@ -622,9 +622,9 @@ namespace MediaBrowser.Api.DefaultTheme { var tag = _imageProcessor.GetImageCacheTag(item, imageType); - if (tag.HasValue) + if (tag != null) { - stub.ImageTag = tag.Value; + stub.ImageTag = tag; } } catch (Exception ex) diff --git a/MediaBrowser.Api/DefaultTheme/Models.cs b/MediaBrowser.Api/DefaultTheme/Models.cs index f261a9aff..6cc7af499 100644 --- a/MediaBrowser.Api/DefaultTheme/Models.cs +++ b/MediaBrowser.Api/DefaultTheme/Models.cs @@ -9,7 +9,7 @@ namespace MediaBrowser.Api.DefaultTheme { public string Name { get; set; } public string Id { get; set; } - public Guid ImageTag { get; set; } + public string ImageTag { get; set; } public ImageType ImageType { get; set; } } diff --git a/MediaBrowser.Api/DisplayPreferencesService.cs b/MediaBrowser.Api/DisplayPreferencesService.cs index 4060b42b4..16aafafb0 100644 --- a/MediaBrowser.Api/DisplayPreferencesService.cs +++ b/MediaBrowser.Api/DisplayPreferencesService.cs @@ -77,15 +77,16 @@ namespace MediaBrowser.Api /// The request. public object Get(GetDisplayPreferences request) { - Guid displayPreferencesId; + var result = _displayPreferencesManager.GetDisplayPreferences(request.Id, request.UserId, request.Client); - if (!Guid.TryParse(request.Id, out displayPreferencesId)) + if (result == null) { - displayPreferencesId = request.Id.GetMD5(); + result = new DisplayPreferences + { + Id = request.Id + }; } - var result = _displayPreferencesManager.GetDisplayPreferences(displayPreferencesId, request.UserId, request.Client); - return ToOptimizedSerializedResultUsingCache(result); } diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index ce3eaf053..a760819d6 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -548,7 +548,7 @@ namespace MediaBrowser.Api.Images var contentType = GetMimeType(request.Format, imageInfo.Path); - var cacheGuid = _imageProcessor.GetImageCacheTag(item, request.Type, imageInfo.Path, originalFileImageDateModified, supportedImageEnhancers); + var cacheGuid = new Guid(_imageProcessor.GetImageCacheTag(item, request.Type, imageInfo.Path, originalFileImageDateModified, supportedImageEnhancers)); TimeSpan? cacheDuration = null; diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs index 948a67f16..0a8f0d83f 100644 --- a/MediaBrowser.Api/PackageService.cs +++ b/MediaBrowser.Api/PackageService.cs @@ -112,7 +112,7 @@ namespace MediaBrowser.Api /// /// The id. [ApiMember(Name = "Id", Description = "Installation Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] - public Guid Id { get; set; } + public string Id { get; set; } } /// @@ -221,7 +221,7 @@ namespace MediaBrowser.Api /// The request. public void Delete(CancelPackageInstallation request) { - var info = _installationManager.CurrentInstallations.FirstOrDefault(i => i.Item1.Id == request.Id); + var info = _installationManager.CurrentInstallations.FirstOrDefault(i => string.Equals(i.Item1.Id, request.Id)); if (info != null) { diff --git a/MediaBrowser.Api/SearchService.cs b/MediaBrowser.Api/SearchService.cs index 662c728e4..db646344a 100644 --- a/MediaBrowser.Api/SearchService.cs +++ b/MediaBrowser.Api/SearchService.cs @@ -171,9 +171,9 @@ namespace MediaBrowser.Api var primaryImageTag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary); - if (primaryImageTag.HasValue) + if (primaryImageTag != null) { - result.PrimaryImageTag = primaryImageTag.Value; + result.PrimaryImageTag = primaryImageTag; } SetThumbImageInfo(result, item); @@ -250,9 +250,9 @@ namespace MediaBrowser.Api { var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Thumb); - if (tag.HasValue) + if (tag != null) { - hint.ThumbImageTag = tag.Value; + hint.ThumbImageTag = tag; hint.ThumbImageItemId = itemWithImage.Id.ToString("N"); } } @@ -271,9 +271,9 @@ namespace MediaBrowser.Api { var tag = _imageProcessor.GetImageCacheTag(itemWithImage, ImageType.Backdrop); - if (tag.HasValue) + if (tag != null) { - hint.BackdropImageTag = tag.Value; + hint.BackdropImageTag = tag; hint.BackdropImageItemId = itemWithImage.Id.ToString("N"); } } diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs index d145dd054..008730ef6 100644 --- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs +++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Controller.Dto; +using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; @@ -8,7 +7,6 @@ using MediaBrowser.Controller.Session; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Session; using ServiceStack; using System; diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 4946241fd..e488fd9bf 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -13,6 +13,7 @@ using MediaBrowser.Common.Progress; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Common.Security; using MediaBrowser.Common.Updates; +using MediaBrowser.Model.Events; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs index 8f3f9b0a6..1e97de0c5 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs @@ -531,7 +531,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks EndTimeUtc = endTime, Status = status, Name = Name, - Id = Id + Id = Id.ToString("N") }; if (ex != null) diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs index 6605432fa..cead5de04 100644 --- a/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs +++ b/MediaBrowser.Common.Implementations/ScheduledTasks/TaskManager.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Events; using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Model.Events; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Tasks; diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs index 18462ba9b..92e5f894f 100644 --- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs +++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs @@ -5,6 +5,7 @@ using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Progress; using MediaBrowser.Common.Security; using MediaBrowser.Common.Updates; +using MediaBrowser.Model.Events; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Updates; @@ -367,7 +368,7 @@ namespace MediaBrowser.Common.Implementations.Updates var installationInfo = new InstallationInfo { - Id = Guid.NewGuid(), + Id = Guid.NewGuid().ToString("N"), Name = package.name, AssemblyGuid = package.guid, UpdateClass = package.classification, @@ -510,13 +511,14 @@ namespace MediaBrowser.Common.Implementations.Updates cancellationToken.ThrowIfCancellationRequested(); // Validate with a checksum - if (package.checksum != Guid.Empty) // support for legacy uploads for now + var packageChecksum = string.IsNullOrWhiteSpace(package.checksum) ? Guid.Empty : new Guid(package.checksum); + if (packageChecksum != Guid.Empty) // support for legacy uploads for now { using (var crypto = new MD5CryptoServiceProvider()) using (var stream = new BufferedStream(File.OpenRead(tempFile), 100000)) { var check = Guid.Parse(BitConverter.ToString(crypto.ComputeHash(stream)).Replace("-", String.Empty)); - if (check != package.checksum) + if (check != packageChecksum) { throw new ApplicationException(string.Format("Download validation failed for {0}. Probably corrupted during transfer.", package.name)); } diff --git a/MediaBrowser.Common/Events/GenericEventArgs.cs b/MediaBrowser.Common/Events/GenericEventArgs.cs deleted file mode 100644 index e7cf524d4..000000000 --- a/MediaBrowser.Common/Events/GenericEventArgs.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace MediaBrowser.Common.Events -{ - /// - /// Provides a generic EventArgs subclass that can hold any kind of object - /// - /// - public class GenericEventArgs : EventArgs - { - /// - /// Gets or sets the argument. - /// - /// The argument. - public T Argument { get; set; } - } -} diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index ecd099711..0e2fef1e6 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Common.Events; -using MediaBrowser.Common.Plugins; +using MediaBrowser.Common.Plugins; +using MediaBrowser.Model.Events; using MediaBrowser.Model.Updates; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index 5e0d3aa24..1da144649 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -59,7 +59,6 @@ - diff --git a/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs b/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs index 394872783..38548801b 100644 --- a/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs +++ b/MediaBrowser.Common/ScheduledTasks/ITaskManager.cs @@ -1,4 +1,4 @@ -using MediaBrowser.Common.Events; +using MediaBrowser.Model.Events; using MediaBrowser.Model.Tasks; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs b/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs index 4364153c9..92c44dea1 100644 --- a/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs +++ b/MediaBrowser.Common/ScheduledTasks/ScheduledTaskHelpers.cs @@ -38,7 +38,7 @@ namespace MediaBrowser.Common.ScheduledTasks Name = task.Name, CurrentProgressPercentage = task.CurrentProgress, State = task.State, - Id = task.Id, + Id = task.Id.ToString("N"), LastExecutionResult = task.LastExecutionResult, Triggers = task.Triggers.Select(GetTriggerInfo).ToList(), Description = task.Description, diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs index f162f8dc8..592613c54 100644 --- a/MediaBrowser.Common/Updates/IInstallationManager.cs +++ b/MediaBrowser.Common/Updates/IInstallationManager.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Common.Events; -using MediaBrowser.Common.Plugins; +using MediaBrowser.Common.Plugins; +using MediaBrowser.Model.Events; using MediaBrowser.Model.Updates; using System; using System.Collections.Concurrent; diff --git a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs index 535e74fee..6a2343a00 100644 --- a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs +++ b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs @@ -1,6 +1,6 @@ using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Events; using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Events; using System; namespace MediaBrowser.Controller.Configuration diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs index ad5e622fc..b0e44a200 100644 --- a/MediaBrowser.Controller/Drawing/IImageProcessor.cs +++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs @@ -55,7 +55,7 @@ namespace MediaBrowser.Controller.Drawing /// The item. /// The image. /// Guid. - Guid GetImageCacheTag(IHasImages item, ItemImageInfo image); + string GetImageCacheTag(IHasImages item, ItemImageInfo image); /// /// Gets the image cache tag. @@ -66,7 +66,7 @@ namespace MediaBrowser.Controller.Drawing /// The date modified. /// The image enhancers. /// Guid. - Guid GetImageCacheTag(IHasImages item, ImageType imageType, string originalImagePath, DateTime dateModified, + string GetImageCacheTag(IHasImages item, ImageType imageType, string originalImagePath, DateTime dateModified, List imageEnhancers); /// @@ -89,12 +89,12 @@ namespace MediaBrowser.Controller.Drawing public static class ImageProcessorExtensions { - public static Guid? GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType) + public static string GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType) { return processor.GetImageCacheTag(item, imageType, 0); } - public static Guid? GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType, int imageIndex) + public static string GetImageCacheTag(this IImageProcessor processor, IHasImages item, ImageType imageType, int imageIndex) { var imageInfo = item.GetImageInfo(imageType, imageIndex); diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs index c3b0748cf..0a0174b6d 100644 --- a/MediaBrowser.Controller/Library/IUserManager.cs +++ b/MediaBrowser.Controller/Library/IUserManager.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Common.Events; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Events; using System; using System.Collections.Generic; using System.Threading; diff --git a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs index 4e56932ec..84fedebce 100644 --- a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs +++ b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs @@ -34,6 +34,6 @@ namespace MediaBrowser.Controller.Persistence /// The user id. /// The client. /// Task{DisplayPreferences}. - DisplayPreferences GetDisplayPreferences(Guid displayPreferencesId, Guid userId, string client); + DisplayPreferences GetDisplayPreferences(string displayPreferencesId, Guid userId, string client); } } diff --git a/MediaBrowser.Controller/Session/ISessionController.cs b/MediaBrowser.Controller/Session/ISessionController.cs index d4612acb5..9c818284d 100644 --- a/MediaBrowser.Controller/Session/ISessionController.cs +++ b/MediaBrowser.Controller/Session/ISessionController.cs @@ -19,14 +19,6 @@ namespace MediaBrowser.Controller.Session /// true if this instance is session active; otherwise, false. bool IsSessionActive { get; } - /// - /// Sends the message command. - /// - /// The command. - /// The cancellation token. - /// Task. - Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken); - /// /// Sends the play command. /// diff --git a/MediaBrowser.Dlna/Didl/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs index 7c627104b..1cd4a4cbd 100644 --- a/MediaBrowser.Dlna/Didl/DidlBuilder.cs +++ b/MediaBrowser.Dlna/Didl/DidlBuilder.cs @@ -623,9 +623,7 @@ namespace MediaBrowser.Dlna.Didl try { - var guid = _imageProcessor.GetImageCacheTag(item, ImageType.Primary); - - tag = guid.HasValue ? guid.Value.ToString("N") : null; + tag = _imageProcessor.GetImageCacheTag(item, ImageType.Primary); } catch { @@ -712,7 +710,7 @@ namespace MediaBrowser.Dlna.Didl Height = height.Value, Width = width.Value - }, maxWidth: maxWidth, maxHeight: maxHeight); + }, null, null, maxWidth, maxHeight); width = Convert.ToInt32(newSize.Width); height = Convert.ToInt32(newSize.Height); diff --git a/MediaBrowser.Dlna/PlayTo/DlnaController.cs b/MediaBrowser.Dlna/PlayTo/DlnaController.cs index 673a7c245..ab342d635 100644 --- a/MediaBrowser.Dlna/PlayTo/DlnaController.cs +++ b/MediaBrowser.Dlna/PlayTo/DlnaController.cs @@ -355,11 +355,6 @@ namespace MediaBrowser.Dlna.PlayTo return Task.FromResult(true); } - public Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken) - { - return Task.FromResult(true); - } - #endregion #region Playlist diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index 991fe3b2a..7f8f4c325 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -278,6 +278,9 @@ Entities\VirtualFolderInfo.cs + + Events\GenericEventArgs.cs + FileOrganization\FileOrganizationQuery.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index 771e739bc..d65aef7f0 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -265,6 +265,9 @@ Entities\VirtualFolderInfo.cs + + Events\GenericEventArgs.cs + FileOrganization\FileOrganizationQuery.cs diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index c9f5f3ae7..bfc631c79 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -138,7 +138,7 @@ namespace MediaBrowser.Model.ApiClient /// The notification id list. /// if set to true [is read]. /// Task. - Task MarkNotificationsRead(string userId, IEnumerable notificationIdList, bool isRead); + Task MarkNotificationsRead(string userId, IEnumerable notificationIdList, bool isRead); /// /// Gets the notifications summary. @@ -447,7 +447,7 @@ namespace MediaBrowser.Model.ApiClient /// The id. /// Task{TaskInfo}. /// id - Task GetScheduledTaskAsync(Guid id); + Task GetScheduledTaskAsync(string id); /// /// Gets a user by id @@ -581,6 +581,38 @@ namespace MediaBrowser.Model.ApiClient /// Task. Task SendCommandAsync(string sessionId, GeneralCommand command); + /// + /// Sends the string. + /// + /// The session identifier. + /// The text. + /// Task. + Task SendString(string sessionId, string text); + + /// + /// Sets the volume. + /// + /// The session identifier. + /// The volume. + /// Task. + Task SetVolume(string sessionId, int volume); + + /// + /// Sets the index of the audio stream. + /// + /// The session identifier. + /// The volume. + /// Task. + Task SetAudioStreamIndex(string sessionId, int? volume); + + /// + /// Sets the index of the subtitle stream. + /// + /// The session identifier. + /// The volume. + /// Task. + Task SetSubtitleStreamIndex(string sessionId, int? volume); + /// /// Instructs the client to display a message to the user /// @@ -632,7 +664,7 @@ namespace MediaBrowser.Model.ApiClient /// The triggers. /// Task{RequestResult}. /// id - Task UpdateScheduledTaskTriggersAsync(Guid id, TaskTriggerInfo[] triggers); + Task UpdateScheduledTaskTriggersAsync(string id, TaskTriggerInfo[] triggers); /// /// Gets the display preferences. diff --git a/MediaBrowser.Model/ApiClient/IServerEvents.cs b/MediaBrowser.Model/ApiClient/IServerEvents.cs index e13f3cc2c..8e46f3d9f 100644 --- a/MediaBrowser.Model/ApiClient/IServerEvents.cs +++ b/MediaBrowser.Model/ApiClient/IServerEvents.cs @@ -1,4 +1,11 @@ -using System; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.Plugins; +using MediaBrowser.Model.Session; +using MediaBrowser.Model.Tasks; +using MediaBrowser.Model.Updates; +using System; namespace MediaBrowser.Model.ApiClient { @@ -10,59 +17,59 @@ namespace MediaBrowser.Model.ApiClient /// /// Occurs when [user deleted]. /// - event EventHandler UserDeleted; + event EventHandler> UserDeleted; /// /// Occurs when [scheduled task started]. /// - event EventHandler ScheduledTaskStarted; + event EventHandler> ScheduledTaskStarted; /// /// Occurs when [scheduled task ended]. /// - event EventHandler ScheduledTaskEnded; + event EventHandler> ScheduledTaskEnded; /// /// Occurs when [package installing]. /// - event EventHandler PackageInstalling; + event EventHandler> PackageInstalling; /// /// Occurs when [package installation failed]. /// - event EventHandler PackageInstallationFailed; + event EventHandler> PackageInstallationFailed; /// /// Occurs when [package installation completed]. /// - event EventHandler PackageInstallationCompleted; + event EventHandler> PackageInstallationCompleted; /// /// Occurs when [package installation cancelled]. /// - event EventHandler PackageInstallationCancelled; + event EventHandler> PackageInstallationCancelled; /// /// Occurs when [user updated]. /// - event EventHandler UserUpdated; + event EventHandler> UserUpdated; /// /// Occurs when [plugin uninstalled]. /// - event EventHandler PluginUninstalled; + event EventHandler> PluginUninstalled; /// /// Occurs when [library changed]. /// - event EventHandler LibraryChanged; + event EventHandler> LibraryChanged; /// /// Occurs when [browse command]. /// - event EventHandler BrowseCommand; + event EventHandler> BrowseCommand; /// /// Occurs when [play command]. /// - event EventHandler PlayCommand; + event EventHandler> PlayCommand; /// /// Occurs when [playstate command]. /// - event EventHandler PlaystateCommand; + event EventHandler> PlaystateCommand; /// /// Occurs when [message command]. /// - event EventHandler MessageCommand; + event EventHandler> MessageCommand; /// /// Occurs when [system command]. /// @@ -88,6 +95,22 @@ namespace MediaBrowser.Model.ApiClient /// event EventHandler ServerShuttingDown; /// + /// Occurs when [send text command]. + /// + event EventHandler> SendTextCommand; + /// + /// Occurs when [set volume command]. + /// + event EventHandler> SetVolumeCommand; + /// + /// Occurs when [set audio stream index command]. + /// + event EventHandler> SetAudioStreamIndexCommand; + /// + /// Occurs when [set video stream index command]. + /// + event EventHandler> SetVideoStreamIndexCommand; + /// /// Occurs when [sessions updated]. /// event EventHandler SessionsUpdated; @@ -98,7 +121,7 @@ namespace MediaBrowser.Model.ApiClient /// /// Occurs when [user data changed]. /// - event EventHandler UserDataChanged; + event EventHandler> UserDataChanged; /// /// Occurs when [connected]. /// diff --git a/MediaBrowser.Model/ApiClient/ServerEventArgs.cs b/MediaBrowser.Model/ApiClient/ServerEventArgs.cs index 6637edd74..ad0defe68 100644 --- a/MediaBrowser.Model/ApiClient/ServerEventArgs.cs +++ b/MediaBrowser.Model/ApiClient/ServerEventArgs.cs @@ -1,154 +1,8 @@ -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Plugins; -using MediaBrowser.Model.Session; -using MediaBrowser.Model.Tasks; -using MediaBrowser.Model.Updates; +using MediaBrowser.Model.Session; using System; namespace MediaBrowser.Model.ApiClient { - /// - /// Class UserDeletedEventArgs - /// - public class UserDeletedEventArgs : EventArgs - { - /// - /// Gets or sets the id. - /// - /// The id. - public string Id { get; set; } - } - - public class UserDataChangedEventArgs : EventArgs - { - /// - /// Gets or sets the user. - /// - /// The user. - public UserDataChangeInfo ChangeInfo { get; set; } - } - - /// - /// Class UserUpdatedEventArgs - /// - public class UserUpdatedEventArgs : EventArgs - { - /// - /// Gets or sets the user. - /// - /// The user. - public UserDto User { get; set; } - } - - /// - /// Class ScheduledTaskStartedEventArgs - /// - public class ScheduledTaskStartedEventArgs : EventArgs - { - /// - /// Gets or sets the name. - /// - /// The name. - public string Name { get; set; } - } - - /// - /// Class ScheduledTaskEndedEventArgs - /// - public class ScheduledTaskEndedEventArgs : EventArgs - { - /// - /// Gets or sets the result. - /// - /// The result. - public TaskResult Result { get; set; } - } - - /// - /// Class PackageInstallationEventArgs - /// - public class PackageInstallationEventArgs : EventArgs - { - /// - /// Gets or sets the installation info. - /// - /// The installation info. - public InstallationInfo InstallationInfo { get; set; } - } - - /// - /// Class PluginUninstallEventArgs - /// - public class PluginUninstallEventArgs : EventArgs - { - /// - /// Gets or sets the plugin info. - /// - /// The plugin info. - public PluginInfo PluginInfo { get; set; } - } - - /// - /// Class LibraryChangedEventArgs - /// - public class LibraryChangedEventArgs : EventArgs - { - /// - /// Gets or sets the update info. - /// - /// The update info. - public LibraryUpdateInfo UpdateInfo { get; set; } - } - - /// - /// Class BrowseRequestEventArgs - /// - public class BrowseRequestEventArgs : EventArgs - { - /// - /// Gets or sets the request. - /// - /// The request. - public BrowseRequest Request { get; set; } - } - - /// - /// Class PlayRequestEventArgs - /// - public class PlayRequestEventArgs : EventArgs - { - /// - /// Gets or sets the request. - /// - /// The request. - public PlayRequest Request { get; set; } - } - - /// - /// Class PlaystateRequestEventArgs - /// - public class PlaystateRequestEventArgs : EventArgs - { - /// - /// Gets or sets the request. - /// - /// The request. - public PlaystateRequest Request { get; set; } - } - - /// - /// Class MessageCommandEventArgs - /// - public class MessageCommandEventArgs : EventArgs - { - /// - /// Gets or sets the request. - /// - /// The request. - public MessageCommand Request { get; set; } - } - /// /// Class SystemCommandEventArgs /// diff --git a/MediaBrowser.Model/Configuration/MetadataOptions.cs b/MediaBrowser.Model/Configuration/MetadataOptions.cs index d666f6cce..7b2bcc178 100644 --- a/MediaBrowser.Model/Configuration/MetadataOptions.cs +++ b/MediaBrowser.Model/Configuration/MetadataOptions.cs @@ -30,7 +30,7 @@ namespace MediaBrowser.Model.Configuration public MetadataOptions(int backdropLimit, int minBackdropWidth) { - var imageOptions = new List + List imageOptions = new List { new ImageOption { @@ -52,14 +52,14 @@ namespace MediaBrowser.Model.Configuration public int GetLimit(ImageType type) { - var option = ImageOptions.FirstOrDefault(i => i.Type == type); + ImageOption option = ImageOptions.FirstOrDefault(i => i.Type == type); return option == null ? 1 : option.Limit; } public int GetMinWidth(ImageType type) { - var option = ImageOptions.FirstOrDefault(i => i.Type == type); + ImageOption option = ImageOptions.FirstOrDefault(i => i.Type == type); return option == null ? 0 : option.MinWidth; } diff --git a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs index a62508fb1..b5f5dd138 100644 --- a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs +++ b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs @@ -1,7 +1,6 @@ -using System; +using MediaBrowser.Model.MediaInfo; +using System; using System.Collections.Generic; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Model.Dlna { diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 21441d36a..02cee0dce 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -16,22 +16,22 @@ namespace MediaBrowser.Model.Dlna { ValidateAudioInput(options); - var mediaSources = options.MediaSources; + List mediaSources = options.MediaSources; // If the client wants a specific media soure, filter now if (!string.IsNullOrEmpty(options.MediaSourceId)) { // Avoid implicitly captured closure - var mediaSourceId = options.MediaSourceId; + string mediaSourceId = options.MediaSourceId; mediaSources = mediaSources .Where(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase)) .ToList(); } - var streams = mediaSources.Select(i => BuildAudioItem(i, options)).ToList(); + List streams = mediaSources.Select(i => BuildAudioItem(i, options)).ToList(); - foreach (var stream in streams) + foreach (StreamInfo stream in streams) { stream.DeviceId = options.DeviceId; stream.DeviceProfileId = options.Profile.Id; @@ -44,22 +44,22 @@ namespace MediaBrowser.Model.Dlna { ValidateInput(options); - var mediaSources = options.MediaSources; + List mediaSources = options.MediaSources; // If the client wants a specific media soure, filter now if (!string.IsNullOrEmpty(options.MediaSourceId)) { // Avoid implicitly captured closure - var mediaSourceId = options.MediaSourceId; + string mediaSourceId = options.MediaSourceId; mediaSources = mediaSources .Where(i => string.Equals(i.Id, mediaSourceId, StringComparison.OrdinalIgnoreCase)) .ToList(); } - var streams = mediaSources.Select(i => BuildVideoItem(i, options)).ToList(); + List streams = mediaSources.Select(i => BuildVideoItem(i, options)).ToList(); - foreach (var stream in streams) + foreach (StreamInfo stream in streams) { stream.DeviceId = options.DeviceId; stream.DeviceProfileId = options.Profile.Id; @@ -78,7 +78,7 @@ namespace MediaBrowser.Model.Dlna private StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options) { - var playlistItem = new StreamInfo + StreamInfo playlistItem = new StreamInfo { ItemId = options.ItemId, MediaType = DlnaProfileType.Audio, @@ -86,30 +86,30 @@ namespace MediaBrowser.Model.Dlna RunTimeTicks = item.RunTimeTicks }; - var maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate; + int? maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate; - var audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio); + MediaStream audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio); // Honor the max bitrate setting if (IsAudioEligibleForDirectPlay(item, maxBitrateSetting)) { - var directPlay = options.Profile.DirectPlayProfiles + DirectPlayProfile directPlay = options.Profile.DirectPlayProfiles .FirstOrDefault(i => i.Type == playlistItem.MediaType && IsAudioDirectPlaySupported(i, item, audioStream)); if (directPlay != null) { - var audioCodec = audioStream == null ? null : audioStream.Codec; + string audioCodec = audioStream == null ? null : audioStream.Codec; // Make sure audio codec profiles are satisfied if (!string.IsNullOrEmpty(audioCodec)) { - var conditionProcessor = new ConditionProcessor(); + ConditionProcessor conditionProcessor = new ConditionProcessor(); - var conditions = options.Profile.CodecProfiles.Where(i => i.Type == CodecType.Audio && i.ContainsCodec(audioCodec)) + IEnumerable conditions = options.Profile.CodecProfiles.Where(i => i.Type == CodecType.Audio && i.ContainsCodec(audioCodec)) .SelectMany(i => i.Conditions); - var audioChannels = audioStream == null ? null : audioStream.Channels; - var audioBitrate = audioStream == null ? null : audioStream.BitRate; + int? audioChannels = audioStream.Channels; + int? audioBitrate = audioStream.BitRate; if (conditions.All(c => conditionProcessor.IsAudioConditionSatisfied(c, audioChannels, audioBitrate))) { @@ -122,7 +122,7 @@ namespace MediaBrowser.Model.Dlna } } - var transcodingProfile = options.Profile.TranscodingProfiles + TranscodingProfile transcodingProfile = options.Profile.TranscodingProfiles .FirstOrDefault(i => i.Type == playlistItem.MediaType); if (transcodingProfile != null) @@ -134,7 +134,7 @@ namespace MediaBrowser.Model.Dlna playlistItem.AudioCodec = transcodingProfile.AudioCodec; playlistItem.Protocol = transcodingProfile.Protocol; - var audioTranscodingConditions = options.Profile.CodecProfiles + IEnumerable audioTranscodingConditions = options.Profile.CodecProfiles .Where(i => i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec)) .Take(1) .SelectMany(i => i.Conditions); @@ -144,7 +144,7 @@ namespace MediaBrowser.Model.Dlna // Honor requested max channels if (options.MaxAudioChannels.HasValue) { - var currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value; + int currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value; playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue); } @@ -152,7 +152,7 @@ namespace MediaBrowser.Model.Dlna // Honor requested max bitrate if (maxBitrateSetting.HasValue) { - var currentValue = playlistItem.AudioBitrate ?? maxBitrateSetting.Value; + int currentValue = playlistItem.AudioBitrate ?? maxBitrateSetting.Value; playlistItem.AudioBitrate = Math.Min(maxBitrateSetting.Value, currentValue); } @@ -163,7 +163,7 @@ namespace MediaBrowser.Model.Dlna private StreamInfo BuildVideoItem(MediaSourceInfo item, VideoOptions options) { - var playlistItem = new StreamInfo + StreamInfo playlistItem = new StreamInfo { ItemId = options.ItemId, MediaType = DlnaProfileType.Video, @@ -171,15 +171,15 @@ namespace MediaBrowser.Model.Dlna RunTimeTicks = item.RunTimeTicks }; - var audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio); - var videoStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video); + MediaStream audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio); + MediaStream videoStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video); - var maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate; + int? maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate; if (IsEligibleForDirectPlay(item, options, maxBitrateSetting)) { // See if it can be direct played - var directPlay = GetVideoDirectPlayProfile(options.Profile, item, videoStream, audioStream); + DirectPlayProfile directPlay = GetVideoDirectPlayProfile(options.Profile, item, videoStream, audioStream); if (directPlay != null) { @@ -191,7 +191,7 @@ namespace MediaBrowser.Model.Dlna } // Can't direct play, find the transcoding profile - var transcodingProfile = options.Profile.TranscodingProfiles + TranscodingProfile transcodingProfile = options.Profile.TranscodingProfiles .FirstOrDefault(i => i.Type == playlistItem.MediaType); if (transcodingProfile != null) @@ -206,14 +206,14 @@ namespace MediaBrowser.Model.Dlna playlistItem.AudioStreamIndex = options.AudioStreamIndex; playlistItem.SubtitleStreamIndex = options.SubtitleStreamIndex; - var videoTranscodingConditions = options.Profile.CodecProfiles + IEnumerable videoTranscodingConditions = options.Profile.CodecProfiles .Where(i => i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec)) .Take(1) .SelectMany(i => i.Conditions); ApplyTranscodingConditions(playlistItem, videoTranscodingConditions); - var audioTranscodingConditions = options.Profile.CodecProfiles + IEnumerable audioTranscodingConditions = options.Profile.CodecProfiles .Where(i => i.Type == CodecType.VideoAudio && i.ContainsCodec(transcodingProfile.AudioCodec)) .Take(1) .SelectMany(i => i.Conditions); @@ -223,7 +223,7 @@ namespace MediaBrowser.Model.Dlna // Honor requested max channels if (options.MaxAudioChannels.HasValue) { - var currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value; + int currentValue = playlistItem.MaxAudioChannels ?? options.MaxAudioChannels.Value; playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue); } @@ -231,7 +231,7 @@ namespace MediaBrowser.Model.Dlna // Honor requested max bitrate if (options.MaxAudioTranscodingBitrate.HasValue) { - var currentValue = playlistItem.AudioBitrate ?? options.MaxAudioTranscodingBitrate.Value; + int currentValue = playlistItem.AudioBitrate ?? options.MaxAudioTranscodingBitrate.Value; playlistItem.AudioBitrate = Math.Min(options.MaxAudioTranscodingBitrate.Value, currentValue); } @@ -239,14 +239,14 @@ namespace MediaBrowser.Model.Dlna // Honor max rate if (maxBitrateSetting.HasValue) { - var videoBitrate = maxBitrateSetting.Value; + int videoBitrate = maxBitrateSetting.Value; if (playlistItem.AudioBitrate.HasValue) { videoBitrate -= playlistItem.AudioBitrate.Value; } - var currentValue = playlistItem.VideoBitrate ?? videoBitrate; + int currentValue = playlistItem.VideoBitrate ?? videoBitrate; playlistItem.VideoBitrate = Math.Min(videoBitrate, currentValue); } @@ -261,7 +261,7 @@ namespace MediaBrowser.Model.Dlna MediaStream audioStream) { // See if it can be direct played - var directPlay = profile.DirectPlayProfiles + DirectPlayProfile directPlay = profile.DirectPlayProfiles .FirstOrDefault(i => i.Type == DlnaProfileType.Video && IsVideoDirectPlaySupported(i, mediaSource, videoStream, audioStream)); if (directPlay == null) @@ -269,28 +269,28 @@ namespace MediaBrowser.Model.Dlna return null; } - var container = mediaSource.Container; + string container = mediaSource.Container; - var conditions = profile.ContainerProfiles + IEnumerable conditions = profile.ContainerProfiles .Where(i => i.Type == DlnaProfileType.Video && i.GetContainers().Contains(container, StringComparer.OrdinalIgnoreCase)) .SelectMany(i => i.Conditions); - var conditionProcessor = new ConditionProcessor(); + ConditionProcessor conditionProcessor = new ConditionProcessor(); - var width = videoStream == null ? null : videoStream.Width; - var height = videoStream == null ? null : videoStream.Height; - var bitDepth = videoStream == null ? null : videoStream.BitDepth; - var videoBitrate = videoStream == null ? null : videoStream.BitRate; - var videoLevel = videoStream == null ? null : videoStream.Level; - var videoProfile = videoStream == null ? null : videoStream.Profile; - var videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate; + int? width = videoStream == null ? null : videoStream.Width; + int? height = videoStream == null ? null : videoStream.Height; + int? bitDepth = videoStream == null ? null : videoStream.BitDepth; + int? videoBitrate = videoStream == null ? null : videoStream.BitRate; + double? videoLevel = videoStream == null ? null : videoStream.Level; + string videoProfile = videoStream == null ? null : videoStream.Profile; + float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate; - var audioBitrate = audioStream == null ? null : audioStream.BitRate; - var audioChannels = audioStream == null ? null : audioStream.Channels; - var audioProfile = audioStream == null ? null : audioStream.Profile; + int? audioBitrate = audioStream == null ? null : audioStream.BitRate; + int? audioChannels = audioStream == null ? null : audioStream.Channels; + string audioProfile = audioStream == null ? null : audioStream.Profile; - var timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp; - var packetLength = videoStream == null ? null : videoStream.PacketLength; + TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp; + int? packetLength = videoStream == null ? null : videoStream.PacketLength; // Check container conditions if (!conditions.All(i => conditionProcessor.IsVideoConditionSatisfied(i, @@ -309,7 +309,7 @@ namespace MediaBrowser.Model.Dlna return null; } - var videoCodec = videoStream == null ? null : videoStream.Codec; + string videoCodec = videoStream == null ? null : videoStream.Codec; if (string.IsNullOrEmpty(videoCodec)) { @@ -338,7 +338,7 @@ namespace MediaBrowser.Model.Dlna if (audioStream != null) { - var audioCodec = audioStream.Codec; + string audioCodec = audioStream.Codec; if (string.IsNullOrEmpty(audioCodec)) { @@ -420,10 +420,10 @@ namespace MediaBrowser.Model.Dlna private void ApplyTranscodingConditions(StreamInfo item, IEnumerable conditions) { - foreach (var condition in conditions + foreach (ProfileCondition condition in conditions .Where(i => !string.IsNullOrEmpty(i.Value))) { - var value = condition.Value; + string value = condition.Value; switch (condition.Property) { @@ -515,7 +515,7 @@ namespace MediaBrowser.Model.Dlna if (profile.Container.Length > 0) { // Check container type - var mediaContainer = item.Container ?? string.Empty; + string mediaContainer = item.Container ?? string.Empty; if (!profile.GetContainers().Any(i => string.Equals(i, mediaContainer, StringComparison.OrdinalIgnoreCase))) { return false; @@ -536,7 +536,7 @@ namespace MediaBrowser.Model.Dlna if (profile.Container.Length > 0) { // Check container type - var mediaContainer = item.Container ?? string.Empty; + string mediaContainer = item.Container ?? string.Empty; if (!profile.GetContainers().Any(i => string.Equals(i, mediaContainer, StringComparison.OrdinalIgnoreCase))) { return false; @@ -544,21 +544,21 @@ namespace MediaBrowser.Model.Dlna } // Check video codec - var videoCodecs = profile.GetVideoCodecs(); + List videoCodecs = profile.GetVideoCodecs(); if (videoCodecs.Count > 0) { - var videoCodec = videoStream == null ? null : videoStream.Codec; + string videoCodec = videoStream == null ? null : videoStream.Codec; if (string.IsNullOrEmpty(videoCodec) || !videoCodecs.Contains(videoCodec, StringComparer.OrdinalIgnoreCase)) { return false; } } - var audioCodecs = profile.GetAudioCodecs(); + List audioCodecs = profile.GetAudioCodecs(); if (audioCodecs.Count > 0) { // Check audio codecs - var audioCodec = audioStream == null ? null : audioStream.Codec; + string audioCodec = audioStream == null ? null : audioStream.Codec; if (string.IsNullOrEmpty(audioCodec) || !audioCodecs.Contains(audioCodec, StringComparer.OrdinalIgnoreCase)) { return false; diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index fe49227e4..ae9806f97 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -79,9 +79,9 @@ namespace MediaBrowser.Model.Dlna throw new ArgumentNullException(baseUrl); } - var dlnaCommand = BuildDlnaParam(this); + string dlnaCommand = BuildDlnaParam(this); - var extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container; + string extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container; baseUrl = baseUrl.TrimEnd('/'); @@ -98,11 +98,11 @@ namespace MediaBrowser.Model.Dlna return string.Format("{0}/videos/{1}/stream{2}?{3}", baseUrl, ItemId, extension, dlnaCommand); } + private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); + private static string BuildDlnaParam(StreamInfo item) { - var usCulture = new CultureInfo("en-US"); - - var list = new List + List list = new List { item.DeviceProfileId ?? string.Empty, item.DeviceId ?? string.Empty, @@ -110,16 +110,16 @@ namespace MediaBrowser.Model.Dlna (item.IsDirectStream).ToString().ToLower(), item.VideoCodec ?? string.Empty, item.AudioCodec ?? string.Empty, - item.AudioStreamIndex.HasValue ? item.AudioStreamIndex.Value.ToString(usCulture) : string.Empty, - item.SubtitleStreamIndex.HasValue ? item.SubtitleStreamIndex.Value.ToString(usCulture) : string.Empty, - item.VideoBitrate.HasValue ? item.VideoBitrate.Value.ToString(usCulture) : string.Empty, - item.AudioBitrate.HasValue ? item.AudioBitrate.Value.ToString(usCulture) : string.Empty, - item.MaxAudioChannels.HasValue ? item.MaxAudioChannels.Value.ToString(usCulture) : string.Empty, - item.MaxFramerate.HasValue ? item.MaxFramerate.Value.ToString(usCulture) : string.Empty, - item.MaxWidth.HasValue ? item.MaxWidth.Value.ToString(usCulture) : string.Empty, - item.MaxHeight.HasValue ? item.MaxHeight.Value.ToString(usCulture) : string.Empty, - item.StartPositionTicks.ToString(usCulture), - item.VideoLevel.HasValue ? item.VideoLevel.Value.ToString(usCulture) : string.Empty + item.AudioStreamIndex.HasValue ? item.AudioStreamIndex.Value.ToString(UsCulture) : string.Empty, + item.SubtitleStreamIndex.HasValue ? item.SubtitleStreamIndex.Value.ToString(UsCulture) : string.Empty, + item.VideoBitrate.HasValue ? item.VideoBitrate.Value.ToString(UsCulture) : string.Empty, + item.AudioBitrate.HasValue ? item.AudioBitrate.Value.ToString(UsCulture) : string.Empty, + item.MaxAudioChannels.HasValue ? item.MaxAudioChannels.Value.ToString(UsCulture) : string.Empty, + item.MaxFramerate.HasValue ? item.MaxFramerate.Value.ToString(UsCulture) : string.Empty, + item.MaxWidth.HasValue ? item.MaxWidth.Value.ToString(UsCulture) : string.Empty, + item.MaxHeight.HasValue ? item.MaxHeight.Value.ToString(UsCulture) : string.Empty, + item.StartPositionTicks.ToString(UsCulture), + item.VideoLevel.HasValue ? item.VideoLevel.Value.ToString(UsCulture) : string.Empty }; return string.Format("Params={0}", string.Join(";", list.ToArray())); @@ -134,7 +134,7 @@ namespace MediaBrowser.Model.Dlna { if (MediaSource != null) { - var audioStreams = MediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio); + IEnumerable audioStreams = MediaSource.MediaStreams.Where(i => i.Type == MediaStreamType.Audio); if (AudioStreamIndex.HasValue) { @@ -172,7 +172,7 @@ namespace MediaBrowser.Model.Dlna { get { - var stream = TargetAudioStream; + MediaStream stream = TargetAudioStream; return stream == null ? null : stream.SampleRate; } } @@ -184,7 +184,7 @@ namespace MediaBrowser.Model.Dlna { get { - var stream = TargetVideoStream; + MediaStream stream = TargetVideoStream; return stream == null || !IsDirectStream ? null : stream.BitDepth; } } @@ -196,7 +196,7 @@ namespace MediaBrowser.Model.Dlna { get { - var stream = TargetVideoStream; + MediaStream stream = TargetVideoStream; return MaxFramerate.HasValue && !IsDirectStream ? MaxFramerate : stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate; @@ -210,7 +210,7 @@ namespace MediaBrowser.Model.Dlna { get { - var stream = TargetVideoStream; + MediaStream stream = TargetVideoStream; return VideoLevel.HasValue && !IsDirectStream ? VideoLevel : stream == null ? null : stream.Level; @@ -224,7 +224,7 @@ namespace MediaBrowser.Model.Dlna { get { - var stream = TargetVideoStream; + MediaStream stream = TargetVideoStream; return !IsDirectStream ? null : stream == null ? null : stream.PacketLength; @@ -238,7 +238,7 @@ namespace MediaBrowser.Model.Dlna { get { - var stream = TargetVideoStream; + MediaStream stream = TargetVideoStream; return !string.IsNullOrEmpty(VideoProfile) && !IsDirectStream ? VideoProfile : stream == null ? null : stream.Profile; @@ -252,7 +252,7 @@ namespace MediaBrowser.Model.Dlna { get { - var stream = TargetAudioStream; + MediaStream stream = TargetAudioStream; return AudioBitrate.HasValue && !IsDirectStream ? AudioBitrate : stream == null ? null : stream.BitRate; @@ -266,8 +266,8 @@ namespace MediaBrowser.Model.Dlna { get { - var stream = TargetAudioStream; - var streamChannels = stream == null ? null : stream.Channels; + MediaStream stream = TargetAudioStream; + int? streamChannels = stream == null ? null : stream.Channels; return MaxAudioChannels.HasValue && !IsDirectStream ? (streamChannels.HasValue ? Math.Min(MaxAudioChannels.Value, streamChannels.Value) : MaxAudioChannels.Value) @@ -282,7 +282,7 @@ namespace MediaBrowser.Model.Dlna { get { - var stream = TargetAudioStream; + MediaStream stream = TargetAudioStream; return IsDirectStream ? (stream == null ? null : stream.Codec) @@ -304,10 +304,10 @@ namespace MediaBrowser.Model.Dlna if (RunTimeTicks.HasValue) { - var totalBitrate = TargetTotalBitrate; + int? totalBitrate = TargetTotalBitrate; return totalBitrate.HasValue ? - Convert.ToInt64(totalBitrate * TimeSpan.FromTicks(RunTimeTicks.Value).TotalSeconds) : + Convert.ToInt64(totalBitrate.Value * TimeSpan.FromTicks(RunTimeTicks.Value).TotalSeconds) : (long?)null; } @@ -319,7 +319,7 @@ namespace MediaBrowser.Model.Dlna { get { - var stream = TargetVideoStream; + MediaStream stream = TargetVideoStream; return VideoBitrate.HasValue && !IsDirectStream ? VideoBitrate @@ -331,7 +331,7 @@ namespace MediaBrowser.Model.Dlna { get { - var defaultValue = string.Equals(Container, "m2ts", StringComparison.OrdinalIgnoreCase) + TransportStreamTimestamp defaultValue = string.Equals(Container, "m2ts", StringComparison.OrdinalIgnoreCase) ? TransportStreamTimestamp.Valid : TransportStreamTimestamp.None; @@ -353,17 +353,17 @@ namespace MediaBrowser.Model.Dlna { get { - var videoStream = TargetVideoStream; + MediaStream videoStream = TargetVideoStream; if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue) { - var size = new ImageSize + ImageSize size = new ImageSize { Width = videoStream.Width.Value, Height = videoStream.Height.Value }; - var newSize = DrawingUtils.Resize(size, + ImageSize newSize = DrawingUtils.Resize(size, null, null, MaxWidth, @@ -380,17 +380,17 @@ namespace MediaBrowser.Model.Dlna { get { - var videoStream = TargetVideoStream; + MediaStream videoStream = TargetVideoStream; if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue) { - var size = new ImageSize + ImageSize size = new ImageSize { Width = videoStream.Width.Value, Height = videoStream.Height.Value }; - var newSize = DrawingUtils.Resize(size, + ImageSize newSize = DrawingUtils.Resize(size, null, null, MaxWidth, diff --git a/MediaBrowser.Model/Drawing/DrawingUtils.cs b/MediaBrowser.Model/Drawing/DrawingUtils.cs index e95b5e375..ae483b6f6 100644 --- a/MediaBrowser.Model/Drawing/DrawingUtils.cs +++ b/MediaBrowser.Model/Drawing/DrawingUtils.cs @@ -16,7 +16,12 @@ namespace MediaBrowser.Model.Drawing /// ImageSize. public static ImageSize Scale(double currentWidth, double currentHeight, double scaleFactor) { - return Scale(new ImageSize { Width = currentWidth, Height = currentHeight }, scaleFactor); + return Scale(new ImageSize + { + Width = currentWidth, + Height = currentHeight + + }, scaleFactor); } /// @@ -29,7 +34,7 @@ namespace MediaBrowser.Model.Drawing { var newWidth = size.Width * scaleFactor; - return Resize(size.Width, size.Height, newWidth); + return Resize(size.Width, size.Height, newWidth, null, null, null); } /// @@ -42,9 +47,19 @@ namespace MediaBrowser.Model.Drawing /// A max fixed width, if desired /// A max fixed height, if desired /// ImageSize. - public static ImageSize Resize(double currentWidth, double currentHeight, double? width = null, double? height = null, double? maxWidth = null, double? maxHeight = null) + public static ImageSize Resize(double currentWidth, + double currentHeight, + double? width, + double? height, + double? maxWidth, + double? maxHeight) { - return Resize(new ImageSize { Width = currentWidth, Height = currentHeight }, width, height, maxWidth, maxHeight); + return Resize(new ImageSize + { + Width = currentWidth, + Height = currentHeight + + }, width, height, maxWidth, maxHeight); } /// @@ -56,7 +71,11 @@ namespace MediaBrowser.Model.Drawing /// A max fixed width, if desired /// A max fixed height, if desired /// A new size object - public static ImageSize Resize(ImageSize size, double? width = null, double? height = null, double? maxWidth = null, double? maxHeight = null) + public static ImageSize Resize(ImageSize size, + double? width, + double? height, + double? maxWidth, + double? maxHeight) { double newWidth = size.Width; double newHeight = size.Height; @@ -79,13 +98,13 @@ namespace MediaBrowser.Model.Drawing newWidth = width.Value; } - if (maxHeight.HasValue && maxHeight < newHeight) + if (maxHeight.HasValue && maxHeight.Value < newHeight) { newWidth = GetNewWidth(newHeight, newWidth, maxHeight.Value); newHeight = maxHeight.Value; } - if (maxWidth.HasValue && maxWidth < newWidth) + if (maxWidth.HasValue && maxWidth.Value < newWidth) { newHeight = GetNewHeight(newHeight, newWidth, maxWidth.Value); newWidth = maxWidth.Value; @@ -186,7 +205,7 @@ namespace MediaBrowser.Model.Drawing { if (!string.IsNullOrEmpty(value)) { - var parts = value.Split('-'); + string[] parts = value.Split('-'); if (parts.Length == 2) { diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index a4bb0646a..f2434afe3 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -311,7 +311,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the parent backdrop image tags. /// /// The parent backdrop image tags. - public List ParentBackdropImageTags { get; set; } + public List ParentBackdropImageTags { get; set; } /// /// Gets or sets the local trailer count. @@ -466,13 +466,13 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the album image tag. /// /// The album image tag. - public Guid? AlbumPrimaryImageTag { get; set; } + public string AlbumPrimaryImageTag { get; set; } /// /// Gets or sets the series primary image tag. /// /// The series primary image tag. - public Guid? SeriesPrimaryImageTag { get; set; } + public string SeriesPrimaryImageTag { get; set; } /// /// Gets or sets the album artist. @@ -529,25 +529,25 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the image tags. /// /// The image tags. - public Dictionary ImageTags { get; set; } + public Dictionary ImageTags { get; set; } /// /// Gets or sets the backdrop image tags. /// /// The backdrop image tags. - public List BackdropImageTags { get; set; } + public List BackdropImageTags { get; set; } /// /// Gets or sets the screenshot image tags. /// /// The screenshot image tags. - public List ScreenshotImageTags { get; set; } + public List ScreenshotImageTags { get; set; } /// /// Gets or sets the parent logo image tag. /// /// The parent logo image tag. - public Guid? ParentLogoImageTag { get; set; } + public string ParentLogoImageTag { get; set; } /// /// If the item does not have a art, this will hold the Id of the Parent that has one. @@ -559,13 +559,13 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the parent art image tag. /// /// The parent art image tag. - public Guid? ParentArtImageTag { get; set; } + public string ParentArtImageTag { get; set; } /// /// Gets or sets the series thumb image tag. /// /// The series thumb image tag. - public Guid? SeriesThumbImageTag { get; set; } + public string SeriesThumbImageTag { get; set; } /// /// Gets or sets the series studio. @@ -583,7 +583,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the parent thumb image tag. /// /// The parent thumb image tag. - public Guid? ParentThumbImageTag { get; set; } + public string ParentThumbImageTag { get; set; } /// /// Gets or sets the chapters. diff --git a/MediaBrowser.Model/Dto/BaseItemPerson.cs b/MediaBrowser.Model/Dto/BaseItemPerson.cs index 1cc3f722d..376ba239d 100644 --- a/MediaBrowser.Model/Dto/BaseItemPerson.cs +++ b/MediaBrowser.Model/Dto/BaseItemPerson.cs @@ -33,7 +33,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the primary image tag. /// /// The primary image tag. - public Guid? PrimaryImageTag { get; set; } + public string PrimaryImageTag { get; set; } /// /// Gets a value indicating whether this instance has primary image. @@ -44,7 +44,7 @@ namespace MediaBrowser.Model.Dto { get { - return PrimaryImageTag.HasValue; + return PrimaryImageTag != null; } } diff --git a/MediaBrowser.Model/Dto/ChapterInfoDto.cs b/MediaBrowser.Model/Dto/ChapterInfoDto.cs index 5a72110ce..09dd2d582 100644 --- a/MediaBrowser.Model/Dto/ChapterInfoDto.cs +++ b/MediaBrowser.Model/Dto/ChapterInfoDto.cs @@ -27,7 +27,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the image tag. /// /// The image tag. - public Guid? ImageTag { get; set; } + public string ImageTag { get; set; } /// /// Gets a value indicating whether this instance has image. @@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Dto [IgnoreDataMember] public bool HasImage { - get { return ImageTag.HasValue; } + get { return ImageTag != null; } } public event PropertyChangedEventHandler PropertyChanged; diff --git a/MediaBrowser.Model/Dto/ImageInfo.cs b/MediaBrowser.Model/Dto/ImageInfo.cs index 0850ee0a4..fa3a38fcb 100644 --- a/MediaBrowser.Model/Dto/ImageInfo.cs +++ b/MediaBrowser.Model/Dto/ImageInfo.cs @@ -23,7 +23,7 @@ namespace MediaBrowser.Model.Dto /// /// The image tag /// - public Guid ImageTag; + public string ImageTag; /// /// Gets or sets the path. diff --git a/MediaBrowser.Model/Dto/ImageOptions.cs b/MediaBrowser.Model/Dto/ImageOptions.cs index 7fe162ff9..08ac7906a 100644 --- a/MediaBrowser.Model/Dto/ImageOptions.cs +++ b/MediaBrowser.Model/Dto/ImageOptions.cs @@ -56,7 +56,7 @@ namespace MediaBrowser.Model.Dto /// If set this will result in strong, unconditional response caching /// /// The hash. - public Guid? Tag { get; set; } + public string Tag { get; set; } /// /// Gets or sets a value indicating whether [crop whitespace]. diff --git a/MediaBrowser.Model/Dto/ItemByNameCounts.cs b/MediaBrowser.Model/Dto/ItemByNameCounts.cs index 31b6d2da0..7c51f07bd 100644 --- a/MediaBrowser.Model/Dto/ItemByNameCounts.cs +++ b/MediaBrowser.Model/Dto/ItemByNameCounts.cs @@ -7,7 +7,7 @@ namespace MediaBrowser.Model.Dto /// public class ItemByNameCounts { - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the total count. diff --git a/MediaBrowser.Model/Dto/StudioDto.cs b/MediaBrowser.Model/Dto/StudioDto.cs index 696213a40..4f21784fd 100644 --- a/MediaBrowser.Model/Dto/StudioDto.cs +++ b/MediaBrowser.Model/Dto/StudioDto.cs @@ -21,7 +21,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the primary image tag. /// /// The primary image tag. - public Guid? PrimaryImageTag { get; set; } + public string PrimaryImageTag { get; set; } /// /// Gets a value indicating whether this instance has primary image. @@ -32,7 +32,7 @@ namespace MediaBrowser.Model.Dto { get { - return PrimaryImageTag.HasValue; + return PrimaryImageTag != null; } } diff --git a/MediaBrowser.Model/Dto/UserDto.cs b/MediaBrowser.Model/Dto/UserDto.cs index efbd64343..c4a43c512 100644 --- a/MediaBrowser.Model/Dto/UserDto.cs +++ b/MediaBrowser.Model/Dto/UserDto.cs @@ -28,7 +28,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the primary image tag. /// /// The primary image tag. - public Guid? PrimaryImageTag { get; set; } + public string PrimaryImageTag { get; set; } /// /// Gets or sets a value indicating whether this instance has password. @@ -73,7 +73,7 @@ namespace MediaBrowser.Model.Dto [IgnoreDataMember] public bool HasPrimaryImage { - get { return PrimaryImageTag.HasValue; } + get { return PrimaryImageTag != null; } } /// diff --git a/MediaBrowser.Model/Entities/BaseItemInfo.cs b/MediaBrowser.Model/Entities/BaseItemInfo.cs index c2e6a7631..88af18289 100644 --- a/MediaBrowser.Model/Entities/BaseItemInfo.cs +++ b/MediaBrowser.Model/Entities/BaseItemInfo.cs @@ -46,7 +46,7 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the primary image tag. /// /// The primary image tag. - public Guid? PrimaryImageTag { get; set; } + public string PrimaryImageTag { get; set; } /// /// Gets or sets the primary image item identifier. @@ -58,7 +58,7 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the logo image tag. /// /// The logo image tag. - public Guid? LogoImageTag { get; set; } + public string LogoImageTag { get; set; } /// /// Gets or sets the logo item identifier. @@ -70,7 +70,7 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the thumb image tag. /// /// The thumb image tag. - public Guid? ThumbImageTag { get; set; } + public string ThumbImageTag { get; set; } /// /// Gets or sets the thumb item identifier. @@ -82,7 +82,7 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the thumb image tag. /// /// The thumb image tag. - public Guid? BackdropImageTag { get; set; } + public string BackdropImageTag { get; set; } /// /// Gets or sets the thumb item identifier. @@ -163,7 +163,7 @@ namespace MediaBrowser.Model.Entities [IgnoreDataMember] public bool HasPrimaryImage { - get { return PrimaryImageTag.HasValue; } + get { return PrimaryImageTag != null; } } public BaseItemInfo() diff --git a/MediaBrowser.Model/Entities/DisplayPreferences.cs b/MediaBrowser.Model/Entities/DisplayPreferences.cs index 829affd01..62233ac27 100644 --- a/MediaBrowser.Model/Entities/DisplayPreferences.cs +++ b/MediaBrowser.Model/Entities/DisplayPreferences.cs @@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the user id. /// /// The user id. - public Guid Id { get; set; } + public string Id { get; set; } /// /// Gets or sets the type of the view. /// @@ -105,7 +105,7 @@ namespace MediaBrowser.Model.Entities { var newWidth = PrimaryImageWidth / ImageScale; - var size = DrawingUtils.Resize(PrimaryImageWidth, PrimaryImageHeight, newWidth); + var size = DrawingUtils.Resize(PrimaryImageWidth, PrimaryImageHeight, newWidth, null, null, null); PrimaryImageWidth = Convert.ToInt32(size.Width); PrimaryImageHeight = Convert.ToInt32(size.Height); diff --git a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs index dca8cd584..4371ddae4 100644 --- a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs +++ b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs @@ -12,41 +12,41 @@ namespace MediaBrowser.Model.Entities /// Gets or sets the folders added to. /// /// The folders added to. - public List FoldersAddedTo { get; set; } + public List FoldersAddedTo { get; set; } /// /// Gets or sets the folders removed from. /// /// The folders removed from. - public List FoldersRemovedFrom { get; set; } + public List FoldersRemovedFrom { get; set; } /// /// Gets or sets the items added. /// /// The items added. - public List ItemsAdded { get; set; } + public List ItemsAdded { get; set; } /// /// Gets or sets the items removed. /// /// The items removed. - public List ItemsRemoved { get; set; } + public List ItemsRemoved { get; set; } /// /// Gets or sets the items updated. /// /// The items updated. - public List ItemsUpdated { get; set; } + public List ItemsUpdated { get; set; } /// /// Initializes a new instance of the class. /// public LibraryUpdateInfo() { - FoldersAddedTo = new List(); - FoldersRemovedFrom = new List(); - ItemsAdded = new List(); - ItemsRemoved = new List(); - ItemsUpdated = new List(); + FoldersAddedTo = new List(); + FoldersRemovedFrom = new List(); + ItemsAdded = new List(); + ItemsRemoved = new List(); + ItemsUpdated = new List(); } } } diff --git a/MediaBrowser.Model/Events/GenericEventArgs.cs b/MediaBrowser.Model/Events/GenericEventArgs.cs new file mode 100644 index 000000000..5a83419e1 --- /dev/null +++ b/MediaBrowser.Model/Events/GenericEventArgs.cs @@ -0,0 +1,17 @@ +using System; + +namespace MediaBrowser.Model.Events +{ + /// + /// Provides a generic EventArgs subclass that can hold any kind of object + /// + /// + public class GenericEventArgs : EventArgs + { + /// + /// Gets or sets the argument. + /// + /// The argument. + public T Argument { get; set; } + } +} diff --git a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs index fe6faf363..3fec0ee56 100644 --- a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs @@ -39,7 +39,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the image tags. /// /// The image tags. - public Dictionary ImageTags { get; set; } + public Dictionary ImageTags { get; set; } /// /// Gets or sets the number. @@ -113,7 +113,7 @@ namespace MediaBrowser.Model.LiveTv public ChannelInfoDto() { - ImageTags = new Dictionary(); + ImageTags = new Dictionary(); MediaSources = new List(); } diff --git a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs index f6b343bdb..4e7ab8224 100644 --- a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs @@ -45,7 +45,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the channel primary image tag. /// /// The channel primary image tag. - public Guid? ChannelPrimaryImageTag { get; set; } + public string ChannelPrimaryImageTag { get; set; } /// /// Gets or sets the play access. @@ -136,7 +136,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the image tags. /// /// The image tags. - public Dictionary ImageTags { get; set; } + public Dictionary ImageTags { get; set; } /// /// Gets or sets the user data. @@ -211,7 +211,7 @@ namespace MediaBrowser.Model.LiveTv public ProgramInfoDto() { Genres = new List(); - ImageTags = new Dictionary(); + ImageTags = new Dictionary(); } public event PropertyChangedEventHandler PropertyChanged; diff --git a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs index de07382c0..3705b7a29 100644 --- a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs @@ -50,7 +50,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the channel primary image tag. /// /// The channel primary image tag. - public Guid? ChannelPrimaryImageTag { get; set; } + public string ChannelPrimaryImageTag { get; set; } /// /// ChannelName of the recording. @@ -224,7 +224,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the image tags. /// /// The image tags. - public Dictionary ImageTags { get; set; } + public Dictionary ImageTags { get; set; } /// /// Gets or sets the user data. @@ -253,7 +253,7 @@ namespace MediaBrowser.Model.LiveTv public RecordingInfoDto() { Genres = new List(); - ImageTags = new Dictionary(); + ImageTags = new Dictionary(); MediaSources = new List(); } diff --git a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs index 393233c1b..7c590307f 100644 --- a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Model.LiveTv /// Gets or sets the image tags. /// /// The image tags. - public Dictionary ImageTags { get; set; } + public Dictionary ImageTags { get; set; } /// /// Gets a value indicating whether this instance has primary image. @@ -57,7 +57,7 @@ namespace MediaBrowser.Model.LiveTv public SeriesTimerInfoDto() { - ImageTags = new Dictionary(); + ImageTags = new Dictionary(); Days = new List(); } } diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index aaa29d21c..1f7284422 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -97,6 +97,7 @@ + diff --git a/MediaBrowser.Model/Search/SearchHint.cs b/MediaBrowser.Model/Search/SearchHint.cs index 002200c0f..4eced7706 100644 --- a/MediaBrowser.Model/Search/SearchHint.cs +++ b/MediaBrowser.Model/Search/SearchHint.cs @@ -47,13 +47,13 @@ namespace MediaBrowser.Model.Search /// Gets or sets the image tag. /// /// The image tag. - public Guid? PrimaryImageTag { get; set; } + public string PrimaryImageTag { get; set; } /// /// Gets or sets the thumb image tag. /// /// The thumb image tag. - public Guid? ThumbImageTag { get; set; } + public string ThumbImageTag { get; set; } /// /// Gets or sets the thumb image item identifier. @@ -65,7 +65,7 @@ namespace MediaBrowser.Model.Search /// Gets or sets the backdrop image tag. /// /// The backdrop image tag. - public Guid? BackdropImageTag { get; set; } + public string BackdropImageTag { get; set; } /// /// Gets or sets the backdrop image item identifier. diff --git a/MediaBrowser.Model/Session/GeneralCommand.cs b/MediaBrowser.Model/Session/GeneralCommand.cs index 071eac954..98b3c50b3 100644 --- a/MediaBrowser.Model/Session/GeneralCommand.cs +++ b/MediaBrowser.Model/Session/GeneralCommand.cs @@ -49,6 +49,7 @@ namespace MediaBrowser.Model.Session SetSubtitleStreamIndex = 24, ToggleFullscreen = 25, DisplayContent = 26, - GoToSearch = 27 + GoToSearch = 27, + DisplayMessage = 28 } } diff --git a/MediaBrowser.Model/Session/SessionInfoDto.cs b/MediaBrowser.Model/Session/SessionInfoDto.cs index cd6ecbbb2..0dc119500 100644 --- a/MediaBrowser.Model/Session/SessionInfoDto.cs +++ b/MediaBrowser.Model/Session/SessionInfoDto.cs @@ -55,7 +55,7 @@ namespace MediaBrowser.Model.Session /// Gets or sets the user primary image tag. /// /// The user primary image tag. - public Guid? UserPrimaryImageTag { get; set; } + public string UserPrimaryImageTag { get; set; } /// /// Gets or sets the name of the user. diff --git a/MediaBrowser.Model/Tasks/TaskInfo.cs b/MediaBrowser.Model/Tasks/TaskInfo.cs index 8e795f22f..83ee0b7e6 100644 --- a/MediaBrowser.Model/Tasks/TaskInfo.cs +++ b/MediaBrowser.Model/Tasks/TaskInfo.cs @@ -30,7 +30,7 @@ namespace MediaBrowser.Model.Tasks /// Gets or sets the id. /// /// The id. - public Guid Id { get; set; } + public string Id { get; set; } /// /// Gets or sets the last execution result. diff --git a/MediaBrowser.Model/Tasks/TaskResult.cs b/MediaBrowser.Model/Tasks/TaskResult.cs index c04d2f2fe..e73b4c9a1 100644 --- a/MediaBrowser.Model/Tasks/TaskResult.cs +++ b/MediaBrowser.Model/Tasks/TaskResult.cs @@ -35,7 +35,7 @@ namespace MediaBrowser.Model.Tasks /// Gets or sets the id. /// /// The id. - public Guid Id { get; set; } + public string Id { get; set; } /// /// Gets or sets the error message. diff --git a/MediaBrowser.Model/Updates/InstallationInfo.cs b/MediaBrowser.Model/Updates/InstallationInfo.cs index 09b4975a8..b904a0e58 100644 --- a/MediaBrowser.Model/Updates/InstallationInfo.cs +++ b/MediaBrowser.Model/Updates/InstallationInfo.cs @@ -11,7 +11,7 @@ namespace MediaBrowser.Model.Updates /// Gets or sets the id. /// /// The id. - public Guid Id { get; set; } + public string Id { get; set; } /// /// Gets or sets the name. diff --git a/MediaBrowser.Model/Updates/PackageVersionInfo.cs b/MediaBrowser.Model/Updates/PackageVersionInfo.cs index 3b0a94019..b3d297e8e 100644 --- a/MediaBrowser.Model/Updates/PackageVersionInfo.cs +++ b/MediaBrowser.Model/Updates/PackageVersionInfo.cs @@ -47,7 +47,7 @@ namespace MediaBrowser.Model.Updates /// The STR. /// The def. /// System.String. - private static string ValueOrDefault(string str, string def = "") + private static string ValueOrDefault(string str, string def) { return string.IsNullOrEmpty(str) ? def : str; } @@ -80,7 +80,7 @@ namespace MediaBrowser.Model.Updates /// Gets or sets the source URL. /// /// The source URL. - public Guid checksum { get; set; } + public string checksum { get; set; } /// /// Gets or sets the target filename. diff --git a/MediaBrowser.Model/Web/QueryStringDictionary.cs b/MediaBrowser.Model/Web/QueryStringDictionary.cs index 905fbb215..6b035fa45 100644 --- a/MediaBrowser.Model/Web/QueryStringDictionary.cs +++ b/MediaBrowser.Model/Web/QueryStringDictionary.cs @@ -122,50 +122,6 @@ namespace MediaBrowser.Model.Web } } - /// - /// Adds the specified name. - /// - /// The name. - /// The value. - /// value - public void Add(string name, Guid value) - { - if (value == Guid.Empty) - { - throw new ArgumentNullException("value"); - } - - Add(name, value.ToString()); - } - - /// - /// Adds if not empty. - /// - /// The name. - /// The value. - public void AddIfNotEmpty(string name, Guid value) - { - if (value != Guid.Empty) - { - Add(name, value); - } - - Add(name, value); - } - - /// - /// Adds if not null. - /// - /// The name. - /// The value. - public void AddIfNotNull(string name, Guid? value) - { - if (value.HasValue) - { - Add(name, value.Value); - } - } - /// /// Adds the specified name. /// diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs b/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs index ba241931c..2f1c9fd53 100644 --- a/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs +++ b/MediaBrowser.Providers/MediaInfo/SubtitleDownloader.cs @@ -91,9 +91,18 @@ namespace MediaBrowser.Providers.MediaInfo return false; } + var audioStreams = internalMediaStreams.Where(i => i.Type == MediaStreamType.Audio).ToList(); + var defaultAudioStreams = audioStreams.Where(i => i.IsDefault).ToList(); + + // If none are marked as default, just take a guess + if (defaultAudioStreams.Count == 0) + { + defaultAudioStreams = audioStreams.Take(1).ToList(); + } + // There's already a default audio stream for this language if (skipIfAudioTrackMatches && - internalMediaStreams.Any(i => i.Type == MediaStreamType.Audio && i.IsDefault && string.Equals(i.Language, language, StringComparison.OrdinalIgnoreCase))) + defaultAudioStreams.Any(i => string.Equals(i.Language, language, StringComparison.OrdinalIgnoreCase))) { return false; } diff --git a/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs b/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs index 1b53483c4..7b40b5673 100644 --- a/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs +++ b/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs @@ -1,11 +1,11 @@ -using MediaBrowser.Common.Events; -using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Security; using MediaBrowser.Controller.Subtitles; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Events; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Providers; using OpenSubtitlesHandler; diff --git a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs index ab79c6a1a..59267e856 100644 --- a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs +++ b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs @@ -4,6 +4,7 @@ using MediaBrowser.Common.Implementations.Configuration; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Events; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; using System; diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs index c6c1ec050..38f812809 100644 --- a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs +++ b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs @@ -649,7 +649,7 @@ namespace MediaBrowser.Server.Implementations.Drawing /// The image. /// Guid. /// item - public Guid GetImageCacheTag(IHasImages item, ItemImageInfo image) + public string GetImageCacheTag(IHasImages item, ItemImageInfo image) { if (item == null) { @@ -676,7 +676,7 @@ namespace MediaBrowser.Server.Implementations.Drawing /// The image enhancers. /// Guid. /// item - public Guid GetImageCacheTag(IHasImages item, ImageType imageType, string originalImagePath, DateTime dateModified, List imageEnhancers) + public string GetImageCacheTag(IHasImages item, ImageType imageType, string originalImagePath, DateTime dateModified, List imageEnhancers) { if (item == null) { @@ -696,14 +696,14 @@ namespace MediaBrowser.Server.Implementations.Drawing // Optimization if (imageEnhancers.Count == 0) { - return (originalImagePath + dateModified.Ticks).GetMD5(); + return (originalImagePath + dateModified.Ticks).GetMD5().ToString("N"); } // Cache name is created with supported enhancers combined with the last config change so we pick up new config changes var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList(); cacheKeys.Add(originalImagePath + dateModified.Ticks); - return string.Join("|", cacheKeys.ToArray()).GetMD5(); + return string.Join("|", cacheKeys.ToArray()).GetMD5().ToString("N"); } /// diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index c88cefdb3..8a0d4ca49 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -326,7 +326,7 @@ namespace MediaBrowser.Server.Implementations.Dto /// /// The item. /// List{System.String}. - private List GetBackdropImageTags(BaseItem item) + private List GetBackdropImageTags(BaseItem item) { return GetCacheTags(item, ImageType.Backdrop).ToList(); } @@ -336,26 +336,25 @@ namespace MediaBrowser.Server.Implementations.Dto /// /// The item. /// List{Guid}. - private List GetScreenshotImageTags(BaseItem item) + private List GetScreenshotImageTags(BaseItem item) { var hasScreenshots = item as IHasScreenshots; if (hasScreenshots == null) { - return new List(); + return new List(); } return GetCacheTags(item, ImageType.Screenshot).ToList(); } - private IEnumerable GetCacheTags(BaseItem item, ImageType type) + private IEnumerable GetCacheTags(BaseItem item, ImageType type) { return item.GetImages(type) .Select(p => GetImageCacheTag(item, p)) - .Where(i => i.HasValue) - .Select(i => i.Value) + .Where(i => i != null) .ToList(); } - private Guid? GetImageCacheTag(BaseItem item, ImageType type) + private string GetImageCacheTag(BaseItem item, ImageType type) { try { @@ -368,7 +367,7 @@ namespace MediaBrowser.Server.Implementations.Dto } } - private Guid? GetImageCacheTag(BaseItem item, ItemImageInfo image) + private string GetImageCacheTag(BaseItem item, ItemImageInfo image) { try { @@ -677,7 +676,7 @@ namespace MediaBrowser.Server.Implementations.Dto dto.Genres = item.Genres; } - dto.ImageTags = new Dictionary(); + dto.ImageTags = new Dictionary(); // Prevent implicitly captured closure var currentItem = item; @@ -685,9 +684,9 @@ namespace MediaBrowser.Server.Implementations.Dto { var tag = GetImageCacheTag(item, image); - if (tag.HasValue) + if (tag != null) { - dto.ImageTags[image.Type] = tag.Value; + dto.ImageTags[image.Type] = tag; } } @@ -1216,7 +1215,7 @@ namespace MediaBrowser.Server.Implementations.Dto } } - var bitrate = i.TotalBitrate ?? + var bitrate = i.TotalBitrate ?? info.MediaStreams.Where(m => m.Type != MediaStreamType.Subtitle && !string.Equals(m.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase)) .Select(m => m.BitRate ?? 0) .Sum(); diff --git a/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs index 59fa78a00..40eeea651 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs @@ -252,15 +252,15 @@ namespace MediaBrowser.Server.Implementations.EntryPoints return new LibraryUpdateInfo { - ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id).Distinct().ToList(), + ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id.ToString("N")).Distinct().ToList(), - ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id).Distinct().ToList(), + ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id.ToString("N")).Distinct().ToList(), - ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren, true)).Select(i => i.Id).Distinct().ToList(), + ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren, true)).Select(i => i.Id.ToString("N")).Distinct().ToList(), - FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id).Distinct().ToList(), + FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id.ToString("N")).Distinct().ToList(), - FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id).Distinct().ToList() + FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, allRecursiveChildren)).Select(i => i.Id.ToString("N")).Distinct().ToList() }; } diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs index 0081c6243..9d2de0f6d 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs @@ -11,6 +11,7 @@ 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; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ServerEventNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/ServerEventNotifier.cs index 0925ca86c..773ee24a9 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/ServerEventNotifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/ServerEventNotifier.cs @@ -9,6 +9,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Session; +using MediaBrowser.Model.Events; using MediaBrowser.Model.Tasks; using System; using System.Threading; diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index 2ee843f09..23303c41f 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -5,6 +5,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Events; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs index cf7358cce..7bf484689 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -241,9 +241,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv var imageTag = GetImageTag(recording); - if (imageTag.HasValue) + if (imageTag != null) { - dto.ImageTags[ImageType.Primary] = imageTag.Value; + dto.ImageTags[ImageType.Primary] = imageTag; } if (user != null) @@ -328,9 +328,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv var imageTag = GetImageTag(info); - if (imageTag.HasValue) + if (imageTag != null) { - dto.ImageTags[ImageType.Primary] = imageTag.Value; + dto.ImageTags[ImageType.Primary] = imageTag; } if (currentProgram != null) @@ -389,9 +389,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv var imageTag = GetImageTag(item); - if (imageTag.HasValue) + if (imageTag != null) { - dto.ImageTags[ImageType.Primary] = imageTag.Value; + dto.ImageTags[ImageType.Primary] = imageTag; } if (user != null) @@ -404,7 +404,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv return dto; } - private Guid? GetImageTag(IHasImages info) + private string GetImageTag(IHasImages info) { try { diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs index 9f6ec0f24..0b4d78de3 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs @@ -111,7 +111,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { throw new ArgumentNullException("displayPreferences"); } - if (displayPreferences.Id == Guid.Empty) + if (string.IsNullOrWhiteSpace(displayPreferences.Id)) { throw new ArgumentNullException("displayPreferences.Id"); } @@ -132,7 +132,7 @@ namespace MediaBrowser.Server.Implementations.Persistence { cmd.CommandText = "replace into userdisplaypreferences (id, userid, client, data) values (@1, @2, @3, @4)"; - cmd.Parameters.Add(cmd, "@1", DbType.Guid).Value = displayPreferences.Id; + cmd.Parameters.Add(cmd, "@1", DbType.Guid).Value = new Guid(displayPreferences.Id); cmd.Parameters.Add(cmd, "@2", DbType.Guid).Value = userId; cmd.Parameters.Add(cmd, "@3", DbType.String).Value = client; cmd.Parameters.Add(cmd, "@4", DbType.Binary).Value = serialized; @@ -183,9 +183,9 @@ namespace MediaBrowser.Server.Implementations.Persistence /// The client. /// Task{DisplayPreferences}. /// item - public DisplayPreferences GetDisplayPreferences(Guid displayPreferencesId, Guid userId, string client) + public DisplayPreferences GetDisplayPreferences(string displayPreferencesId, Guid userId, string client) { - if (displayPreferencesId == Guid.Empty) + if (string.IsNullOrWhiteSpace(displayPreferencesId)) { throw new ArgumentNullException("displayPreferencesId"); } @@ -193,7 +193,7 @@ namespace MediaBrowser.Server.Implementations.Persistence var cmd = _connection.CreateCommand(); cmd.CommandText = "select data from userdisplaypreferences where id = @id and userId=@userId and client=@client"; - cmd.Parameters.Add(cmd, "@id", DbType.Guid).Value = displayPreferencesId; + cmd.Parameters.Add(cmd, "@id", DbType.Guid).Value = new Guid(displayPreferencesId); cmd.Parameters.Add(cmd, "@userId", DbType.Guid).Value = userId; cmd.Parameters.Add(cmd, "@client", DbType.String).Value = client; @@ -208,7 +208,7 @@ namespace MediaBrowser.Server.Implementations.Persistence } } - return new DisplayPreferences { Id = displayPreferencesId }; + return null; } /// diff --git a/MediaBrowser.Server.Implementations/Roku/RokuSessionController.cs b/MediaBrowser.Server.Implementations/Roku/RokuSessionController.cs index cdaf03fbe..ad9db947a 100644 --- a/MediaBrowser.Server.Implementations/Roku/RokuSessionController.cs +++ b/MediaBrowser.Server.Implementations/Roku/RokuSessionController.cs @@ -56,16 +56,6 @@ namespace MediaBrowser.Server.Implementations.Roku return Task.FromResult(true); } - public Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken) - { - return SendCommand(new WebSocketMessage - { - MessageType = "MessageCommand", - Data = command - - }, cancellationToken); - } - public Task SendPlayCommand(PlayRequest command, CancellationToken cancellationToken) { return SendCommand(new WebSocketMessage diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index b187c8d6b..ea709cd24 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Events; +using System.Globalization; +using MediaBrowser.Common.Events; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Drawing; @@ -712,12 +713,20 @@ namespace MediaBrowser.Server.Implementations.Session public Task SendMessageCommand(string controllingSessionId, string sessionId, MessageCommand command, CancellationToken cancellationToken) { - var session = GetSessionForRemoteControl(sessionId); + var generalCommand = new GeneralCommand + { + Name = GeneralCommandType.DisplayMessage.ToString() + }; - var controllingSession = GetSession(controllingSessionId); - AssertCanControl(session, controllingSession); + generalCommand.Arguments["Header"] = command.Header; + generalCommand.Arguments["Text"] = command.Text; - return session.SessionController.SendMessageCommand(command, cancellationToken); + if (command.TimeoutMs.HasValue) + { + generalCommand.Arguments["TimeoutMs"] = command.TimeoutMs.Value.ToString(CultureInfo.InvariantCulture); + } + + return SendGeneralCommand(controllingSessionId, sessionId, generalCommand, cancellationToken); } public Task SendGeneralCommand(string controllingSessionId, string sessionId, GeneralCommand command, CancellationToken cancellationToken) @@ -1199,7 +1208,7 @@ namespace MediaBrowser.Server.Implementations.Session }; info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary); - if (info.PrimaryImageTag.HasValue) + if (info.PrimaryImageTag != null) { info.PrimaryImageItemId = GetDtoId(item); } @@ -1237,14 +1246,14 @@ namespace MediaBrowser.Server.Implementations.Session info.Album = audio.Album; info.Artists = audio.Artists; - if (!info.PrimaryImageTag.HasValue) + if (info.PrimaryImageTag == null) { var album = audio.Parents.OfType().FirstOrDefault(); if (album != null && album.HasImage(ImageType.Primary)) { info.PrimaryImageTag = GetImageCacheTag(album, ImageType.Primary); - if (info.PrimaryImageTag.HasValue) + if (info.PrimaryImageTag != null) { info.PrimaryImageItemId = GetDtoId(album); } @@ -1345,7 +1354,7 @@ namespace MediaBrowser.Server.Implementations.Session return info; } - private Guid? GetImageCacheTag(BaseItem item, ImageType type) + private string GetImageCacheTag(BaseItem item, ImageType type) { try { diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index 4b0c25a87..3b6ecd21e 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -57,18 +57,6 @@ namespace MediaBrowser.Server.Implementations.Session return socket; } - public Task SendMessageCommand(MessageCommand command, CancellationToken cancellationToken) - { - var socket = GetActiveSocket(); - - return socket.SendAsync(new WebSocketMessage - { - MessageType = "MessageCommand", - Data = command - - }, cancellationToken); - } - public Task SendPlayCommand(PlayRequest command, CancellationToken cancellationToken) { var socket = GetActiveSocket(); -- 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') 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