From 30e782d3076318cc97b93dde338b0c4afdbb5bf9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 4 Mar 2015 23:13:08 -0500 Subject: [PATCH] made dlna cast & crew optional --- .../ContentDirectory/ControlHandler.cs | 19 ++++++++++++------- .../Configuration/DlnaOptions.cs | 2 ++ .../Localization/Server/server.json | 2 ++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs b/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs index 5d6ee5c73e..25e4c882a4 100644 --- a/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs +++ b/MediaBrowser.Dlna/ContentDirectory/ControlHandler.cs @@ -11,6 +11,7 @@ using MediaBrowser.Dlna.Didl; using MediaBrowser.Dlna.Server; using MediaBrowser.Dlna.Service; using MediaBrowser.Model.Channels; +using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; @@ -31,6 +32,7 @@ namespace MediaBrowser.Dlna.ContentDirectory private readonly ILibraryManager _libraryManager; private readonly IChannelManager _channelManager; private readonly IUserDataManager _userDataManager; + private IServerConfigurationManager _config; private readonly User _user; private const string NS_DC = "http://purl.org/dc/elements/1.1/"; @@ -54,6 +56,7 @@ namespace MediaBrowser.Dlna.ContentDirectory _systemUpdateId = systemUpdateId; _channelManager = channelManager; _profile = profile; + _config = config; _didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization); } @@ -465,12 +468,14 @@ namespace MediaBrowser.Dlna.ContentDirectory }).ConfigureAwait(false); + var options = _config.GetDlnaConfiguration(); + var serverItems = queryResult .Items .Select(i => new ServerItem { Item = i, - StubType = GetDisplayStubType(i, item) + StubType = GetDisplayStubType(i, item, options) }) .ToArray(); @@ -539,23 +544,23 @@ namespace MediaBrowser.Dlna.ContentDirectory return result; } - private StubType? GetDisplayStubType(BaseItem item, BaseItem context) + private StubType? GetDisplayStubType(BaseItem item, BaseItem context, DlnaOptions options) { if (context == null || context.IsFolder) { var movie = item as Movie; - if (movie != null) + if (movie != null && options.EnableEnhancedMovies) { if (movie.GetTrailerIds().Count > 0 || movie.SpecialFeatureIds.Count > 0) { return StubType.Folder; } - } - if (EnablePeopleDisplay(item)) - { - return StubType.Folder; + if (EnablePeopleDisplay(item)) + { + return StubType.Folder; + } } } diff --git a/MediaBrowser.Model/Configuration/DlnaOptions.cs b/MediaBrowser.Model/Configuration/DlnaOptions.cs index df7ae5c49c..277102a501 100644 --- a/MediaBrowser.Model/Configuration/DlnaOptions.cs +++ b/MediaBrowser.Model/Configuration/DlnaOptions.cs @@ -10,6 +10,7 @@ namespace MediaBrowser.Model.Configuration public int ClientDiscoveryIntervalSeconds { get; set; } public int BlastAliveMessageIntervalSeconds { get; set; } public string DefaultUserId { get; set; } + public bool EnableEnhancedMovies { get; set; } public DlnaOptions() { @@ -18,6 +19,7 @@ namespace MediaBrowser.Model.Configuration BlastAliveMessages = true; ClientDiscoveryIntervalSeconds = 60; BlastAliveMessageIntervalSeconds = 30; + EnableEnhancedMovies = true; } } } diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 2f593efcdc..80ba0602df 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -78,6 +78,8 @@ "OptionDetectArchiveFilesAsMediaHelp": "If enabled, files with .rar and .zip extensions will be detected as media files.", "LabelEnterConnectUserName": "User name or email:", "LabelEnterConnectUserNameHelp": "This is your Media Browser online account user name or password.", + "LabelEnableEnhancedMovies": "Enable enhanced movie displays", + "LabelEnableEnhancedMoviesHelp": "When enabled, movies will be displayed as folders to include trailers, extras, cast & crew, and other related content.", "HeaderSyncJobInfo": "Sync Job", "FolderTypeMixed": "Mixed content", "FolderTypeMovies": "Movies",